[Pigeon] Condenses serialization formats (#2745)

* Fixs missed indents on generated comments

* begin improved serialization

* formatting errors

* Dart encoder updated to use lists, tests to match

* Begin swift serial, change error shape

* update tests for swift and dart

* true > false

* Return to Object

* correctly nest lists in dart and tests

* Kotlin gen and tests updated to lists

* Java and Tests updated to new serials

* Stuart check this pr (start of objc changes)

* obj c tests for serial

* update unit tests to match new generated outputs

* finish objc tests

* More kt tests

* c++ generator and unit tests

* analyze, format, changelog

* test file updates for ci

* format and analyze again

* a few more test generated files

* Partial Windows fixes

- Fix API call typo.
- Fix double nesting of arrays for class serialization.
- Replace incorrect emplace calls with push_back.
- Start to update unit tests.

* null field tests c++

* format

* fix merge issue with broken test

* remove unneeded wrapping

* generated files

* fix some formatting errors

* format

* more gen files

* gen files

* generator reviews pt1

* test fixes pt1

* fixed nits and nil issues with objc

* better fix for objc null classes

* fix doc comment

* unit test updates

* format

* some c++ fixes

* typo

* format

* Some nits and such

* comment

* remove deleted files

* c++ nits

* objc nits

* all but one c++ bug

* init all fields

* start of documenting data shape

* nits and error handling

* more nits and such

* bug?

* references

* const

* new null for larger alltypes

Co-authored-by: Stuart Morgan <stuartmorgan@google.com>
diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md
index c0db66c..b6e036a 100644
--- a/packages/pigeon/CHANGELOG.md
+++ b/packages/pigeon/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 4.2.12
+
+* Updates serialization to use lists instead of maps to improve performance.
+
 ## 4.2.11
 
 * [swift] Fixes compressed list data types.
diff --git a/packages/pigeon/lib/cpp_generator.dart b/packages/pigeon/lib/cpp_generator.dart
index f893f57..565c0ba 100644
--- a/packages/pigeon/lib/cpp_generator.dart
+++ b/packages/pigeon/lib/cpp_generator.dart
@@ -108,7 +108,7 @@
         indent.write('case ${customClass.enumeration}:');
         indent.writeScoped('', '', () {
           indent.writeln(
-              'return flutter::CustomEncodableValue(${customClass.name}(std::get<flutter::EncodableMap>(ReadValue(stream))));');
+              'return flutter::CustomEncodableValue(${customClass.name}(std::get<flutter::EncodableList>(ReadValue(stream))));');
         });
       }
       indent.write('default:');
@@ -131,7 +131,7 @@
         indent.scoped('{', '}', () {
           indent.writeln('stream->WriteByte(${customClass.enumeration});');
           indent.writeln(
-              'WriteValue(std::any_cast<${customClass.name}>(*custom_value).ToEncodableMap(), stream);');
+              'WriteValue(flutter::EncodableValue(std::any_cast<${customClass.name}>(*custom_value).ToEncodableList()), stream);');
           indent.writeln('return;');
         });
       }
@@ -207,7 +207,7 @@
   indent.scoped('{', '};', () {
     indent.scoped(' public:', '', () {
       indent.writeln('${klass.name}();');
-      for (final NamedType field in klass.fields) {
+      for (final NamedType field in getFieldsInSerializationOrder(klass)) {
         addDocumentationComments(
             indent, field.documentationComments, _docCommentSpec);
         final HostDatatype baseDatatype = getFieldHostDatatype(
@@ -232,8 +232,8 @@
     });
 
     indent.scoped(' private:', '', () {
-      indent.writeln('${klass.name}(flutter::EncodableMap map);');
-      indent.writeln('flutter::EncodableMap ToEncodableMap() const;');
+      indent.writeln('${klass.name}(const flutter::EncodableList& list);');
+      indent.writeln('flutter::EncodableList ToEncodableList() const;');
       for (final Class friend in root.classes) {
         if (friend != klass &&
             friend.fields.any(
@@ -251,7 +251,7 @@
         indent.writeln('friend class $testFriend;');
       }
 
-      for (final NamedType field in klass.fields) {
+      for (final NamedType field in getFieldsInSerializationOrder(klass)) {
         final HostDatatype hostDatatype = getFieldHostDatatype(
             field,
             root.classes,
@@ -280,7 +280,7 @@
   indent.addln('');
 
   // Getters and setters.
-  for (final NamedType field in klass.fields) {
+  for (final NamedType field in getFieldsInSerializationOrder(klass)) {
     final HostDatatype hostDatatype = getFieldHostDatatype(field, root.classes,
         root.enums, (TypeDeclaration x) => _baseCppTypeForBuiltinDartType(x));
     final String instanceVariableName = _makeInstanceVariableName(field);
@@ -317,10 +317,11 @@
   }
 
   // Serialization.
-  indent.write('flutter::EncodableMap ${klass.name}::ToEncodableMap() const ');
+  indent
+      .write('flutter::EncodableList ${klass.name}::ToEncodableList() const ');
   indent.scoped('{', '}', () {
-    indent.scoped('return flutter::EncodableMap{', '};', () {
-      for (final NamedType field in klass.fields) {
+    indent.scoped('return flutter::EncodableList{', '};', () {
+      for (final NamedType field in getFieldsInSerializationOrder(klass)) {
         final HostDatatype hostDatatype = getFieldHostDatatype(
             field,
             root.classes,
@@ -329,12 +330,12 @@
 
         final String instanceVariable = _makeInstanceVariableName(field);
 
-        final String encodableKey = 'flutter::EncodableValue("${field.name}")';
         String encodableValue = '';
         if (!hostDatatype.isBuiltin &&
             rootClassNameSet.contains(field.type.baseName)) {
           final String operator = field.type.isNullable ? '->' : '.';
-          encodableValue = '$instanceVariable${operator}ToEncodableMap()';
+          encodableValue =
+              'flutter::EncodableValue($instanceVariable${operator}ToEncodableList())';
         } else if (!hostDatatype.isBuiltin &&
             rootEnumNameSet.contains(field.type.baseName)) {
           final String nonNullValue =
@@ -351,7 +352,7 @@
               '$instanceVariable ? $encodableValue : flutter::EncodableValue()';
         }
 
-        indent.writeln('{$encodableKey, $encodableValue},');
+        indent.writeln('$encodableValue,');
       }
     });
   });
@@ -362,16 +363,17 @@
   indent.addln('');
 
   // Deserialization.
-  indent.write('${klass.name}::${klass.name}(flutter::EncodableMap map) ');
+  indent.write(
+      '${klass.name}::${klass.name}(const flutter::EncodableList& list) ');
   indent.scoped('{', '}', () {
-    for (final NamedType field in klass.fields) {
+    enumerate(getFieldsInSerializationOrder(klass),
+        (int index, final NamedType field) {
       final String instanceVariableName = _makeInstanceVariableName(field);
       final String pointerFieldName =
           '${_pointerPrefix}_${_makeVariableName(field)}';
       final String encodableFieldName =
           '${_encodablePrefix}_${_makeVariableName(field)}';
-      indent.writeln(
-          'auto& $encodableFieldName = map.at(flutter::EncodableValue("${field.name}"));');
+      indent.writeln('auto& $encodableFieldName = list[$index];');
       if (rootEnumNameSet.contains(field.type.baseName)) {
         indent.writeln(
             'if (const int32_t* $pointerFieldName = std::get_if<int32_t>(&$encodableFieldName))\t$instanceVariableName = (${field.type.baseName})*$pointerFieldName;');
@@ -392,7 +394,7 @@
                 .map((Class x) => x.name)
                 .contains(field.type.baseName)) {
           indent.write(
-              'if (const flutter::EncodableMap* $pointerFieldName = std::get_if<flutter::EncodableMap>(&$encodableFieldName)) ');
+              'if (const flutter::EncodableList* $pointerFieldName = std::get_if<flutter::EncodableList>(&$encodableFieldName)) ');
           indent.scoped('{', '}', () {
             indent.writeln(
                 '$instanceVariableName = ${hostDatatype.datatype}(*$pointerFieldName);');
@@ -405,7 +407,7 @@
           });
         }
       }
-    }
+    });
   });
   indent.addln('');
 }
@@ -471,9 +473,9 @@
       indent.writeln(
           'static void SetUp(flutter::BinaryMessenger* binary_messenger, ${api.name}* api);');
       indent.writeln(
-          'static flutter::EncodableMap WrapError(std::string_view error_message);');
+          'static flutter::EncodableList WrapError(std::string_view error_message);');
       indent.writeln(
-          'static flutter::EncodableMap WrapError(const FlutterError& error);');
+          'static flutter::EncodableList WrapError(const FlutterError& error);');
     });
     indent.scoped(' protected:', '', () {
       indent.writeln('${api.name}() = default;');
@@ -514,7 +516,7 @@
           indent.write(
               'channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply<flutter::EncodableValue>& reply) ');
           indent.scoped('{', '});', () {
-            indent.writeln('flutter::EncodableMap wrapped;');
+            indent.writeln('flutter::EncodableList wrapped;');
             indent.write('try ');
             indent.scoped('{', '}', () {
               final List<String> methodArgument = <String>[];
@@ -588,8 +590,7 @@
                     indent.write('if ($encodableArgName.IsNull()) ');
                     indent.scoped('{', '}', () {
                       indent.writeln(
-                          'wrapped.emplace(flutter::EncodableValue("${Keys.error}"), WrapError("$argName unexpectedly null."));');
-                      indent.writeln('reply(wrapped);');
+                          'reply(WrapError("$argName unexpectedly null."));');
                       indent.writeln('return;');
                     });
                   }
@@ -605,14 +606,10 @@
                 final String errorGetter;
                 final String prefix = (reply != '') ? '\t' : '';
 
-                const String resultKey =
-                    'flutter::EncodableValue("${Keys.result}")';
-                const String errorKey =
-                    'flutter::EncodableValue("${Keys.error}")';
                 const String nullValue = 'flutter::EncodableValue()';
                 if (returnType.isVoid) {
                   elseBody =
-                      '$prefix\twrapped.emplace($resultKey, $nullValue);${indent.newline}';
+                      '$prefix\twrapped.push_back($nullValue);${indent.newline}';
                   ifCondition = 'output.has_value()';
                   errorGetter = 'value';
                 } else {
@@ -631,24 +628,23 @@
                     elseBody = '''
 $prefix\tauto output_optional = $extractedValue;
 $prefix\tif (output_optional) {
-$prefix\t\twrapped.emplace($resultKey, $wrapperType(std::move(output_optional).value()));
+$prefix\t\twrapped.push_back($wrapperType(std::move(output_optional).value()));
 $prefix\t} else {
-$prefix\t\twrapped.emplace($resultKey, $nullValue);
+$prefix\t\twrapped.push_back($nullValue);
 $prefix\t}${indent.newline}''';
                   } else {
                     elseBody =
-                        '$prefix\twrapped.emplace($resultKey, $wrapperType($extractedValue));${indent.newline}';
+                        '$prefix\twrapped.push_back($wrapperType($extractedValue));${indent.newline}';
                   }
                   ifCondition = 'output.has_error()';
                   errorGetter = 'error';
                 }
                 return '${prefix}if ($ifCondition) {${indent.newline}'
-                    '$prefix\twrapped.emplace($errorKey, WrapError(output.$errorGetter()));${indent.newline}'
-                    '$prefix$reply'
+                    '$prefix\twrapped = WrapError(output.$errorGetter());${indent.newline}'
                     '$prefix} else {${indent.newline}'
                     '$elseBody'
-                    '$prefix$reply'
-                    '$prefix}';
+                    '$prefix}'
+                    '$prefix$reply';
               }
 
               final HostDatatype returnType = getHostDatatype(
@@ -675,8 +671,7 @@
             });
             indent.write('catch (const std::exception& exception) ');
             indent.scoped('{', '}', () {
-              indent.writeln(
-                  'wrapped.emplace(flutter::EncodableValue("${Keys.error}"), WrapError(exception.what()));');
+              indent.writeln('wrapped = WrapError(exception.what());');
               if (method.isAsynchronous) {
                 indent.writeln('reply(wrapped);');
               }
@@ -821,7 +816,7 @@
 \t$output = *${pointerVariable}_64;''');
           } else if (!isBuiltin) {
             indent.write(
-                'if (const flutter::EncodableMap* $pointerVariable = std::get_if<flutter::EncodableMap>(&args)) ');
+                'if (const flutter::EncodableList* $pointerVariable = std::get_if<flutter::EncodableList>(&args)) ');
             indent.scoped('{', '}', () {
               indent.writeln('$output = $returnTypeName(*$pointerVariable);');
             });
@@ -1064,12 +1059,10 @@
         indent, anEnum.documentationComments, _docCommentSpec);
     indent.write('enum class ${anEnum.name} ');
     indent.scoped('{', '};', () {
-      int index = 0;
-      for (final String member in anEnum.members) {
+      enumerate(anEnum.members, (int index, final String member) {
         indent.writeln(
             '$member = $index${index == anEnum.members.length - 1 ? '' : ','}');
-        index++;
-      }
+      });
     });
   }
 
@@ -1150,18 +1143,18 @@
 
       indent.addln('');
       indent.format('''
-flutter::EncodableMap ${api.name}::WrapError(std::string_view error_message) {
-\treturn flutter::EncodableMap({
-\t\t{flutter::EncodableValue("${Keys.errorMessage}"), flutter::EncodableValue(std::string(error_message))},
-\t\t{flutter::EncodableValue("${Keys.errorCode}"), flutter::EncodableValue("Error")},
-\t\t{flutter::EncodableValue("${Keys.errorDetails}"), flutter::EncodableValue()}
+flutter::EncodableList ${api.name}::WrapError(std::string_view error_message) {
+\treturn flutter::EncodableList({
+\t\tflutter::EncodableValue(std::string(error_message)),
+\t\tflutter::EncodableValue("Error"),
+\t\tflutter::EncodableValue()
 \t});
 }
-flutter::EncodableMap ${api.name}::WrapError(const FlutterError& error) {
-\treturn flutter::EncodableMap({
-\t\t{flutter::EncodableValue("${Keys.errorMessage}"), flutter::EncodableValue(error.message())},
-\t\t{flutter::EncodableValue("${Keys.errorCode}"), flutter::EncodableValue(error.code())},
-\t\t{flutter::EncodableValue("${Keys.errorDetails}"), error.details()}
+flutter::EncodableList ${api.name}::WrapError(const FlutterError& error) {
+\treturn flutter::EncodableList({
+\t\tflutter::EncodableValue(error.message()),
+\t\tflutter::EncodableValue(error.code()),
+\t\terror.details()
 \t});
 }''');
       indent.addln('');
diff --git a/packages/pigeon/lib/dart_generator.dart b/packages/pigeon/lib/dart_generator.dart
index f87297a..3edbe68 100644
--- a/packages/pigeon/lib/dart_generator.dart
+++ b/packages/pigeon/lib/dart_generator.dart
@@ -73,22 +73,27 @@
   assert(getCodecClasses(api, root).isNotEmpty);
   final Iterable<EnumeratedClass> codecClasses = getCodecClasses(api, root);
   indent.write('class $codecName extends $_standardMessageCodec');
-  indent.scoped('{', '}', () {
+  indent.scoped(' {', '}', () {
     indent.writeln('const $codecName();');
     indent.writeln('@override');
     indent.write('void writeValue(WriteBuffer buffer, Object? value) ');
     indent.scoped('{', '}', () {
-      for (final EnumeratedClass customClass in codecClasses) {
-        indent.write('if (value is ${customClass.name}) ');
+      enumerate(codecClasses, (int index, final EnumeratedClass customClass) {
+        final String ifValue = 'if (value is ${customClass.name}) ';
+        if (index == 0) {
+          indent.write('');
+        }
+        indent.add(ifValue);
         indent.scoped('{', '} else ', () {
           indent.writeln('buffer.putUint8(${customClass.enumeration});');
           indent.writeln('writeValue(buffer, value.encode());');
-        });
-      }
+        }, addTrailingNewline: false);
+      });
       indent.scoped('{', '}', () {
         indent.writeln('super.writeValue(buffer, value);');
       });
     });
+    indent.writeln('');
     indent.writeln('@override');
     indent.write('Object? readValueOfType(int type, ReadBuffer buffer) ');
     indent.scoped('{', '}', () {
@@ -101,8 +106,8 @@
                 'return ${customClass.name}.decode(readValue(buffer)!);');
           });
         }
-        indent.write('default:');
-        indent.writeScoped('', '', () {
+        indent.writeln('default:');
+        indent.scoped('', '', () {
           indent.writeln('return super.readValueOfType(type, buffer);');
         });
       });
@@ -157,6 +162,14 @@
 ///   static const MessageCodec<Object?> codec = FooCodec();
 ///   Future<int> add(int x, int y) async {...}
 /// }
+///
+/// Messages will be sent and received in a list.
+///
+/// If the message recieved was succesful,
+/// the result will be contained at the 0'th index.
+///
+/// If the message was a failure, the list will contain 3 items:
+/// a code, a message, and details in that order.
 void _writeHostApi(DartOptions opt, Indent indent, Api api, Root root) {
   assert(api.location == ApiLocation.host);
   String codecName = _standardMessageCodec;
@@ -173,7 +186,8 @@
 /// Constructor for [${api.name}].  The [binaryMessenger] named argument is
 /// available for dependency injection.  If it is left null, the default
 /// BinaryMessenger will be used which routes to the host platform.
-${api.name}({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger;
+${api.name}({BinaryMessenger? binaryMessenger})
+\t\t: _binaryMessenger = binaryMessenger;
 final BinaryMessenger? _binaryMessenger;
 ''');
 
@@ -212,38 +226,37 @@
         indent.writeln(
             'final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(');
         indent.nest(2, () {
-          indent.writeln(
-            "'$channelName', codec, binaryMessenger: _binaryMessenger);",
-          );
+          indent.writeln("'$channelName', codec,");
+          indent.writeln('binaryMessenger: _binaryMessenger);');
         });
         final String returnType = _makeGenericTypeArguments(func.returnType);
         final String castCall = _makeGenericCastCall(func.returnType);
-        const String accessor = "replyMap['${Keys.result}']";
+        const String accessor = 'replyList[0]';
         final String nullHandler =
             func.returnType.isNullable ? (castCall.isEmpty ? '' : '?') : '!';
         final String returnStatement = func.returnType.isVoid
             ? 'return;'
             : 'return ($accessor as $returnType?)$nullHandler$castCall;';
         indent.format('''
-final Map<Object?, Object?>? replyMap =\n\t\tawait channel.send($sendArgument) as Map<Object?, Object?>?;
-if (replyMap == null) {
+final List<Object?>? replyList =
+\t\tawait channel.send($sendArgument) as List<Object?>?;
+if (replyList == null) {
 \tthrow PlatformException(
 \t\tcode: 'channel-error',
 \t\tmessage: 'Unable to establish connection on channel.',
 \t);
-} else if (replyMap['error'] != null) {
-\tfinal Map<Object?, Object?> error = (replyMap['${Keys.error}'] as Map<Object?, Object?>?)!;
+} else if (replyList.length > 1) {
 \tthrow PlatformException(
-\t\tcode: (error['${Keys.errorCode}'] as String?)!,
-\t\tmessage: error['${Keys.errorMessage}'] as String?,
-\t\tdetails: error['${Keys.errorDetails}'],
+\t\tcode: replyList[0]! as String,
+\t\tmessage: replyList[1] as String?,
+\t\tdetails: replyList[2],
 \t);''');
         // On iOS we can return nil from functions to accommodate error
         // handling.  Returning a nil value and not returning an error is an
         // exception.
         if (!func.returnType.isNullable && !func.returnType.isVoid) {
           indent.format('''
-} else if (replyMap['${Keys.result}'] == null) {
+} else if (replyList[0] == null) {
 \tthrow PlatformException(
 \t\tcode: 'null-error',
 \t\tmessage: 'Host platform returned null value for non-null return value.',
@@ -283,6 +296,7 @@
     codecName = _getCodecName(api);
     _writeCodec(indent, codecName, api, root);
   }
+  indent.addln('');
   addDocumentationComments(indent, api.documentationComments, _docCommentSpec);
 
   indent.write('abstract class ${api.name} ');
@@ -302,6 +316,7 @@
         _getArgumentName,
       );
       indent.writeln('$returnType ${func.name}($argSignature);');
+      indent.writeln('');
     }
     indent.write(
         'static void setup(${api.name}? api, {BinaryMessenger? binaryMessenger}) ');
@@ -316,8 +331,9 @@
               ? makeChannelName(api, func)
               : channelNameFunc(func);
           indent.nest(2, () {
+            indent.writeln("'$channelName', codec,");
             indent.writeln(
-              "'$channelName', codec, binaryMessenger: binaryMessenger);",
+              'binaryMessenger: binaryMessenger);',
             );
           });
           final String messageHandlerSetter =
@@ -336,7 +352,7 @@
                   _addGenericTypesNullable(func.returnType);
               final bool isAsync = func.isAsynchronous;
               final String emptyReturnStatement = isMockHandler
-                  ? 'return <Object?, Object?>{};'
+                  ? 'return <Object?>[];'
                   : func.returnType.isVoid
                       ? 'return;'
                       : 'return null;';
@@ -345,9 +361,8 @@
                 indent.writeln('// ignore message');
                 call = 'api.${func.name}()';
               } else {
-                indent.writeln(
-                  "assert(message != null, 'Argument for $channelName was null.');",
-                );
+                indent.writeln('assert(message != null,');
+                indent.writeln("'Argument for $channelName was null.');");
                 const String argsArray = 'args';
                 indent.writeln(
                     'final List<Object?> $argsArray = (message as List<Object?>?)!;');
@@ -395,7 +410,7 @@
                 }
                 const String returnExpression = 'output';
                 final String returnStatement = isMockHandler
-                    ? "return <Object?, Object?>{'${Keys.result}': $returnExpression};"
+                    ? 'return <Object?>[$returnExpression];'
                     : 'return $returnExpression;';
                 indent.writeln(returnStatement);
               }
@@ -489,7 +504,7 @@
     void writeConstructor() {
       indent.write(klass.name);
       indent.scoped('({', '});', () {
-        for (final NamedType field in klass.fields) {
+        for (final NamedType field in getFieldsInSerializationOrder(klass)) {
           final String required = field.type.isNullable ? '' : 'required ';
           indent.writeln('${required}this.${field.name},');
         }
@@ -499,37 +514,38 @@
     void writeEncode() {
       indent.write('Object encode() ');
       indent.scoped('{', '}', () {
-        indent.writeln(
-          'final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};',
+        indent.write(
+          'return <Object?>',
         );
-        for (final NamedType field in klass.fields) {
-          indent.write("pigeonMap['${field.name}'] = ");
-          final String conditional = field.type.isNullable ? '?' : '';
-          if (customClassNames.contains(field.type.baseName)) {
-            indent.addln(
-              '${field.name}$conditional.encode();',
-            );
-          } else if (customEnumNames.contains(field.type.baseName)) {
-            indent.addln(
-              '${field.name}$conditional.index;',
-            );
-          } else {
-            indent.addln('${field.name};');
+        indent.scoped('[', '];', () {
+          for (final NamedType field in getFieldsInSerializationOrder(klass)) {
+            final String conditional = field.type.isNullable ? '?' : '';
+            if (customClassNames.contains(field.type.baseName)) {
+              indent.writeln(
+                '${field.name}$conditional.encode(),',
+              );
+            } else if (customEnumNames.contains(field.type.baseName)) {
+              indent.writeln(
+                '${field.name}$conditional.index,',
+              );
+            } else {
+              indent.writeln('${field.name},');
+            }
           }
-        }
-        indent.writeln('return pigeonMap;');
+        });
       });
     }
 
     void writeDecode() {
-      void writeValueDecode(NamedType field) {
+      void writeValueDecode(NamedType field, int index) {
+        final String resultAt = 'result[$index]';
         if (customClassNames.contains(field.type.baseName)) {
           final String nonNullValue =
-              "${field.type.baseName}.decode(pigeonMap['${field.name}']!)";
+              '${field.type.baseName}.decode($resultAt! as List<Object?>)';
           indent.format(
               field.type.isNullable
                   ? '''
-pigeonMap['${field.name}'] != null
+$resultAt != null
 \t\t? $nonNullValue
 \t\t: null'''
                   : nonNullValue,
@@ -537,11 +553,11 @@
               trailingNewline: false);
         } else if (customEnumNames.contains(field.type.baseName)) {
           final String nonNullValue =
-              "${field.type.baseName}.values[pigeonMap['${field.name}']! as int]";
+              '${field.type.baseName}.values[$resultAt! as int]';
           indent.format(
               field.type.isNullable
                   ? '''
-pigeonMap['${field.name}'] != null
+$resultAt != null
 \t\t? $nonNullValue
 \t\t: null'''
                   : nonNullValue,
@@ -552,37 +568,35 @@
           final String castCall = _makeGenericCastCall(field.type);
           final String castCallPrefix = field.type.isNullable ? '?' : '!';
           indent.add(
-            "(pigeonMap['${field.name}'] as $genericType?)$castCallPrefix$castCall",
+            '($resultAt as $genericType?)$castCallPrefix$castCall',
           );
         } else {
           final String genericdType = _addGenericTypesNullable(field.type);
           if (field.type.isNullable) {
             indent.add(
-              "pigeonMap['${field.name}'] as $genericdType",
+              '$resultAt as $genericdType',
             );
           } else {
             indent.add(
-              "pigeonMap['${field.name}']! as $genericdType",
+              '$resultAt! as $genericdType',
             );
           }
         }
       }
 
       indent.write(
-        'static ${klass.name} decode(Object message) ',
+        'static ${klass.name} decode(Object result) ',
       );
       indent.scoped('{', '}', () {
-        indent.writeln(
-          'final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;',
-        );
+        indent.writeln('result as List<Object?>;');
         indent.write('return ${klass.name}');
         indent.scoped('(', ');', () {
-          for (int index = 0; index < klass.fields.length; index += 1) {
-            final NamedType field = klass.fields[index];
+          enumerate(getFieldsInSerializationOrder(klass),
+              (int index, final NamedType field) {
             indent.write('${field.name}: ');
-            writeValueDecode(field);
+            writeValueDecode(field, index);
             indent.addln(',');
-          }
+          });
         });
       });
     }
@@ -594,14 +608,12 @@
     indent.scoped('{', '}', () {
       writeConstructor();
       indent.addln('');
-      for (final NamedType field in klass.fields) {
+      for (final NamedType field in getFieldsInSerializationOrder(klass)) {
         addDocumentationComments(
             indent, field.documentationComments, _docCommentSpec);
 
         final String datatype = _addGenericTypesNullable(field.type);
         indent.writeln('$datatype ${field.name};');
-      }
-      if (klass.fields.isNotEmpty) {
         indent.writeln('');
       }
       writeEncode();
diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart
index 526afd7..9ef102a 100644
--- a/packages/pigeon/lib/generator_tools.dart
+++ b/packages/pigeon/lib/generator_tools.dart
@@ -9,7 +9,7 @@
 import 'ast.dart';
 
 /// The current version of pigeon. This must match the version in pubspec.yaml.
-const String pigeonVersion = '4.2.11';
+const String pigeonVersion = '4.2.12';
 
 /// Read all the content from [stdin] to a String.
 String readStdin() {
@@ -491,3 +491,9 @@
     );
   }
 }
+
+/// Returns an ordered list of fields to provide consistent serialisation order.
+Iterable<NamedType> getFieldsInSerializationOrder(Class klass) {
+  // This returns the fields in the order they are declared in the pigeon file.
+  return klass.fields;
+}
diff --git a/packages/pigeon/lib/java_generator.dart b/packages/pigeon/lib/java_generator.dart
index 880f761..4292e9c 100644
--- a/packages/pigeon/lib/java_generator.dart
+++ b/packages/pigeon/lib/java_generator.dart
@@ -115,7 +115,7 @@
           indent.write('case (byte)${customClass.enumeration}: ');
           indent.writeScoped('', '', () {
             indent.writeln(
-                'return ${customClass.name}.fromMap((Map<String, Object>) readValue(buffer));');
+                'return ${customClass.name}.fromList((ArrayList<Object>) readValue(buffer));');
           });
         }
         indent.write('default:');
@@ -133,7 +133,7 @@
         indent.scoped('{', '} else ', () {
           indent.writeln('stream.write(${customClass.enumeration});');
           indent.writeln(
-              'writeValue(stream, ((${customClass.name}) value).toMap());');
+              'writeValue(stream, ((${customClass.name}) value).toList());');
         });
       }
       indent.scoped('{', '}', () {
@@ -217,7 +217,7 @@
           final String returnType = method.returnType.isVoid
               ? 'Void'
               : _javaTypeForDartType(method.returnType);
-          indent.writeln('Map<String, Object> wrapped = new HashMap<>();');
+          indent.writeln('ArrayList wrapped = new ArrayList<>();');
           indent.write('try ');
           indent.scoped('{', '}', () {
             final List<String> methodArgument = <String>[];
@@ -260,12 +260,12 @@
               indent.format('''
 Result<$returnType> $resultName = new Result<$returnType>() {
 \tpublic void success($returnType result) {
-\t\twrapped.put("${Keys.result}", $resultValue);
+\t\twrapped.add(0, $resultValue);
 \t\treply.reply(wrapped);
 \t}
 \tpublic void error(Throwable error) {
-\t\twrapped.put("${Keys.error}", wrapError(error));
-\t\treply.reply(wrapped);
+\t\tArrayList<Object> wrappedError = wrapError(error);
+\t\treply.reply(wrappedError);
 \t}
 };
 ''');
@@ -277,18 +277,20 @@
               indent.writeln('$call;');
             } else if (method.returnType.isVoid) {
               indent.writeln('$call;');
-              indent.writeln('wrapped.put("${Keys.result}", null);');
+              indent.writeln('wrapped.add(0, null);');
             } else {
               indent.writeln('$returnType output = $call;');
-              indent.writeln('wrapped.put("${Keys.result}", output);');
+              indent.writeln('wrapped.add(0, output);');
             }
           });
           indent.write('catch (Error | RuntimeException exception) ');
           indent.scoped('{', '}', () {
-            indent
-                .writeln('wrapped.put("${Keys.error}", wrapError(exception));');
+            indent.writeln(
+                'ArrayList<Object> wrappedError = wrapError(exception);');
             if (method.isAsynchronous) {
-              indent.writeln('reply.reply(wrapped);');
+              indent.writeln('reply.reply(wrappedError);');
+            } else {
+              indent.writeln('wrapped = wrappedError;');
             }
           });
           if (!method.isAsynchronous) {
@@ -513,7 +515,7 @@
     return '($varName == null) ? null : (($varName instanceof Integer) ? (Integer)$varName : (${hostDatatype.datatype})$varName)';
   } else if (!hostDatatype.isBuiltin &&
       classes.map((Class x) => x.name).contains(field.type.baseName)) {
-    return '($varName == null) ? null : ${hostDatatype.datatype}.fromMap((Map)$varName)';
+    return '($varName == null) ? null : ${hostDatatype.datatype}.fromList((ArrayList<Object>)$varName)';
   } else {
     return '(${hostDatatype.datatype})$varName';
   }
@@ -567,17 +569,11 @@
 
     indent.write('public enum ${anEnum.name} ');
     indent.scoped('{', '}', () {
-      int index = 0;
-      for (final String member in anEnum.members) {
+      enumerate(anEnum.members, (int index, final String member) {
         indent.writeln(
             '${camelToSnake(member)}($index)${index == anEnum.members.length - 1 ? ';' : ','}');
-        index++;
-      }
+      });
       indent.writeln('');
-      // We use explicit indexing here as use of the ordinal() method is
-      // discouraged. The toMap and fromMap API matches class API to allow
-      // the same code to work with enums and classes, but this
-      // can also be done directly in the host and flutter APIs.
       indent.writeln('private final int index;');
       indent.write('private ${anEnum.name}(final int index) ');
       indent.scoped('{', '}', () {
@@ -615,11 +611,12 @@
       });
     }
 
-    void writeToMap() {
-      indent.write('@NonNull Map<String, Object> toMap() ');
+    void writeToList() {
+      indent.write('@NonNull ArrayList<Object> toList() ');
       indent.scoped('{', '}', () {
-        indent.writeln('Map<String, Object> toMapResult = new HashMap<>();');
-        for (final NamedType field in klass.fields) {
+        indent.writeln(
+            'ArrayList<Object> toListResult = new ArrayList<Object>(${klass.fields.length});');
+        for (final NamedType field in getFieldsInSerializationOrder(klass)) {
           final HostDatatype hostDatatype = getFieldHostDatatype(
               field,
               root.classes,
@@ -629,29 +626,30 @@
           final String fieldName = field.name;
           if (!hostDatatype.isBuiltin &&
               rootClassNameSet.contains(field.type.baseName)) {
-            toWriteValue = '($fieldName == null) ? null : $fieldName.toMap()';
+            toWriteValue = '($fieldName == null) ? null : $fieldName.toList()';
           } else if (!hostDatatype.isBuiltin &&
               rootEnumNameSet.contains(field.type.baseName)) {
             toWriteValue = '$fieldName == null ? null : $fieldName.index';
           } else {
             toWriteValue = field.name;
           }
-          indent.writeln('toMapResult.put("${field.name}", $toWriteValue);');
+          indent.writeln('toListResult.add($toWriteValue);');
         }
-        indent.writeln('return toMapResult;');
+        indent.writeln('return toListResult;');
       });
     }
 
-    void writeFromMap() {
+    void writeFromList() {
       indent.write(
-          'static @NonNull ${klass.name} fromMap(@NonNull Map<String, Object> map) ');
+          'static @NonNull ${klass.name} fromList(@NonNull ArrayList<Object> list) ');
       indent.scoped('{', '}', () {
         const String result = 'pigeonResult';
         indent.writeln('${klass.name} $result = new ${klass.name}();');
-        for (final NamedType field in klass.fields) {
+        enumerate(getFieldsInSerializationOrder(klass),
+            (int index, final NamedType field) {
           final String fieldVariable = field.name;
           final String setter = _makeSetter(field);
-          indent.writeln('Object $fieldVariable = map.get("${field.name}");');
+          indent.writeln('Object $fieldVariable = list.get($index);');
           if (rootEnumNameSet.contains(field.type.baseName)) {
             indent.writeln(
                 '$result.$setter(${_intToEnum(fieldVariable, field.type.baseName)});');
@@ -659,7 +657,7 @@
             indent.writeln(
                 '$result.$setter(${_castObject(field, root.classes, root.enums, fieldVariable)});');
           }
-        }
+        });
         indent.writeln('return $result;');
       });
     }
@@ -667,7 +665,7 @@
     void writeBuilder() {
       indent.write('public static final class Builder ');
       indent.scoped('{', '}', () {
-        for (final NamedType field in klass.fields) {
+        for (final NamedType field in getFieldsInSerializationOrder(klass)) {
           final HostDatatype hostDatatype = getFieldHostDatatype(
               field,
               root.classes,
@@ -688,7 +686,7 @@
         indent.scoped('{', '}', () {
           const String returnVal = 'pigeonReturn';
           indent.writeln('${klass.name} $returnVal = new ${klass.name}();');
-          for (final NamedType field in klass.fields) {
+          for (final NamedType field in getFieldsInSerializationOrder(klass)) {
             indent.writeln('$returnVal.${_makeSetter(field)}(${field.name});');
           }
           indent.writeln('return $returnVal;');
@@ -705,12 +703,12 @@
 
     indent.write('public static class ${klass.name} ');
     indent.scoped('{', '}', () {
-      for (final NamedType field in klass.fields) {
+      for (final NamedType field in getFieldsInSerializationOrder(klass)) {
         writeField(field);
         indent.addln('');
       }
 
-      if (klass.fields
+      if (getFieldsInSerializationOrder(klass)
           .map((NamedType e) => !e.type.isNullable)
           .any((bool e) => e)) {
         indent.writeln(
@@ -719,8 +717,8 @@
       }
 
       writeBuilder();
-      writeToMap();
-      writeFromMap();
+      writeToList();
+      writeFromList();
     });
   }
 
@@ -742,12 +740,12 @@
 
   void writeWrapError() {
     indent.format('''
-@NonNull private static Map<String, Object> wrapError(@NonNull Throwable exception) {
-\tMap<String, Object> errorMap = new HashMap<>();
-\terrorMap.put("${Keys.errorMessage}", exception.toString());
-\terrorMap.put("${Keys.errorCode}", exception.getClass().getSimpleName());
-\terrorMap.put("${Keys.errorDetails}", "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
-\treturn errorMap;
+@NonNull private static ArrayList<Object> wrapError(@NonNull Throwable exception) {
+\tArrayList<Object> errorList = new ArrayList<>(3);
+\terrorList.add(exception.toString());
+\terrorList.add(exception.getClass().getSimpleName());
+\terrorList.add("Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
+\treturn errorList;
 }''');
   }
 
@@ -760,7 +758,7 @@
   writeImports();
   indent.addln('');
   indent.writeln(
-      '${_docCommentPrefix}Generated class from Pigeon.$_docCommentSuffix');
+      '$_docCommentPrefix Generated class from Pigeon.$_docCommentSuffix');
   indent.writeln(
       '@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})');
   if (options.useGeneratedAnnotation ?? false) {
diff --git a/packages/pigeon/lib/kotlin_generator.dart b/packages/pigeon/lib/kotlin_generator.dart
index d4ed272..c32cb04 100644
--- a/packages/pigeon/lib/kotlin_generator.dart
+++ b/packages/pigeon/lib/kotlin_generator.dart
@@ -85,10 +85,9 @@
         for (final EnumeratedClass customClass in codecClasses) {
           indent.write('${customClass.enumeration}.toByte() -> ');
           indent.scoped('{', '}', () {
-            indent.write(
-                'return (readValue(buffer) as? Map<String, Any?>)?.let ');
+            indent.write('return (readValue(buffer) as? List<Any?>)?.let ');
             indent.scoped('{', '}', () {
-              indent.writeln('${customClass.name}.fromMap(it)');
+              indent.writeln('${customClass.name}.fromList(it)');
             });
           });
         }
@@ -105,7 +104,7 @@
           indent.write('is ${customClass.name} -> ');
           indent.scoped('{', '}', () {
             indent.writeln('stream.write(${customClass.enumeration})');
-            indent.writeln('writeValue(stream, value.toMap())');
+            indent.writeln('writeValue(stream, value.toList())');
           });
         }
         indent.writeln('else -> super.writeValue(stream, value)');
@@ -214,8 +213,7 @@
 
               indent.write('channel.setMessageHandler ');
               indent.scoped('{ $messageVarName, reply ->', '}', () {
-                indent.writeln('val wrapped = hashMapOf<String, Any?>()');
-
+                indent.writeln('var wrapped = listOf<Any?>()');
                 indent.write('try ');
                 indent.scoped('{', '}', () {
                   final List<String> methodArgument = <String>[];
@@ -240,15 +238,14 @@
                     });
                   } else if (method.returnType.isVoid) {
                     indent.writeln(call);
-                    indent.writeln('wrapped["${Keys.result}"] = null');
+                    indent.writeln('wrapped = listOf<Any?>(null)');
                   } else {
-                    indent.writeln('wrapped["${Keys.result}"] = $call');
+                    indent.writeln('wrapped = listOf<Any?>($call)');
                   }
                 }, addTrailingNewline: false);
                 indent.add(' catch (exception: Error) ');
                 indent.scoped('{', '}', () {
-                  indent.writeln(
-                      'wrapped["${Keys.error}"] = wrapError(exception)');
+                  indent.writeln('wrapped = wrapError(exception)');
                   if (method.isAsynchronous) {
                     indent.writeln('reply.reply(wrapped)');
                   }
@@ -474,20 +471,14 @@
         indent, anEnum.documentationComments, _docCommentSpec);
     indent.write('enum class ${anEnum.name}(val raw: Int) ');
     indent.scoped('{', '}', () {
-      // We use explicit indexing here as use of the ordinal() method is
-      // discouraged. The toMap and fromMap API matches class API to allow
-      // the same code to work with enums and classes, but this
-      // can also be done directly in the host and flutter APIs.
-      int index = 0;
-      for (final String member in anEnum.members) {
+      enumerate(anEnum.members, (int index, final String member) {
         indent.write('${member.toUpperCase()}($index)');
         if (index != anEnum.members.length - 1) {
           indent.addln(',');
         } else {
           indent.addln(';');
         }
-        index++;
-      }
+      });
 
       indent.writeln('');
       indent.write('companion object ');
@@ -510,48 +501,41 @@
       indent.add(defaultNil);
     }
 
-    void writeToMap() {
-      indent.write('fun toMap(): Map<String, Any?> ');
+    void writeToList() {
+      indent.write('fun toList(): List<Any?> ');
       indent.scoped('{', '}', () {
-        indent.writeln('val map = mutableMapOf<String, Any?>()');
-
-        for (final NamedType field in klass.fields) {
-          final HostDatatype hostDatatype = getHostDatatype(field);
-          String toWriteValue = '';
-          final String fieldName = field.name;
-          final String prefix = field.type.isNullable ? 'it' : fieldName;
-          if (!hostDatatype.isBuiltin &&
-              rootClassNameSet.contains(field.type.baseName)) {
-            toWriteValue = '$prefix.toMap()';
-          } else if (!hostDatatype.isBuiltin &&
-              rootEnumNameSet.contains(field.type.baseName)) {
-            toWriteValue = '$prefix.raw';
-          } else {
-            toWriteValue = prefix;
+        indent.write('return listOf<Any?>');
+        indent.scoped('(', ')', () {
+          for (final NamedType field in getFieldsInSerializationOrder(klass)) {
+            final HostDatatype hostDatatype = getHostDatatype(field);
+            String toWriteValue = '';
+            final String fieldName = field.name;
+            if (!hostDatatype.isBuiltin &&
+                rootClassNameSet.contains(field.type.baseName)) {
+              toWriteValue = '$fieldName?.toList()';
+            } else if (!hostDatatype.isBuiltin &&
+                rootEnumNameSet.contains(field.type.baseName)) {
+              toWriteValue = '$fieldName?.raw';
+            } else {
+              toWriteValue = fieldName;
+            }
+            indent.writeln('$toWriteValue,');
           }
-
-          if (field.type.isNullable) {
-            indent.writeln(
-                '$fieldName?.let { map["${field.name}"] = $toWriteValue }');
-          } else {
-            indent.writeln('map["${field.name}"] = $toWriteValue');
-          }
-        }
-
-        indent.writeln('return map');
+        });
       });
     }
 
-    void writeFromMap() {
+    void writeFromList() {
       final String className = klass.name;
 
       indent.write('companion object ');
       indent.scoped('{', '}', () {
         indent.writeln('@Suppress("UNCHECKED_CAST")');
-        indent.write('fun fromMap(map: Map<String, Any?>): $className ');
+        indent.write('fun fromList(list: List<Any?>): $className ');
 
         indent.scoped('{', '}', () {
-          for (final NamedType field in klass.fields) {
+          enumerate(getFieldsInSerializationOrder(klass),
+              (int index, final NamedType field) {
             final HostDatatype hostDatatype = getHostDatatype(field);
 
             // The StandardMessageCodec can give us [Integer, Long] for
@@ -559,50 +543,51 @@
             // longs in Pigeon with Kotlin.
             final bool isInt = field.type.baseName == 'int';
 
-            final String mapValue = 'map["${field.name}"]';
+            final String listValue = 'list[$index]';
             final String fieldType = _kotlinTypeForDartType(field.type);
 
             if (field.type.isNullable) {
               if (!hostDatatype.isBuiltin &&
                   rootClassNameSet.contains(field.type.baseName)) {
                 indent.write('val ${field.name}: $fieldType? = ');
-                indent.add('($mapValue as? Map<String, Any?>)?.let ');
+                indent.add('($listValue as? List<Any?>)?.let ');
                 indent.scoped('{', '}', () {
-                  indent.writeln('$fieldType.fromMap(it)');
+                  indent.writeln('$fieldType.fromList(it)');
                 });
               } else if (!hostDatatype.isBuiltin &&
                   rootEnumNameSet.contains(field.type.baseName)) {
                 indent.write('val ${field.name}: $fieldType? = ');
-                indent.add('($mapValue as? Int)?.let ');
+                indent.add('($listValue as? Int)?.let ');
                 indent.scoped('{', '}', () {
                   indent.writeln('$fieldType.ofRaw(it)');
                 });
               } else if (isInt) {
-                indent.write('val ${field.name} = $mapValue');
+                indent.write('val ${field.name} = $listValue');
                 indent.addln(
                     '.let { if (it is Int) it.toLong() else it as? Long }');
               } else {
-                indent.writeln('val ${field.name} = $mapValue as? $fieldType');
+                indent.writeln('val ${field.name} = $listValue as? $fieldType');
               }
             } else {
               if (!hostDatatype.isBuiltin &&
                   rootClassNameSet.contains(field.type.baseName)) {
                 indent.writeln(
-                    'val ${field.name} = $fieldType.fromMap($mapValue as Map<String, Any?>)');
+                    'val ${field.name} = $fieldType.fromList($listValue as List<Any?>)');
               } else if (!hostDatatype.isBuiltin &&
                   rootEnumNameSet.contains(field.type.baseName)) {
                 indent.write(
-                    'val ${field.name} = $fieldType.ofRaw($mapValue as Int)!!');
+                    'val ${field.name} = $fieldType.ofRaw($listValue as Int)!!');
               } else {
-                indent.writeln('val ${field.name} = $mapValue as $fieldType');
+                indent.writeln('val ${field.name} = $listValue as $fieldType');
               }
             }
-          }
+          });
 
           indent.writeln('');
           indent.write('return $className(');
-          for (final NamedType field in klass.fields) {
-            final String comma = klass.fields.last == field ? '' : ', ';
+          for (final NamedType field in getFieldsInSerializationOrder(klass)) {
+            final String comma =
+                getFieldsInSerializationOrder(klass).last == field ? '' : ', ';
             indent.add('${field.name}$comma');
           }
           indent.addln(')');
@@ -619,9 +604,9 @@
 
     indent.write('data class ${klass.name} ');
     indent.scoped('(', '', () {
-      for (final NamedType element in klass.fields) {
+      for (final NamedType element in getFieldsInSerializationOrder(klass)) {
         writeField(element);
-        if (klass.fields.last != element) {
+        if (getFieldsInSerializationOrder(klass).last != element) {
           indent.addln(',');
         } else {
           indent.addln('');
@@ -630,8 +615,8 @@
     });
 
     indent.scoped(') {', '}', () {
-      writeFromMap();
-      writeToMap();
+      writeFromList();
+      writeToList();
     });
   }
 
@@ -644,26 +629,21 @@
   }
 
   void writeWrapResult() {
-    indent.write('private fun wrapResult(result: Any?): Map<String, Any?> ');
+    indent.write('private fun wrapResult(result: Any?): List<Any?> ');
     indent.scoped('{', '}', () {
-      indent.writeln('return hashMapOf("result" to result)');
+      indent.writeln('return listOf(result)');
     });
   }
 
   void writeWrapError() {
-    indent.write(
-        'private fun wrapError(exception: Throwable): Map<String, Any> ');
+    indent.write('private fun wrapError(exception: Throwable): List<Any> ');
     indent.scoped('{', '}', () {
       indent.write('return ');
-      indent.scoped('hashMapOf<String, Any>(', ')', () {
-        indent.write('"error" to ');
-        indent.scoped('hashMapOf<String, Any>(', ')', () {
-          indent.writeln(
-              '"${Keys.errorCode}" to exception.javaClass.simpleName,');
-          indent.writeln('"${Keys.errorMessage}" to exception.toString(),');
-          indent.writeln(
-              '"${Keys.errorDetails}" to "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)');
-        });
+      indent.scoped('listOf<Any>(', ')', () {
+        indent.writeln('exception.javaClass.simpleName,');
+        indent.writeln('exception.toString(),');
+        indent.writeln(
+            '"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)');
       });
     });
   }
diff --git a/packages/pigeon/lib/objc_generator.dart b/packages/pigeon/lib/objc_generator.dart
index bc6077a..90c41c0 100644
--- a/packages/pigeon/lib/objc_generator.dart
+++ b/packages/pigeon/lib/objc_generator.dart
@@ -168,7 +168,7 @@
   indent.write('+ (instancetype)makeWith');
   bool isFirst = true;
   indent.nest(2, () {
-    for (final NamedType field in klass.fields) {
+    for (final NamedType field in getFieldsInSerializationOrder(klass)) {
       final String label = isFirst ? _capitalize(field.name) : field.name;
       final void Function(String) printer = isFirst
           ? indent.add
@@ -206,8 +206,8 @@
         indent, klass.documentationComments, _docCommentSpec);
 
     indent.writeln('@interface ${_className(prefix, klass.name)} : NSObject');
-    if (klass.fields.isNotEmpty) {
-      if (klass.fields
+    if (getFieldsInSerializationOrder(klass).isNotEmpty) {
+      if (getFieldsInSerializationOrder(klass)
           .map((NamedType e) => !e.type.isNullable)
           .any((bool e) => e)) {
         indent.writeln(
@@ -217,7 +217,7 @@
       _writeInitializerDeclaration(indent, klass, classes, enums, prefix);
       indent.addln(';');
     }
-    for (final NamedType field in klass.fields) {
+    for (final NamedType field in getFieldsInSerializationOrder(klass)) {
       final HostDatatype hostDatatype = getFieldHostDatatype(
           field,
           classes,
@@ -281,7 +281,7 @@
         indent.write('case ${customClass.enumeration}: ');
         indent.writeScoped('', '', () {
           indent.writeln(
-              'return [${_className(options.prefix, customClass.name)} fromMap:[self readValue]];');
+              'return [${_className(options.prefix, customClass.name)} fromList:[self readValue]];');
         });
       }
       indent.write('default:');
@@ -302,7 +302,7 @@
           'if ([value isKindOfClass:[${_className(options.prefix, customClass.name)} class]]) ');
       indent.scoped('{', '} else ', () {
         indent.writeln('[self writeByte:${customClass.enumeration}];');
-        indent.writeln('[self writeValue:[value toMap]];');
+        indent.writeln('[self writeValue:[value toList]];');
       });
     }
     indent.scoped('{', '}', () {
@@ -561,13 +561,11 @@
 
     indent.write('typedef NS_ENUM(NSUInteger, $enumName) ');
     indent.scoped('{', '};', () {
-      int index = 0;
-      for (final String member in anEnum.members) {
+      enumerate(anEnum.members, (int index, final String member) {
         // Capitalized first letter to ensure Swift compatibility
         indent.writeln(
             '$enumName${member[0].toUpperCase()}${member.substring(1)} = $index,');
-        index++;
-      }
+      });
     });
   }
 
@@ -608,23 +606,23 @@
   indent.writeln('NS_ASSUME_NONNULL_END');
 }
 
-String _dictGetter(
-    List<String> classNames, String dict, NamedType field, String? prefix) {
+String _listGetter(List<String> classNames, String list, NamedType field,
+    int index, String? prefix) {
   if (classNames.contains(field.type.baseName)) {
     String className = field.type.baseName;
     if (prefix != null) {
       className = '$prefix$className';
     }
-    return '[$className nullableFromMap:GetNullableObject($dict, @"${field.name}")]';
+    return '[$className nullableFromList:(GetNullableObjectAtIndex($list, $index))]';
   } else {
-    return 'GetNullableObject($dict, @"${field.name}")';
+    return 'GetNullableObjectAtIndex($list, $index)';
   }
 }
 
-String _dictValue(
+String _arrayValue(
     List<String> classNames, List<String> enumNames, NamedType field) {
   if (classNames.contains(field.type.baseName)) {
-    return '(self.${field.name} ? [self.${field.name} toMap] : [NSNull null])';
+    return '(self.${field.name} ? [self.${field.name} toList] : [NSNull null])';
   } else if (enumNames.contains(field.type.baseName)) {
     return '@(self.${field.name})';
   } else {
@@ -849,7 +847,7 @@
       indent.writeln('messageChannelWithName:@"${makeChannelName(api, func)}"');
       indent.writeln('binaryMessenger:self.binaryMessenger');
       indent.write('codec:${_getCodecGetterName(options.prefix, api.name)}()');
-      indent.write('];');
+      indent.addln('];');
       indent.dec();
       indent.dec();
       indent.write('[channel sendMessage:$sendArgument reply:^(id reply) ');
@@ -902,19 +900,11 @@
 
   void writeHelperFunctions() {
     indent.format('''
-static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error) {
-\tNSDictionary *errorDict = (NSDictionary *)[NSNull null];
+static NSArray *wrapResult(id result, FlutterError *error) {
 \tif (error) {
-\t\terrorDict = @{
-\t\t\t\t@"${Keys.errorCode}": (error.code ?: [NSNull null]),
-\t\t\t\t@"${Keys.errorMessage}": (error.message ?: [NSNull null]),
-\t\t\t\t@"${Keys.errorDetails}": (error.details ?: [NSNull null]),
-\t\t\t\t};
+\t\treturn @[ error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] ];
 \t}
-\treturn @{
-\t\t\t@"${Keys.result}": (result ?: [NSNull null]),
-\t\t\t@"${Keys.error}": errorDict,
-\t\t\t};
+\treturn @[ result ?: [NSNull null]  ];
 }''');
     indent.format('''
 static id GetNullableObject(NSDictionary* dict, id key) {
@@ -931,10 +921,10 @@
   void writeDataClassExtension(Class klass) {
     final String className = _className(options.prefix, klass.name);
     indent.writeln('@interface $className ()');
-    indent.writeln('+ ($className *)fromMap:(NSDictionary *)dict;');
-    indent.writeln(
-        '+ (nullable $className *)nullableFromMap:(NSDictionary *)dict;');
-    indent.writeln('- (NSDictionary *)toMap;');
+    indent.writeln('+ ($className *)fromList:(NSArray *)list;');
+    indent
+        .writeln('+ (nullable $className *)nullableFromList:(NSArray *)list;');
+    indent.writeln('- (NSArray *)toList;');
     indent.writeln('@end');
   }
 
@@ -946,45 +936,46 @@
       indent.writeScoped(' {', '}', () {
         const String result = 'pigeonResult';
         indent.writeln('$className* $result = [[$className alloc] init];');
-        for (final NamedType field in klass.fields) {
+        for (final NamedType field in getFieldsInSerializationOrder(klass)) {
           indent.writeln('$result.${field.name} = ${field.name};');
         }
         indent.writeln('return $result;');
       });
     }
 
-    void writeFromMap() {
-      indent.write('+ ($className *)fromMap:(NSDictionary *)dict ');
+    void writeFromList() {
+      indent.write('+ ($className *)fromList:(NSArray *)list ');
       indent.scoped('{', '}', () {
         const String resultName = 'pigeonResult';
         indent.writeln('$className *$resultName = [[$className alloc] init];');
-        for (final NamedType field in klass.fields) {
+        enumerate(getFieldsInSerializationOrder(klass),
+            (int index, final NamedType field) {
           if (enumNames.contains(field.type.baseName)) {
             indent.writeln(
-                '$resultName.${field.name} = [${_dictGetter(classNames, 'dict', field, options.prefix)} integerValue];');
+                '$resultName.${field.name} = [${_listGetter(classNames, 'list', field, index, options.prefix)} integerValue];');
           } else {
             indent.writeln(
-                '$resultName.${field.name} = ${_dictGetter(classNames, 'dict', field, options.prefix)};');
+                '$resultName.${field.name} = ${_listGetter(classNames, 'list', field, index, options.prefix)};');
             if (!field.type.isNullable) {
               indent
                   .writeln('NSAssert($resultName.${field.name} != nil, @"");');
             }
           }
-        }
+        });
         indent.writeln('return $resultName;');
       });
+
       indent.writeln(
-          '+ (nullable $className *)nullableFromMap:(NSDictionary *)dict { return (dict) ? [$className fromMap:dict] : nil; }');
+          '+ (nullable $className *)nullableFromList:(NSArray *)list { return (list) ? [$className fromList:list] : nil; }');
     }
 
-    void writeToMap() {
-      indent.write('- (NSDictionary *)toMap ');
+    void writeToList() {
+      indent.write('- (NSArray *)toList ');
       indent.scoped('{', '}', () {
         indent.write('return');
-        indent.scoped(' @{', '};', () {
+        indent.scoped(' @[', '];', () {
           for (final NamedType field in klass.fields) {
-            indent.writeln(
-                '@"${field.name}" : ${_dictValue(classNames, enumNames, field)},');
+            indent.writeln('${_arrayValue(classNames, enumNames, field)},');
           }
         });
       });
@@ -992,8 +983,8 @@
 
     indent.writeln('@implementation $className');
     writeInitializer();
-    writeFromMap();
-    writeToMap();
+    writeFromList();
+    writeToList();
     indent.writeln('@end');
   }
 
diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart
index 0b055ca..46203f6 100644
--- a/packages/pigeon/lib/pigeon_lib.dart
+++ b/packages/pigeon/lib/pigeon_lib.dart
@@ -246,29 +246,28 @@
       objcHeaderOut: map['objcHeaderOut'] as String?,
       objcSourceOut: map['objcSourceOut'] as String?,
       objcOptions: map.containsKey('objcOptions')
-          ? ObjcOptions.fromMap((map['objcOptions'] as Map<String, Object>?)!)
+          ? ObjcOptions.fromMap(map['objcOptions']! as Map<String, Object>)
           : null,
       javaOut: map['javaOut'] as String?,
       javaOptions: map.containsKey('javaOptions')
-          ? JavaOptions.fromMap((map['javaOptions'] as Map<String, Object>?)!)
+          ? JavaOptions.fromMap(map['javaOptions']! as Map<String, Object>)
           : null,
       swiftOut: map['swiftOut'] as String?,
       swiftOptions: map.containsKey('swiftOptions')
-          ? SwiftOptions.fromMap((map['swiftOptions'] as Map<String, Object>?)!)
+          ? SwiftOptions.fromList(map['swiftOptions']! as Map<String, Object>)
           : null,
       kotlinOut: map['kotlinOut'] as String?,
       kotlinOptions: map.containsKey('kotlinOptions')
-          ? KotlinOptions.fromMap(
-              (map['kotlinOptions'] as Map<String, Object>?)!)
+          ? KotlinOptions.fromMap(map['kotlinOptions']! as Map<String, Object>)
           : null,
       cppHeaderOut: map['experimental_cppHeaderOut'] as String?,
       cppSourceOut: map['experimental_cppSourceOut'] as String?,
       cppOptions: map.containsKey('experimental_cppOptions')
           ? CppOptions.fromMap(
-              (map['experimental_cppOptions'] as Map<String, Object>?)!)
+              map['experimental_cppOptions']! as Map<String, Object>)
           : null,
       dartOptions: map.containsKey('dartOptions')
-          ? DartOptions.fromMap((map['dartOptions'] as Map<String, Object>?)!)
+          ? DartOptions.fromMap(map['dartOptions']! as Map<String, Object>)
           : null,
       copyrightHeader: map['copyrightHeader'] as String?,
       oneLanguage: map['oneLanguage'] as bool?,
@@ -633,7 +632,7 @@
       root.classes.map((Class x) => x.name).toList();
   final Iterable<String> customEnums = root.enums.map((Enum x) => x.name);
   for (final Class klass in root.classes) {
-    for (final NamedType field in klass.fields) {
+    for (final NamedType field in getFieldsInSerializationOrder(klass)) {
       if (field.type.typeArguments != null) {
         for (final TypeDeclaration typeArgument in field.type.typeArguments) {
           if (!typeArgument.isNullable) {
diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart
index 0b1442f..6ee58f5 100644
--- a/packages/pigeon/lib/swift_generator.dart
+++ b/packages/pigeon/lib/swift_generator.dart
@@ -24,15 +24,15 @@
   final Iterable<String>? copyrightHeader;
 
   /// Creates a [SwiftOptions] from a Map representation where:
-  /// `x = SwiftOptions.fromMap(x.toMap())`.
-  static SwiftOptions fromMap(Map<String, Object> map) {
+  /// `x = SwiftOptions.fromList(x.toMap())`.
+  static SwiftOptions fromList(Map<String, Object> map) {
     return SwiftOptions(
       copyrightHeader: map['copyrightHeader'] as Iterable<String>?,
     );
   }
 
   /// Converts a [SwiftOptions] to a Map representation where:
-  /// `x = SwiftOptions.fromMap(x.toMap())`.
+  /// `x = SwiftOptions.fromList(x.toMap())`.
   Map<String, Object> toMap() {
     final Map<String, Object> result = <String, Object>{
       if (copyrightHeader != null) 'copyrightHeader': copyrightHeader!,
@@ -43,7 +43,7 @@
   /// Overrides any non-null parameters from [options] into this to make a new
   /// [SwiftOptions].
   SwiftOptions merge(SwiftOptions options) {
-    return SwiftOptions.fromMap(mergeMaps(toMap(), options.toMap()));
+    return SwiftOptions.fromList(mergeMaps(toMap(), options.toMap()));
   }
 }
 
@@ -75,7 +75,7 @@
             indent.write('case ${customClass.enumeration}:');
             indent.scoped('', '', () {
               indent.write(
-                  'return ${customClass.name}.fromMap(self.readValue() as! [String: Any])');
+                  'return ${customClass.name}.fromList(self.readValue() as! [Any])');
             });
           }
           indent.write('default:');
@@ -98,7 +98,7 @@
           indent.add('if let value = value as? ${customClass.name} ');
           indent.scoped('{', '} else ', () {
             indent.writeln('super.writeByte(${customClass.enumeration})');
-            indent.writeln('super.writeValue(value.toMap())');
+            indent.writeln('super.writeValue(value.toList())');
           }, addTrailingNewline: false);
         }
         indent.scoped('{', '}', () {
@@ -145,7 +145,7 @@
   final String apiName = api.name;
 
   const List<String> generatedComments = <String>[
-    'Generated protocol from Pigeon that represents a handler of messages from Flutter.'
+    ' Generated protocol from Pigeon that represents a handler of messages from Flutter.'
   ];
   addDocumentationComments(indent, api.documentationComments, _docCommentSpec,
       generatorComments: generatedComments);
@@ -282,7 +282,7 @@
 void _writeFlutterApi(Indent indent, Api api, Root root) {
   assert(api.location == ApiLocation.flutter);
   const List<String> generatedComments = <String>[
-    'Generated class from Pigeon that represents Flutter messages that can be called from Swift.'
+    ' Generated class from Pigeon that represents Flutter messages that can be called from Swift.'
   ];
   addDocumentationComments(indent, api.documentationComments, _docCommentSpec,
       generatorComments: generatedComments);
@@ -470,15 +470,9 @@
 
     indent.write('enum ${anEnum.name}: Int ');
     indent.scoped('{', '}', () {
-      // We use explicit indexing here as use of the ordinal() method is
-      // discouraged. The toMap and fromMap API matches class API to allow
-      // the same code to work with enums and classes, but this
-      // can also be done directly in the host and flutter APIs.
-      int index = 0;
-      for (final String member in anEnum.members) {
+      enumerate(anEnum.members, (int index, final String member) {
         indent.writeln('case ${_camelCase(member)} = $index');
-        index++;
-      }
+      });
     });
   }
 
@@ -493,19 +487,19 @@
       indent.addln(defaultNil);
     }
 
-    void writeToMap() {
-      indent.write('func toMap() -> [String: Any?] ');
+    void writeToList() {
+      indent.write('func toList() -> [Any?] ');
       indent.scoped('{', '}', () {
         indent.write('return ');
         indent.scoped('[', ']', () {
-          for (final NamedType field in klass.fields) {
+          for (final NamedType field in getFieldsInSerializationOrder(klass)) {
             final HostDatatype hostDatatype = getHostDatatype(field);
             String toWriteValue = '';
             final String fieldName = field.name;
             final String nullsafe = field.type.isNullable ? '?' : '';
             if (!hostDatatype.isBuiltin &&
                 rootClassNameSet.contains(field.type.baseName)) {
-              toWriteValue = '$fieldName$nullsafe.toMap()';
+              toWriteValue = '$fieldName$nullsafe.toList()';
             } else if (!hostDatatype.isBuiltin &&
                 rootEnumNameSet.contains(field.type.baseName)) {
               toWriteValue = '$fieldName$nullsafe.rawValue';
@@ -513,67 +507,66 @@
               toWriteValue = field.name;
             }
 
-            final String comma = klass.fields.last == field ? '' : ',';
-
-            indent.writeln('"${field.name}": $toWriteValue$comma');
+            indent.writeln('$toWriteValue,');
           }
         });
       });
     }
 
-    void writeFromMap() {
+    void writeFromList() {
       final String className = klass.name;
-      indent
-          .write('static func fromMap(_ map: [String: Any?]) -> $className? ');
+      indent.write('static func fromList(_ list: [Any?]) -> $className? ');
 
       indent.scoped('{', '}', () {
-        for (final NamedType field in klass.fields) {
+        enumerate(getFieldsInSerializationOrder(klass),
+            (int index, final NamedType field) {
           final HostDatatype hostDatatype = getHostDatatype(field);
 
-          final String mapValue = 'map["${field.name}"]';
+          final String listValue = 'list[$index]';
           final String fieldType = _swiftTypeForDartType(field.type);
 
           if (field.type.isNullable) {
             if (!hostDatatype.isBuiltin &&
                 rootClassNameSet.contains(field.type.baseName)) {
               indent.writeln('var ${field.name}: $fieldType? = nil');
-              indent.write(
-                  'if let ${field.name}Map = $mapValue as? [String: Any?] ');
+              indent.write('if let ${field.name}List = $listValue as? [Any?] ');
               indent.scoped('{', '}', () {
                 indent.writeln(
-                    '${field.name} = $fieldType.fromMap(${field.name}Map)');
+                    '${field.name} = $fieldType.fromList(${field.name}List)');
               });
             } else if (!hostDatatype.isBuiltin &&
                 rootEnumNameSet.contains(field.type.baseName)) {
               indent.writeln('var ${field.name}: $fieldType? = nil');
-              indent.write('if let ${field.name}RawValue = $mapValue as? Int ');
+              indent
+                  .write('if let ${field.name}RawValue = $listValue as? Int ');
               indent.scoped('{', '}', () {
                 indent.writeln(
                     '${field.name} = $fieldType(rawValue: ${field.name}RawValue)');
               });
             } else {
-              indent.writeln('let ${field.name} = $mapValue as? $fieldType ');
+              indent.writeln('let ${field.name} = $listValue as? $fieldType ');
             }
           } else {
             if (!hostDatatype.isBuiltin &&
                 rootClassNameSet.contains(field.type.baseName)) {
               indent.writeln(
-                  'let ${field.name} = $fieldType.fromMap($mapValue as! [String: Any?])!');
+                  'let ${field.name} = $fieldType.fromList($listValue as! [Any?])!');
             } else if (!hostDatatype.isBuiltin &&
                 rootEnumNameSet.contains(field.type.baseName)) {
               indent.writeln(
-                  'let ${field.name} = $fieldType(rawValue: $mapValue as! Int)!');
+                  'let ${field.name} = $fieldType(rawValue: $listValue as! Int)!');
             } else {
-              indent.writeln('let ${field.name} = $mapValue as! $fieldType');
+              indent.writeln('let ${field.name} = $listValue as! $fieldType');
             }
           }
-        }
+        });
 
         indent.writeln('');
         indent.write('return ');
         indent.scoped('$className(', ')', () {
-          for (final NamedType field in klass.fields) {
-            final String comma = klass.fields.last == field ? '' : ',';
+          for (final NamedType field in getFieldsInSerializationOrder(klass)) {
+            final String comma =
+                getFieldsInSerializationOrder(klass).last == field ? '' : ',';
             indent.writeln('${field.name}: ${field.name}$comma');
           }
         });
@@ -581,7 +574,7 @@
     }
 
     const List<String> generatedComments = <String>[
-      'Generated class from Pigeon that represents data sent in messages.'
+      ' Generated class from Pigeon that represents data sent in messages.'
     ];
     addDocumentationComments(
         indent, klass.documentationComments, _docCommentSpec,
@@ -589,11 +582,11 @@
 
     indent.write('struct ${klass.name} ');
     indent.scoped('{', '}', () {
-      klass.fields.forEach(writeField);
+      getFieldsInSerializationOrder(klass).forEach(writeField);
 
       indent.writeln('');
-      writeFromMap();
-      writeToMap();
+      writeFromList();
+      writeToList();
     });
   }
 
@@ -606,24 +599,20 @@
   }
 
   void writeWrapResult() {
-    indent.write('private func wrapResult(_ result: Any?) -> [String: Any?] ');
+    indent.write('private func wrapResult(_ result: Any?) -> [Any?] ');
     indent.scoped('{', '}', () {
-      indent.writeln('return ["result": result]');
+      indent.writeln('return [result]');
     });
   }
 
   void writeWrapError() {
-    indent.write(
-        'private func wrapError(_ error: FlutterError) -> [String: Any?] ');
+    indent.write('private func wrapError(_ error: FlutterError) -> [Any?] ');
     indent.scoped('{', '}', () {
       indent.write('return ');
       indent.scoped('[', ']', () {
-        indent.write('"error": ');
-        indent.scoped('[', ']', () {
-          indent.writeln('"${Keys.errorCode}": error.code,');
-          indent.writeln('"${Keys.errorMessage}": error.message,');
-          indent.writeln('"${Keys.errorDetails}": error.details');
-        });
+        indent.writeln('error.code,');
+        indent.writeln('error.message,');
+        indent.writeln('error.details');
       });
     });
   }
diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart
index 3e86aca..f64aa5d 100644
--- a/packages/pigeon/mock_handler_tester/test/message.dart
+++ b/packages/pigeon/mock_handler_tester/test/message.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.0.2), do not edit directly.
+// Autogenerated from Pigeon (v4.2.11), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -11,12 +11,22 @@
 import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
 import 'package:flutter/services.dart';
 
+/// This comment is to test enum documentation comments.
+///
+/// This comment also tests multiple line comments.
+///
+/// ////////////////////////
+/// This comment also tests comments that start with '/'
+/// ////////////////////////
 enum MessageRequestState {
   pending,
   success,
   failure,
 }
 
+/// This comment is to test class documentation comments.
+///
+/// This comment also tests multiple line comments.
 class MessageSearchRequest {
   MessageSearchRequest({
     this.query,
@@ -24,28 +34,34 @@
     this.aBool,
   });
 
+  /// This comment is to test field documentation comments.
   String? query;
+
+  /// This comment is to test field documentation comments.
   int? anInt;
+
+  /// This comment is to test field documentation comments.
   bool? aBool;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['query'] = query;
-    pigeonMap['anInt'] = anInt;
-    pigeonMap['aBool'] = aBool;
-    return pigeonMap;
+    return <Object?>[
+      query,
+      anInt,
+      aBool,
+    ];
   }
 
-  static MessageSearchRequest decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static MessageSearchRequest decode(Object result) {
+    result as List<Object?>;
     return MessageSearchRequest(
-      query: pigeonMap['query'] as String?,
-      anInt: pigeonMap['anInt'] as int?,
-      aBool: pigeonMap['aBool'] as bool?,
+      query: result[0] as String?,
+      anInt: result[1] as int?,
+      aBool: result[2] as bool?,
     );
   }
 }
 
+/// This comment is to test class documentation comments.
 class MessageSearchReply {
   MessageSearchReply({
     this.result,
@@ -53,48 +69,57 @@
     this.state,
   });
 
+  /// This comment is to test field documentation comments.
+  ///
+  /// This comment also tests multiple line comments.
   String? result;
+
+  /// This comment is to test field documentation comments.
   String? error;
+
+  /// This comment is to test field documentation comments.
   MessageRequestState? state;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['result'] = result;
-    pigeonMap['error'] = error;
-    pigeonMap['state'] = state?.index;
-    return pigeonMap;
+    return <Object?>[
+      result,
+      error,
+      state?.index,
+    ];
   }
 
-  static MessageSearchReply decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static MessageSearchReply decode(Object result) {
+    result as List<Object?>;
     return MessageSearchReply(
-      result: pigeonMap['result'] as String?,
-      error: pigeonMap['error'] as String?,
-      state: pigeonMap['state'] != null
-          ? MessageRequestState.values[pigeonMap['state']! as int]
+      result: result[0] as String?,
+      error: result[1] as String?,
+      state: result[2] != null
+          ? MessageRequestState.values[result[2]! as int]
           : null,
     );
   }
 }
 
+/// This comment is to test class documentation comments.
 class MessageNested {
   MessageNested({
     this.request,
   });
 
+  /// This comment is to test field documentation comments.
   MessageSearchRequest? request;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['request'] = request?.encode();
-    return pigeonMap;
+    return <Object?>[
+      request?.encode(),
+    ];
   }
 
-  static MessageNested decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static MessageNested decode(Object result) {
+    result as List<Object?>;
     return MessageNested(
-      request: pigeonMap['request'] != null
-          ? MessageSearchRequest.decode(pigeonMap['request']!)
+      request: result[0] != null
+          ? MessageSearchRequest.decode(result[0]! as List<Object?>)
           : null,
     );
   }
@@ -130,67 +155,68 @@
   }
 }
 
+/// This comment is to test api documentation comments.
+///
+/// This comment also tests multiple line comments.
 class MessageApi {
   /// Constructor for [MessageApi].  The [binaryMessenger] named argument is
   /// available for dependency injection.  If it is left null, the default
   /// BinaryMessenger will be used which routes to the host platform.
   MessageApi({BinaryMessenger? binaryMessenger})
       : _binaryMessenger = binaryMessenger;
-
   final BinaryMessenger? _binaryMessenger;
 
   static const MessageCodec<Object?> codec = _MessageApiCodec();
 
+  /// This comment is to test documentation comments.
+  ///
+  /// This comment also tests multiple line comments.
   Future<void> initialize() async {
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.MessageApi.initialize', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
     }
   }
 
+  /// This comment is to test method documentation comments.
   Future<MessageSearchReply> search(MessageSearchRequest arg_request) async {
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.MessageApi.search', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_request]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_request]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as MessageSearchReply?)!;
+      return (replyList[0] as MessageSearchReply?)!;
     }
   }
 }
@@ -231,43 +257,44 @@
   }
 }
 
+/// This comment is to test api documentation comments.
 class MessageNestedApi {
   /// Constructor for [MessageNestedApi].  The [binaryMessenger] named argument is
   /// available for dependency injection.  If it is left null, the default
   /// BinaryMessenger will be used which routes to the host platform.
   MessageNestedApi({BinaryMessenger? binaryMessenger})
       : _binaryMessenger = binaryMessenger;
-
   final BinaryMessenger? _binaryMessenger;
 
   static const MessageCodec<Object?> codec = _MessageNestedApiCodec();
 
+  /// This comment is to test method documentation comments.
+  ///
+  /// This comment also tests multiple line comments.
   Future<MessageSearchReply> search(MessageNested arg_nested) async {
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.MessageNestedApi.search', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_nested]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_nested]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as MessageSearchReply?)!;
+      return (replyList[0] as MessageSearchReply?)!;
     }
   }
 }
@@ -302,10 +329,13 @@
   }
 }
 
+/// This comment is to test api documentation comments.
 abstract class MessageFlutterSearchApi {
   static const MessageCodec<Object?> codec = _MessageFlutterSearchApiCodec();
 
+  /// This comment is to test method documentation comments.
   MessageSearchReply search(MessageSearchRequest request);
+
   static void setup(MessageFlutterSearchApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
diff --git a/packages/pigeon/mock_handler_tester/test/test.dart b/packages/pigeon/mock_handler_tester/test/test.dart
index b8adae4..d0ecdc5 100644
--- a/packages/pigeon/mock_handler_tester/test/test.dart
+++ b/packages/pigeon/mock_handler_tester/test/test.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.0.2), do not edit directly.
+// Autogenerated from Pigeon (v4.2.11), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import
 // ignore_for_file: avoid_relative_lib_imports
@@ -44,11 +44,20 @@
   }
 }
 
+/// This comment is to test api documentation comments.
+///
+/// This comment also tests multiple line comments.
 abstract class TestHostApi {
   static const MessageCodec<Object?> codec = _TestHostApiCodec();
 
+  /// This comment is to test documentation comments.
+  ///
+  /// This comment also tests multiple line comments.
   void initialize();
+
+  /// This comment is to test method documentation comments.
   MessageSearchReply search(MessageSearchRequest request);
+
   static void setup(TestHostApi? api, {BinaryMessenger? binaryMessenger}) {
     {
       final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
@@ -60,7 +69,7 @@
         channel.setMockMessageHandler((Object? message) async {
           // ignore message
           api.initialize();
-          return <Object?, Object?>{};
+          return <Object?>[];
         });
       }
     }
@@ -80,7 +89,7 @@
           assert(arg_request != null,
               'Argument for dev.flutter.pigeon.MessageApi.search was null, expected non-null MessageSearchRequest.');
           final MessageSearchReply output = api.search(arg_request!);
-          return <Object?, Object?>{'result': output};
+          return <Object?>[output];
         });
       }
     }
@@ -123,10 +132,15 @@
   }
 }
 
+/// This comment is to test api documentation comments.
 abstract class TestNestedApi {
   static const MessageCodec<Object?> codec = _TestNestedApiCodec();
 
+  /// This comment is to test method documentation comments.
+  ///
+  /// This comment also tests multiple line comments.
   MessageSearchReply search(MessageNested nested);
+
   static void setup(TestNestedApi? api, {BinaryMessenger? binaryMessenger}) {
     {
       final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
@@ -143,7 +157,7 @@
           assert(arg_nested != null,
               'Argument for dev.flutter.pigeon.MessageNestedApi.search was null, expected non-null MessageNested.');
           final MessageSearchReply output = api.search(arg_nested!);
-          return <Object?, Object?>{'result': output};
+          return <Object?>[output];
         });
       }
     }
diff --git a/packages/pigeon/mock_handler_tester/test/widget_test.dart b/packages/pigeon/mock_handler_tester/test/widget_test.dart
index 4ffded1..0973bfe 100644
--- a/packages/pigeon/mock_handler_tester/test/widget_test.dart
+++ b/packages/pigeon/mock_handler_tester/test/widget_test.dart
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:io';
-
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 
@@ -85,7 +83,7 @@
         await const BasicMessageChannel<Object?>(
           'dev.flutter.pigeon.MessageApi.search',
           StandardMessageCodec(),
-        ).send(<Object?>[null]) as Map<Object?, Object?>?;
+        ).send(<Object?>[null]) as List<Object?>?;
         expect(true, isFalse); // should not reach here
       } catch (error) {
         expect(error, isAssertionError);
@@ -98,7 +96,5 @@
       }
       expect(mock.log, <String>['initialize']);
     },
-    // TODO(ianh): skip can be removed after first stable release in 2021
-    skip: Platform.environment['CHANNEL'] == 'stable',
   );
 }
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java
index e4aea7c..61324c1 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java
@@ -14,7 +14,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
-import java.util.Map;
 import org.junit.Test;
 
 public class AllDatatypesTest {
@@ -147,10 +146,12 @@
   public void integerToLong() {
     AllNullableTypes everything = new AllNullableTypes();
     everything.setANullableInt(123L);
-    Map<String, Object> map = everything.toMap();
-    assertTrue(map.containsKey("aNullableInt"));
-    map.put("aNullableInt", 123);
-    AllNullableTypes readEverything = AllNullableTypes.fromMap(map);
+    ArrayList<Object> list = everything.toList();
+    assertNotNull(list);
+    assertNull(list.get(0));
+    assertNotNull(list.get(1));
+    list.set(1, 123);
+    AllNullableTypes readEverything = AllNullableTypes.fromList(list);
     assertEquals(readEverything.getANullableInt(), everything.getANullableInt());
   }
 }
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AsyncTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AsyncTest.java
index 7877e02..786aef3 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AsyncTest.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AsyncTest.java
@@ -11,7 +11,7 @@
 import io.flutter.plugin.common.BinaryMessenger;
 import io.flutter.plugin.common.MessageCodec;
 import java.nio.ByteBuffer;
-import java.util.Map;
+import java.util.ArrayList;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
@@ -60,8 +60,8 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              Map<String, Object> wrapped = (Map<String, Object>) codec.decodeMessage(bytes);
-              assertTrue(wrapped.containsKey("result"));
+              ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes);
+              assertTrue(wrapped.size() == 1);
               didCall[0] = true;
             });
     assertTrue(didCall[0]);
@@ -87,10 +87,9 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              Map<String, Object> wrapped = (Map<String, Object>) codec.decodeMessage(bytes);
-              assertTrue(wrapped.containsKey("error"));
-              assertEquals(
-                  "java.lang.Exception: error", ((Map) wrapped.get("error")).get("message"));
+              ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes);
+              assertTrue(wrapped.size() > 1);
+              assertEquals("java.lang.Exception: error", (String) wrapped.get(0));
               didCall[0] = true;
             });
     assertTrue(didCall[0]);
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/EnumTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/EnumTest.java
index 617e04f..37c14be 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/EnumTest.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/EnumTest.java
@@ -6,7 +6,7 @@
 
 import static org.junit.Assert.*;
 
-import java.util.Map;
+import java.util.ArrayList;
 import org.junit.Test;
 
 public class EnumTest {
@@ -14,8 +14,8 @@
   public void nullValue() {
     Enum.DataWithEnum value = new Enum.DataWithEnum();
     value.setState(null);
-    Map<String, Object> map = value.toMap();
-    Enum.DataWithEnum readValue = Enum.DataWithEnum.fromMap(map);
+    ArrayList<Object> list = value.toList();
+    Enum.DataWithEnum readValue = Enum.DataWithEnum.fromList(list);
     assertEquals(value.getState(), readValue.getState());
   }
 }
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/ListTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/ListTest.java
index 510534a..a1345a0 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/ListTest.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/ListTest.java
@@ -28,8 +28,7 @@
               ByteBuffer message = invocation.getArgument(1);
               BinaryMessenger.BinaryReply reply = invocation.getArgument(2);
               message.position(0);
-              ArrayList<Object> args =
-                  (ArrayList<Object>) EchoApi.getCodec().decodeMessage(message);
+              ArrayList args = (ArrayList) EchoApi.getCodec().decodeMessage(message);
               ByteBuffer replyData = EchoApi.getCodec().encodeMessage(args.get(0));
               replyData.position(0);
               reply.reply(replyData);
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullFieldsTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullFieldsTest.java
index de47463..d581c2d 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullFieldsTest.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullFieldsTest.java
@@ -7,9 +7,8 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
 import org.junit.Test;
 
 public class NullFieldsTest {
@@ -63,38 +62,39 @@
 
   @Test
   public void requestFromMapWithValues() {
-    HashMap<String, Object> map = new HashMap<>();
-    map.put("query", "hello");
-    map.put("identifier", 1L);
-
-    NullFields.NullFieldsSearchRequest request = NullFields.NullFieldsSearchRequest.fromMap(map);
+    ArrayList<Object> list = new ArrayList<Object>();
+    list.add("hello");
+    list.add(1L);
+    NullFields.NullFieldsSearchRequest request = NullFields.NullFieldsSearchRequest.fromList(list);
     assertEquals(request.getQuery(), "hello");
   }
 
   @Test
   public void requestFromMapWithNulls() {
-    HashMap<String, Object> map = new HashMap<>();
-    map.put("query", null);
-    map.put("identifier", 1L);
+    ArrayList<Object> list = new ArrayList<Object>();
+    list.add(null);
+    list.add(1L);
 
-    NullFields.NullFieldsSearchRequest request = NullFields.NullFieldsSearchRequest.fromMap(map);
+    NullFields.NullFieldsSearchRequest request = NullFields.NullFieldsSearchRequest.fromList(list);
     assertNull(request.getQuery());
   }
 
   @Test
   public void replyFromMapWithValues() {
-    HashMap<String, Object> requestMap = new HashMap<>();
-    requestMap.put("query", "hello");
-    requestMap.put("identifier", 1L);
+    ArrayList<Object> requestList = new ArrayList<Object>();
 
-    HashMap<String, Object> map = new HashMap<>();
-    map.put("result", "result");
-    map.put("error", "error");
-    map.put("indices", Arrays.asList(1L, 2L, 3L));
-    map.put("request", requestMap);
-    map.put("type", NullFields.NullFieldsSearchReplyType.SUCCESS.ordinal());
+    requestList.add("hello");
+    requestList.add(1L);
 
-    NullFields.NullFieldsSearchReply reply = NullFields.NullFieldsSearchReply.fromMap(map);
+    ArrayList<Object> list = new ArrayList<Object>();
+
+    list.add("result");
+    list.add("error");
+    list.add(Arrays.asList(1L, 2L, 3L));
+    list.add(requestList);
+    list.add(NullFields.NullFieldsSearchReplyType.SUCCESS.ordinal());
+
+    NullFields.NullFieldsSearchReply reply = NullFields.NullFieldsSearchReply.fromList(list);
     assertEquals(reply.getResult(), "result");
     assertEquals(reply.getError(), "error");
     assertEquals(reply.getIndices(), Arrays.asList(1L, 2L, 3L));
@@ -104,14 +104,15 @@
 
   @Test
   public void replyFromMapWithNulls() {
-    HashMap<String, Object> map = new HashMap<>();
-    map.put("result", null);
-    map.put("error", null);
-    map.put("indices", null);
-    map.put("request", null);
-    map.put("type", null);
+    ArrayList<Object> list = new ArrayList<Object>();
 
-    NullFields.NullFieldsSearchReply reply = NullFields.NullFieldsSearchReply.fromMap(map);
+    list.add(null);
+    list.add(null);
+    list.add(null);
+    list.add(null);
+    list.add(null);
+
+    NullFields.NullFieldsSearchReply reply = NullFields.NullFieldsSearchReply.fromList(list);
     assertNull(reply.getResult());
     assertNull(reply.getError());
     assertNull(reply.getIndices());
@@ -127,8 +128,8 @@
             .setIdentifier(1L)
             .build();
 
-    Map<String, Object> map = request.toMap();
-    assertEquals(map.get("query"), "hello");
+    ArrayList<Object> list = request.toList();
+    assertEquals(list.get(0), "hello");
   }
 
   @Test
@@ -136,8 +137,8 @@
     NullFields.NullFieldsSearchRequest request =
         new NullFields.NullFieldsSearchRequest.Builder().setQuery(null).setIdentifier(1L).build();
 
-    Map<String, Object> map = request.toMap();
-    assertNull(map.get("query"));
+    ArrayList<Object> list = request.toList();
+    assertNull(list.get(0));
   }
 
   @Test
@@ -155,12 +156,12 @@
             .setType(NullFields.NullFieldsSearchReplyType.SUCCESS)
             .build();
 
-    Map<String, Object> map = reply.toMap();
-    assertEquals(map.get("result"), "result");
-    assertEquals(map.get("error"), "error");
-    assertEquals(map.get("indices"), Arrays.asList(1L, 2L, 3L));
-    assertEquals(map.get("request"), reply.getRequest().toMap());
-    assertEquals(map.get("type"), NullFields.NullFieldsSearchReplyType.SUCCESS.ordinal());
+    ArrayList<Object> list = reply.toList();
+    assertEquals(list.get(0), "result");
+    assertEquals(list.get(1), "error");
+    assertEquals(list.get(2), Arrays.asList(1L, 2L, 3L));
+    assertEquals(list.get(3), reply.getRequest().toList());
+    assertEquals(list.get(4), NullFields.NullFieldsSearchReplyType.SUCCESS.ordinal());
   }
 
   @Test
@@ -174,11 +175,12 @@
             .setType(null)
             .build();
 
-    Map<String, Object> map = reply.toMap();
-    assertNull(map.get("result"));
-    assertNull(map.get("error"));
-    assertNull(map.get("indices"));
-    assertNull(map.get("request"));
-    assertNull(map.get("type"));
+    ArrayList<Object> list = reply.toList();
+
+    assertNull(list.get(0));
+    assertNull(list.get(1));
+    assertNull(list.get(2));
+    assertNull(list.get(3));
+    assertNull(list.get(4));
   }
 }
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullableReturnsTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullableReturnsTest.java
index 0b3beec..041a83b 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullableReturnsTest.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NullableReturnsTest.java
@@ -11,7 +11,6 @@
 import io.flutter.plugin.common.MessageCodec;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
-import java.util.Map;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
@@ -40,8 +39,8 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              Map<String, Object> wrapped = (Map<String, Object>) codec.decodeMessage(bytes);
-              assertTrue(wrapped.containsKey("result"));
+              ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes);
+              assertTrue(wrapped.size() == 1);
             });
   }
 
@@ -53,8 +52,8 @@
               ByteBuffer message = invocation.getArgument(1);
               BinaryMessenger.BinaryReply reply = invocation.getArgument(2);
               message.position(0);
-              ArrayList<Object> args =
-                  (ArrayList<Object>)
+              ArrayList args =
+                  (ArrayList)
                       NullableReturns.NullableArgFlutterApi.getCodec().decodeMessage(message);
               assertNull(args.get(0));
               ByteBuffer replyData =
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PigeonTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PigeonTest.java
index c50bd51..a8a88b1 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PigeonTest.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PigeonTest.java
@@ -12,31 +12,30 @@
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Map;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
 public class PigeonTest {
   @Test
-  public void toMapAndBack() {
+  public void toListAndBack() {
     Pigeon.AndroidSetRequest request = new Pigeon.AndroidSetRequest();
     request.setValue(1234l);
     request.setState(Pigeon.AndroidLoadingState.COMPLETE);
-    Map<String, Object> map = request.toMap();
-    Pigeon.AndroidSetRequest readRequest = Pigeon.AndroidSetRequest.fromMap(map);
+    ArrayList<Object> list = request.toList();
+    Pigeon.AndroidSetRequest readRequest = Pigeon.AndroidSetRequest.fromList(list);
     assertEquals(request.getValue(), readRequest.getValue());
     assertEquals(request.getState(), readRequest.getState());
   }
 
   @Test
-  public void toMapAndBackNested() {
+  public void toListAndBackNested() {
     Pigeon.AndroidNestedRequest nested = new Pigeon.AndroidNestedRequest();
     Pigeon.AndroidSetRequest request = new Pigeon.AndroidSetRequest();
     request.setValue(1234l);
     request.setState(Pigeon.AndroidLoadingState.COMPLETE);
     nested.setRequest(request);
-    Map<String, Object> map = nested.toMap();
-    Pigeon.AndroidNestedRequest readNested = Pigeon.AndroidNestedRequest.fromMap(map);
+    ArrayList<Object> list = nested.toList();
+    Pigeon.AndroidNestedRequest readNested = Pigeon.AndroidNestedRequest.fromList(list);
     assertEquals(nested.getRequest().getValue(), readNested.getRequest().getValue());
     assertEquals(nested.getRequest().getState(), readNested.getRequest().getState());
   }
@@ -70,11 +69,10 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              Map<String, Object> wrapped = (Map<String, Object>) codec.decodeMessage(bytes);
-              assertTrue(wrapped.containsKey("error"));
-              Map<Object, Object> error = (Map<Object, Object>) wrapped.get("error");
-              assertTrue(error.containsKey("details"));
-              String details = (String) error.get("details");
+              ArrayList error = (ArrayList) codec.decodeMessage(bytes);
+              assertNotNull(error.get(0));
+              assertNotNull(error.get(1));
+              String details = (String) error.get(2);
               assertTrue(details.contains("Cause:"));
               assertTrue(details.contains("Stacktrace:"));
             });
@@ -101,9 +99,9 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              Map<String, Object> wrapped = (Map<String, Object>) codec.decodeMessage(bytes);
-              assertTrue(wrapped.containsKey("result"));
-              assertNull(wrapped.get("result"));
+              ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes);
+              assertTrue(wrapped.size() == 1);
+              assertNull(wrapped.get(0));
             });
     ArgumentCaptor<Pigeon.AndroidSetRequest> receivedRequest =
         ArgumentCaptor.forClass(Pigeon.AndroidSetRequest.class);
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PrimitiveTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PrimitiveTest.java
index 9599513..772b869 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PrimitiveTest.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/PrimitiveTest.java
@@ -28,8 +28,7 @@
               ByteBuffer message = invocation.getArgument(1);
               BinaryMessenger.BinaryReply reply = invocation.getArgument(2);
               message.position(0);
-              ArrayList<Object> args =
-                  (ArrayList<Object>) PrimitiveFlutterApi.getCodec().decodeMessage(message);
+              ArrayList args = (ArrayList) PrimitiveFlutterApi.getCodec().decodeMessage(message);
               Object arg = args.get(0);
               if (arg instanceof Long) {
                 Long longArg = (Long) arg;
@@ -88,7 +87,8 @@
     verify(binaryMessenger)
         .setMessageHandler(eq("dev.flutter.pigeon.PrimitiveHostApi.anInt"), handler.capture());
     MessageCodec<Object> codec = PrimitiveHostApi.getCodec();
-    ByteBuffer message = codec.encodeMessage(new ArrayList<Object>(Arrays.asList((Integer) 1)));
+    @SuppressWarnings("unchecked")
+    ByteBuffer message = codec.encodeMessage(new ArrayList(Arrays.asList((Integer) 1)));
     message.rewind();
     handler
         .getValue()
@@ -97,9 +97,9 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              Map<String, Object> wrapped = (Map<String, Object>) codec.decodeMessage(bytes);
-              assertTrue(wrapped.containsKey("result"));
-              assertEquals(1L, ((Long) wrapped.get("result")).longValue());
+              ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes);
+              assertTrue(wrapped.size() > 0);
+              assertEquals(1L, ((Long) wrapped.get(0)).longValue());
             });
   }
 
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/AsyncHandlersTest.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/AsyncHandlersTest.m
index 7831c71..223857d 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/AsyncHandlersTest.m
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/AsyncHandlersTest.m
@@ -15,8 +15,8 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////
 @interface Value ()
-+ (Value *)fromMap:(NSDictionary *)dict;
-- (NSDictionary *)toMap;
++ (Value *)fromList:(NSArray *)list;
+- (NSArray *)toList;
 @end
 
 ///////////////////////////////////////////////////////////////////////////////////////////
@@ -79,9 +79,8 @@
 
   XCTestExpectation *expectation = [self expectationWithDescription:@"voidvoid callback"];
   binaryMessenger.handlers[channelName](nil, ^(NSData *data) {
-    NSDictionary *outputMap = [binaryMessenger.codec decode:data];
-    XCTAssertEqualObjects(outputMap[@"result"], [NSNull null]);
-    XCTAssertEqualObjects(outputMap[@"error"], [NSNull null]);
+    NSArray *outputList = [binaryMessenger.codec decode:data];
+    XCTAssertEqualObjects(outputList[0], [NSNull null]);
     [expectation fulfill];
   });
   [self waitForExpectationsWithTimeout:1.0 handler:nil];
@@ -98,9 +97,9 @@
 
   XCTestExpectation *expectation = [self expectationWithDescription:@"voidvoid callback"];
   binaryMessenger.handlers[channelName](nil, ^(NSData *data) {
-    NSDictionary *outputMap = [binaryMessenger.codec decode:data];
-    XCTAssertNotNil(outputMap[@"error"]);
-    XCTAssertEqualObjects(outputMap[@"error"][@"code"], mockApi2Host.voidVoidError.code);
+    NSArray *outputList = [binaryMessenger.codec decode:data];
+    XCTAssertNotNil(outputList);
+    XCTAssertEqualObjects(outputList[0], mockApi2Host.voidVoidError.code);
     [expectation fulfill];
   });
   [self waitForExpectationsWithTimeout:1.0 handler:nil];
@@ -120,8 +119,8 @@
   NSData *inputEncoded = [binaryMessenger.codec encode:@[ input ]];
   XCTestExpectation *expectation = [self expectationWithDescription:@"calculate callback"];
   binaryMessenger.handlers[channelName](inputEncoded, ^(NSData *data) {
-    NSDictionary *outputMap = [binaryMessenger.codec decode:data];
-    Value *output = outputMap[@"result"];
+    NSArray *outputList = [binaryMessenger.codec decode:data];
+    Value *output = outputList[0];
     XCTAssertEqual(output.number.intValue, 2);
     [expectation fulfill];
   });
@@ -138,11 +137,13 @@
 
   Value *input = [[Value alloc] init];
   input.number = @(1);
-  NSData *inputEncoded = [binaryMessenger.codec encode:@[ [input toMap] ]];
+  NSData *inputEncoded = [binaryMessenger.codec encode:@[ [input toList] ]];
   XCTestExpectation *expectation = [self expectationWithDescription:@"calculate callback"];
   binaryMessenger.handlers[channelName](inputEncoded, ^(NSData *data) {
-    NSDictionary *outputMap = [binaryMessenger.codec decode:data];
-    XCTAssertNotNil(outputMap[@"error"]);
+    NSArray *outputList = [binaryMessenger.codec decode:data];
+    XCTAssertNotNil(outputList);
+    XCTAssertEqualObjects(outputList[0], @"hey");
+    XCTAssertEqualObjects(outputList[1], @"ho");
     [expectation fulfill];
   });
   [self waitForExpectationsWithTimeout:1.0 handler:nil];
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/NullFieldsTest.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/NullFieldsTest.m
index b7bddee..fe05d5b 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/NullFieldsTest.m
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/NullFieldsTest.m
@@ -15,14 +15,14 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////
 @interface NullFieldsSearchRequest ()
-+ (NullFieldsSearchRequest *)fromMap:(NSDictionary *)dict;
-- (NSDictionary *)toMap;
++ (NullFieldsSearchRequest *)fromList:(NSArray *)list;
+- (NSArray *)toList;
 @end
 
 ///////////////////////////////////////////////////////////////////////////////////////////
 @interface NullFieldsSearchReply ()
-+ (NullFieldsSearchReply *)fromMap:(NSDictionary *)dict;
-- (NSDictionary *)toMap;
++ (NullFieldsSearchReply *)fromList:(NSArray *)list;
+- (NSArray *)toList;
 @end
 
 ///////////////////////////////////////////////////////////////////////////////////////////
@@ -69,38 +69,38 @@
   XCTAssertEqual(NullFieldsSearchReplyTypeSuccess, reply.type);
 }
 
-- (void)testRequestFromMapWithValues {
-  NSDictionary *map = @{
-    @"query" : @"hello",
-    @"identifier" : @1,
-  };
-  NullFieldsSearchRequest *request = [NullFieldsSearchRequest fromMap:map];
+- (void)testRequestFromListWithValues {
+  NSArray *list = @[
+    @"hello",
+    @1,
+  ];
+  NullFieldsSearchRequest *request = [NullFieldsSearchRequest fromList:list];
   XCTAssertEqualObjects(@"hello", request.query);
 }
 
-- (void)testRequestFromMapWithNulls {
-  NSDictionary *map = @{
-    @"query" : [NSNull null],
-    @"identifier" : @1,
-  };
-  NullFieldsSearchRequest *request = [NullFieldsSearchRequest fromMap:map];
+- (void)testRequestFromListWithNulls {
+  NSArray *list = @[
+    [NSNull null],
+    @1,
+  ];
+  NullFieldsSearchRequest *request = [NullFieldsSearchRequest fromList:list];
   XCTAssertNil(request.query);
 }
 
-- (void)testReplyFromMapWithValues {
-  NSDictionary *map = @{
-    @"result" : @"result",
-    @"error" : @"error",
-    @"indices" : @[ @1, @2, @3 ],
-    @"request" : @{
-      @"query" : @"hello",
-      @"identifier" : @1,
-    },
-    @"type" : @0,
-  };
+- (void)testReplyFromListWithValues {
+  NSArray *list = @[
+    @"result",
+    @"error",
+    @[ @1, @2, @3 ],
+    @[
+      @"hello",
+      @1,
+    ],
+    @0,
+  ];
 
   NSArray *indices = @[ @1, @2, @3 ];
-  NullFieldsSearchReply *reply = [NullFieldsSearchReply fromMap:map];
+  NullFieldsSearchReply *reply = [NullFieldsSearchReply fromList:list];
   XCTAssertEqualObjects(@"result", reply.result);
   XCTAssertEqualObjects(@"error", reply.error);
   XCTAssertEqualObjects(indices, reply.indices);
@@ -108,15 +108,15 @@
   XCTAssertEqual(NullFieldsSearchReplyTypeSuccess, reply.type);
 }
 
-- (void)testReplyFromMapWithNulls {
-  NSDictionary *map = @{
-    @"result" : [NSNull null],
-    @"error" : [NSNull null],
-    @"indices" : [NSNull null],
-    @"request" : [NSNull null],
-    @"type" : [NSNull null],
-  };
-  NullFieldsSearchReply *reply = [NullFieldsSearchReply fromMap:map];
+- (void)testReplyFromListWithNulls {
+  NSArray *list = @[
+    [NSNull null],
+    [NSNull null],
+    [NSNull null],
+    [NSNull null],
+    [NSNull null],
+  ];
+  NullFieldsSearchReply *reply = [NullFieldsSearchReply fromList:list];
   XCTAssertNil(reply.result);
   XCTAssertNil(reply.error);
   XCTAssertNil(reply.indices);
@@ -124,46 +124,46 @@
   XCTAssertEqual(NullFieldsSearchReplyTypeSuccess, reply.type);
 }
 
-- (void)testRequestToMapWithValuess {
+- (void)testRequestToListWithValuess {
   NullFieldsSearchRequest *request = [NullFieldsSearchRequest makeWithQuery:@"hello" identifier:@1];
-  NSDictionary *dict = [request toMap];
-  XCTAssertEqual(@"hello", dict[@"query"]);
+  NSArray *list = [request toList];
+  XCTAssertEqual(@"hello", list[0]);
 }
 
-- (void)testRequestToMapWithNulls {
+- (void)testRequestToListWithNulls {
   NullFieldsSearchRequest *request = [NullFieldsSearchRequest makeWithQuery:nil identifier:@1];
-  NSDictionary *dict = [request toMap];
-  XCTAssertEqual([NSNull null], dict[@"query"]);
+  NSArray *list = [request toList];
+  XCTAssertEqual([NSNull null], list[0]);
 }
 
-- (void)testReplyToMapWithValuess {
+- (void)testReplyToListWithValuess {
   NullFieldsSearchReply *reply = [NullFieldsSearchReply
       makeWithResult:@"result"
                error:@"error"
              indices:@[ @1, @2, @3 ]
              request:[NullFieldsSearchRequest makeWithQuery:@"hello" identifier:@1]
                 type:NullFieldsSearchReplyTypeSuccess];
-  NSDictionary *dict = [reply toMap];
+  NSArray *list = [reply toList];
   NSArray *indices = @[ @1, @2, @3 ];
-  XCTAssertEqualObjects(@"result", dict[@"result"]);
-  XCTAssertEqualObjects(@"error", dict[@"error"]);
-  XCTAssertEqualObjects(indices, dict[@"indices"]);
-  XCTAssertEqualObjects(@"hello", dict[@"request"][@"query"]);
-  XCTAssertEqualObjects(@0, dict[@"type"]);
+  XCTAssertEqualObjects(@"result", list[0]);
+  XCTAssertEqualObjects(@"error", list[1]);
+  XCTAssertEqualObjects(indices, list[2]);
+  XCTAssertEqualObjects(@"hello", list[3][0]);
+  XCTAssertEqualObjects(@0, list[4]);
 }
 
-- (void)testReplyToMapWithNulls {
+- (void)testReplyToListWithNulls {
   NullFieldsSearchReply *reply =
       [NullFieldsSearchReply makeWithResult:nil
                                       error:nil
                                     indices:nil
                                     request:nil
                                        type:NullFieldsSearchReplyTypeSuccess];
-  NSDictionary *dict = [reply toMap];
-  XCTAssertEqual([NSNull null], dict[@"result"]);
-  XCTAssertEqual([NSNull null], dict[@"error"]);
-  XCTAssertEqual([NSNull null], dict[@"indices"]);
-  XCTAssertEqual([NSNull null], dict[@"request"]);
+  NSArray *list = [reply toList];
+  XCTAssertEqual([NSNull null], list[0]);
+  XCTAssertEqual([NSNull null], list[1]);
+  XCTAssertEqual([NSNull null], list[2]);
+  XCTAssertEqual([NSNull null], list[3]);
 }
 
 @end
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/RunnerTests.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/RunnerTests.m
index eef1730..130788f 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/RunnerTests.m
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/RunnerTests/RunnerTests.m
@@ -11,8 +11,8 @@
 #endif
 
 @interface ACMessageSearchReply ()
-+ (ACMessageSearchReply *)fromMap:(NSDictionary *)dict;
-- (NSDictionary *)toMap;
++ (ACMessageSearchReply *)fromList:(NSArray *)list;
+- (NSArray *)toList;
 @end
 
 @interface RunnerTests : XCTestCase
@@ -24,24 +24,24 @@
 - (void)testToMapAndBack {
   ACMessageSearchReply *reply = [[ACMessageSearchReply alloc] init];
   reply.result = @"foobar";
-  NSDictionary *dict = [reply toMap];
-  ACMessageSearchReply *copy = [ACMessageSearchReply fromMap:dict];
+  NSArray *list = [reply toList];
+  ACMessageSearchReply *copy = [ACMessageSearchReply fromList:list];
   XCTAssertEqual(reply.result, copy.result);
 }
 
 - (void)testHandlesNull {
   ACMessageSearchReply *reply = [[ACMessageSearchReply alloc] init];
   reply.result = nil;
-  NSDictionary *dict = [reply toMap];
-  ACMessageSearchReply *copy = [ACMessageSearchReply fromMap:dict];
+  NSArray *list = [reply toList];
+  ACMessageSearchReply *copy = [ACMessageSearchReply fromList:list];
   XCTAssertNil(copy.result);
 }
 
 - (void)testHandlesNullFirst {
   ACMessageSearchReply *reply = [[ACMessageSearchReply alloc] init];
   reply.error = @"foobar";
-  NSDictionary *dict = [reply toMap];
-  ACMessageSearchReply *copy = [ACMessageSearchReply fromMap:dict];
+  NSArray *list = [reply toList];
+  ACMessageSearchReply *copy = [ACMessageSearchReply fromList:list];
   XCTAssertEqual(reply.error, copy.error);
 }
 
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/all_datatypes.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/all_datatypes.dart
index c3f9fe3..9b07455 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/all_datatypes.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/all_datatypes.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.0.2), do not edit directly.
+// Autogenerated from Pigeon (v4.2.9), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -29,57 +29,67 @@
   });
 
   bool? aBool;
+
   int? anInt;
+
   double? aDouble;
+
   String? aString;
+
   Uint8List? aByteArray;
+
   Int32List? a4ByteArray;
+
   Int64List? a8ByteArray;
+
   Float64List? aFloatArray;
+
   List<Object?>? aList;
+
   Map<Object?, Object?>? aMap;
+
   List<List<bool?>?>? nestedList;
+
   Map<String?, String?>? mapWithAnnotations;
+
   Map<String?, Object?>? mapWithObject;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['aBool'] = aBool;
-    pigeonMap['anInt'] = anInt;
-    pigeonMap['aDouble'] = aDouble;
-    pigeonMap['aString'] = aString;
-    pigeonMap['aByteArray'] = aByteArray;
-    pigeonMap['a4ByteArray'] = a4ByteArray;
-    pigeonMap['a8ByteArray'] = a8ByteArray;
-    pigeonMap['aFloatArray'] = aFloatArray;
-    pigeonMap['aList'] = aList;
-    pigeonMap['aMap'] = aMap;
-    pigeonMap['nestedList'] = nestedList;
-    pigeonMap['mapWithAnnotations'] = mapWithAnnotations;
-    pigeonMap['mapWithObject'] = mapWithObject;
-    return pigeonMap;
+    final List<Object?> pigeonList = <Object?>[];
+    pigeonList.add(aBool);
+    pigeonList.add(anInt);
+    pigeonList.add(aDouble);
+    pigeonList.add(aString);
+    pigeonList.add(aByteArray);
+    pigeonList.add(a4ByteArray);
+    pigeonList.add(a8ByteArray);
+    pigeonList.add(aFloatArray);
+    pigeonList.add(aList);
+    pigeonList.add(aMap);
+    pigeonList.add(nestedList);
+    pigeonList.add(mapWithAnnotations);
+    pigeonList.add(mapWithObject);
+    return pigeonList;
   }
 
-  static Everything decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static Everything decode(Object result) {
+    result as List<Object?>;
     return Everything(
-      aBool: pigeonMap['aBool'] as bool?,
-      anInt: pigeonMap['anInt'] as int?,
-      aDouble: pigeonMap['aDouble'] as double?,
-      aString: pigeonMap['aString'] as String?,
-      aByteArray: pigeonMap['aByteArray'] as Uint8List?,
-      a4ByteArray: pigeonMap['a4ByteArray'] as Int32List?,
-      a8ByteArray: pigeonMap['a8ByteArray'] as Int64List?,
-      aFloatArray: pigeonMap['aFloatArray'] as Float64List?,
-      aList: pigeonMap['aList'] as List<Object?>?,
-      aMap: pigeonMap['aMap'] as Map<Object?, Object?>?,
-      nestedList:
-          (pigeonMap['nestedList'] as List<Object?>?)?.cast<List<bool?>?>(),
+      aBool: result[0] as bool?,
+      anInt: result[1] as int?,
+      aDouble: result[2] as double?,
+      aString: result[3] as String?,
+      aByteArray: result[4] as Uint8List?,
+      a4ByteArray: result[5] as Int32List?,
+      a8ByteArray: result[6] as Int64List?,
+      aFloatArray: result[7] as Float64List?,
+      aList: result[8] as List<Object?>?,
+      aMap: result[9] as Map<Object?, Object?>?,
+      nestedList: (result[10] as List<Object?>?)?.cast<List<bool?>?>(),
       mapWithAnnotations:
-          (pigeonMap['mapWithAnnotations'] as Map<Object?, Object?>?)
-              ?.cast<String?, String?>(),
-      mapWithObject: (pigeonMap['mapWithObject'] as Map<Object?, Object?>?)
-          ?.cast<String?, Object?>(),
+          (result[11] as Map<Object?, Object?>?)?.cast<String?, String?>(),
+      mapWithObject:
+          (result[12] as Map<Object?, Object?>?)?.cast<String?, Object?>(),
     );
   }
 }
@@ -100,7 +110,7 @@
   Object? readValueOfType(int type, ReadBuffer buffer) {
     switch (type) {
       case 128:
-        return Everything.decode(readValue(buffer)!);
+        return Everything.decode(readValue(buffer)! as List<Object?>);
 
       default:
         return super.readValueOfType(type, buffer);
@@ -114,7 +124,6 @@
   /// BinaryMessenger will be used which routes to the host platform.
   HostEverything({BinaryMessenger? binaryMessenger})
       : _binaryMessenger = binaryMessenger;
-
   final BinaryMessenger? _binaryMessenger;
 
   static const MessageCodec<Object?> codec = _HostEverythingCodec();
@@ -123,28 +132,25 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostEverything.giveMeEverything', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: (replyList[0] as String?)!,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as Everything?)!;
+      return (replyList[0] as Everything?)!;
     }
   }
 
@@ -152,28 +158,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostEverything.echo', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_everything]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_everything]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: (replyList[0] as String?)!,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as Everything?)!;
+      return (replyList[0] as Everything?)!;
     }
   }
 }
@@ -194,7 +198,7 @@
   Object? readValueOfType(int type, ReadBuffer buffer) {
     switch (type) {
       case 128:
-        return Everything.decode(readValue(buffer)!);
+        return Everything.decode(readValue(buffer)! as List<Object?>);
 
       default:
         return super.readValueOfType(type, buffer);
@@ -206,7 +210,9 @@
   static const MessageCodec<Object?> codec = _FlutterEverythingCodec();
 
   Everything giveMeEverything();
+
   Everything echo(Everything everything);
+
   static void setup(FlutterEverything? api,
       {BinaryMessenger? binaryMessenger}) {
     {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart
index 0484151..4ff2bc0 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.2.11), do not edit directly.
+// Autogenerated from Pigeon (v4.2.12), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -33,47 +33,57 @@
   });
 
   bool aBool;
+
   int anInt;
+
   double aDouble;
+
   String aString;
+
   Uint8List aByteArray;
+
   Int32List a4ByteArray;
+
   Int64List a8ByteArray;
+
   Float64List aFloatArray;
+
   List<Object?> aList;
+
   Map<Object?, Object?> aMap;
+
   AnEnum anEnum;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['aBool'] = aBool;
-    pigeonMap['anInt'] = anInt;
-    pigeonMap['aDouble'] = aDouble;
-    pigeonMap['aString'] = aString;
-    pigeonMap['aByteArray'] = aByteArray;
-    pigeonMap['a4ByteArray'] = a4ByteArray;
-    pigeonMap['a8ByteArray'] = a8ByteArray;
-    pigeonMap['aFloatArray'] = aFloatArray;
-    pigeonMap['aList'] = aList;
-    pigeonMap['aMap'] = aMap;
-    pigeonMap['anEnum'] = anEnum.index;
-    return pigeonMap;
+    return <Object?>[
+      aBool,
+      anInt,
+      aDouble,
+      aString,
+      aByteArray,
+      a4ByteArray,
+      a8ByteArray,
+      aFloatArray,
+      aList,
+      aMap,
+      anEnum.index,
+    ];
   }
 
-  static AllTypes decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static AllTypes decode(Object result) {
+    result as List<Object?>;
     return AllTypes(
-      aBool: pigeonMap['aBool']! as bool,
-      anInt: pigeonMap['anInt']! as int,
-      aDouble: pigeonMap['aDouble']! as double,
-      aString: pigeonMap['aString']! as String,
-      aByteArray: pigeonMap['aByteArray']! as Uint8List,
-      a4ByteArray: pigeonMap['a4ByteArray']! as Int32List,
-      a8ByteArray: pigeonMap['a8ByteArray']! as Int64List,
-      aFloatArray: pigeonMap['aFloatArray']! as Float64List,
-      aList: pigeonMap['aList']! as List<Object?>,
-      aMap: pigeonMap['aMap']! as Map<Object?, Object?>,
-      anEnum: AnEnum.values[pigeonMap['anEnum']! as int],
+      aBool: result[0]! as bool,
+      anInt: result[1]! as int,
+      aDouble: result[2]! as double,
+      aString: result[3]! as String,
+      aByteArray: result[4]! as Uint8List,
+      a4ByteArray: result[5]! as Int32List,
+      a8ByteArray: result[6]! as Int64List,
+      aFloatArray: result[7]! as Float64List,
+      aList: result[8]! as List<Object?>,
+      aMap: result[9]! as Map<Object?, Object?>,
+      anEnum: AnEnum.values[result[10]! as int],
     );
   }
 }
@@ -97,63 +107,72 @@
   });
 
   bool? aNullableBool;
+
   int? aNullableInt;
+
   double? aNullableDouble;
+
   String? aNullableString;
+
   Uint8List? aNullableByteArray;
+
   Int32List? aNullable4ByteArray;
+
   Int64List? aNullable8ByteArray;
+
   Float64List? aNullableFloatArray;
+
   List<Object?>? aNullableList;
+
   Map<Object?, Object?>? aNullableMap;
+
   List<List<bool?>?>? nullableNestedList;
+
   Map<String?, String?>? nullableMapWithAnnotations;
+
   Map<String?, Object?>? nullableMapWithObject;
+
   AnEnum? aNullableEnum;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['aNullableBool'] = aNullableBool;
-    pigeonMap['aNullableInt'] = aNullableInt;
-    pigeonMap['aNullableDouble'] = aNullableDouble;
-    pigeonMap['aNullableString'] = aNullableString;
-    pigeonMap['aNullableByteArray'] = aNullableByteArray;
-    pigeonMap['aNullable4ByteArray'] = aNullable4ByteArray;
-    pigeonMap['aNullable8ByteArray'] = aNullable8ByteArray;
-    pigeonMap['aNullableFloatArray'] = aNullableFloatArray;
-    pigeonMap['aNullableList'] = aNullableList;
-    pigeonMap['aNullableMap'] = aNullableMap;
-    pigeonMap['nullableNestedList'] = nullableNestedList;
-    pigeonMap['nullableMapWithAnnotations'] = nullableMapWithAnnotations;
-    pigeonMap['nullableMapWithObject'] = nullableMapWithObject;
-    pigeonMap['aNullableEnum'] = aNullableEnum?.index;
-    return pigeonMap;
+    return <Object?>[
+      aNullableBool,
+      aNullableInt,
+      aNullableDouble,
+      aNullableString,
+      aNullableByteArray,
+      aNullable4ByteArray,
+      aNullable8ByteArray,
+      aNullableFloatArray,
+      aNullableList,
+      aNullableMap,
+      nullableNestedList,
+      nullableMapWithAnnotations,
+      nullableMapWithObject,
+      aNullableEnum?.index,
+    ];
   }
 
-  static AllNullableTypes decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static AllNullableTypes decode(Object result) {
+    result as List<Object?>;
     return AllNullableTypes(
-      aNullableBool: pigeonMap['aNullableBool'] as bool?,
-      aNullableInt: pigeonMap['aNullableInt'] as int?,
-      aNullableDouble: pigeonMap['aNullableDouble'] as double?,
-      aNullableString: pigeonMap['aNullableString'] as String?,
-      aNullableByteArray: pigeonMap['aNullableByteArray'] as Uint8List?,
-      aNullable4ByteArray: pigeonMap['aNullable4ByteArray'] as Int32List?,
-      aNullable8ByteArray: pigeonMap['aNullable8ByteArray'] as Int64List?,
-      aNullableFloatArray: pigeonMap['aNullableFloatArray'] as Float64List?,
-      aNullableList: pigeonMap['aNullableList'] as List<Object?>?,
-      aNullableMap: pigeonMap['aNullableMap'] as Map<Object?, Object?>?,
-      nullableNestedList: (pigeonMap['nullableNestedList'] as List<Object?>?)
-          ?.cast<List<bool?>?>(),
+      aNullableBool: result[0] as bool?,
+      aNullableInt: result[1] as int?,
+      aNullableDouble: result[2] as double?,
+      aNullableString: result[3] as String?,
+      aNullableByteArray: result[4] as Uint8List?,
+      aNullable4ByteArray: result[5] as Int32List?,
+      aNullable8ByteArray: result[6] as Int64List?,
+      aNullableFloatArray: result[7] as Float64List?,
+      aNullableList: result[8] as List<Object?>?,
+      aNullableMap: result[9] as Map<Object?, Object?>?,
+      nullableNestedList: (result[10] as List<Object?>?)?.cast<List<bool?>?>(),
       nullableMapWithAnnotations:
-          (pigeonMap['nullableMapWithAnnotations'] as Map<Object?, Object?>?)
-              ?.cast<String?, String?>(),
+          (result[11] as Map<Object?, Object?>?)?.cast<String?, String?>(),
       nullableMapWithObject:
-          (pigeonMap['nullableMapWithObject'] as Map<Object?, Object?>?)
-              ?.cast<String?, Object?>(),
-      aNullableEnum: pigeonMap['aNullableEnum'] != null
-          ? AnEnum.values[pigeonMap['aNullableEnum']! as int]
-          : null,
+          (result[12] as Map<Object?, Object?>?)?.cast<String?, Object?>(),
+      aNullableEnum:
+          result[13] != null ? AnEnum.values[result[13]! as int] : null,
     );
   }
 }
@@ -166,15 +185,15 @@
   AllNullableTypes values;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['values'] = values.encode();
-    return pigeonMap;
+    return <Object?>[
+      values.encode(),
+    ];
   }
 
-  static AllNullableTypesWrapper decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static AllNullableTypesWrapper decode(Object result) {
+    result as List<Object?>;
     return AllNullableTypesWrapper(
-      values: AllNullableTypes.decode(pigeonMap['values']!),
+      values: AllNullableTypes.decode(result[0]! as List<Object?>),
     );
   }
 }
@@ -239,20 +258,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.noop', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
@@ -264,28 +280,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_everything]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_everything]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as AllTypes?)!;
+      return (replyList[0] as AllTypes?)!;
     }
   }
 
@@ -295,23 +309,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_everything]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_everything]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as AllNullableTypes?);
+      return (replyList[0] as AllNullableTypes?);
     }
   }
 
@@ -320,20 +332,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.throwError', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
@@ -345,28 +354,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoInt', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_anInt]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_anInt]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as int?)!;
+      return (replyList[0] as int?)!;
     }
   }
 
@@ -375,28 +382,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aDouble]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aDouble]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as double?)!;
+      return (replyList[0] as double?)!;
     }
   }
 
@@ -405,28 +410,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoBool', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aBool]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aBool]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as bool?)!;
+      return (replyList[0] as bool?)!;
     }
   }
 
@@ -435,28 +438,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoString', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as String?)!;
+      return (replyList[0] as String?)!;
     }
   }
 
@@ -465,28 +466,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aUint8List]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aUint8List]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as Uint8List?)!;
+      return (replyList[0] as Uint8List?)!;
     }
   }
 
@@ -498,23 +497,21 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_wrapper]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_wrapper]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as String?);
+      return (replyList[0] as String?);
     }
   }
 
@@ -526,28 +523,26 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_nullableString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_nullableString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as AllNullableTypesWrapper?)!;
+      return (replyList[0] as AllNullableTypesWrapper?)!;
     }
   }
 
@@ -558,29 +553,27 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel.send(
+    final List<Object?>? replyList = await channel.send(
             <Object?>[arg_aNullableBool, arg_aNullableInt, arg_aNullableString])
-        as Map<Object?, Object?>?;
-    if (replyMap == null) {
+        as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as AllNullableTypes?)!;
+      return (replyList[0] as AllNullableTypes?)!;
     }
   }
 
@@ -589,23 +582,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableInt]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableInt]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as int?);
+      return (replyList[0] as int?);
     }
   }
 
@@ -614,23 +605,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableDouble]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableDouble]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as double?);
+      return (replyList[0] as double?);
     }
   }
 
@@ -639,23 +628,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableBool]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableBool]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as bool?);
+      return (replyList[0] as bool?);
     }
   }
 
@@ -664,23 +651,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as String?);
+      return (replyList[0] as String?);
     }
   }
 
@@ -691,23 +676,21 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableUint8List]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableUint8List]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as Uint8List?);
+      return (replyList[0] as Uint8List?);
     }
   }
 
@@ -717,20 +700,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
@@ -742,28 +722,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as String?)!;
+      return (replyList[0] as String?)!;
     }
   }
 
@@ -771,20 +749,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
@@ -796,28 +771,26 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as String?)!;
+      return (replyList[0] as String?)!;
     }
   }
 }
@@ -869,6 +842,7 @@
 
   /// Returns the passed string, to test serialization and deserialization.
   String echoString(String aString);
+
   static void setup(FlutterIntegrationCoreApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
@@ -963,20 +937,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostTrivialApi.noop', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart
index de6fed0..a314567 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.2.7), do not edit directly.
+// Autogenerated from Pigeon (v4.2.11), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -25,28 +25,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.MultipleArityHostApi.subtract', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_x, arg_y]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_x, arg_y]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as int?)!;
+      return (replyList[0] as int?)!;
     }
   }
 }
@@ -55,6 +53,7 @@
   static const MessageCodec<Object?> codec = StandardMessageCodec();
 
   int subtract(int x, int y);
+
   static void setup(MultipleArityFlutterApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart
index 2c19540..0dafa68 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.2.7), do not edit directly.
+// Autogenerated from Pigeon (v4.2.11), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -24,15 +24,15 @@
   String query;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['query'] = query;
-    return pigeonMap;
+    return <Object?>[
+      query,
+    ];
   }
 
-  static NonNullFieldSearchRequest decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static NonNullFieldSearchRequest decode(Object result) {
+    result as List<Object?>;
     return NonNullFieldSearchRequest(
-      query: pigeonMap['query']! as String,
+      query: result[0]! as String,
     );
   }
 }
@@ -44,20 +44,21 @@
   });
 
   String detailA;
+
   String detailB;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['detailA'] = detailA;
-    pigeonMap['detailB'] = detailB;
-    return pigeonMap;
+    return <Object?>[
+      detailA,
+      detailB,
+    ];
   }
 
-  static ExtraData decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static ExtraData decode(Object result) {
+    result as List<Object?>;
     return ExtraData(
-      detailA: pigeonMap['detailA']! as String,
-      detailB: pigeonMap['detailB']! as String,
+      detailA: result[0]! as String,
+      detailB: result[1]! as String,
     );
   }
 }
@@ -72,29 +73,33 @@
   });
 
   String result;
+
   String error;
+
   List<int?> indices;
+
   ExtraData extraData;
+
   ReplyType type;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['result'] = result;
-    pigeonMap['error'] = error;
-    pigeonMap['indices'] = indices;
-    pigeonMap['extraData'] = extraData.encode();
-    pigeonMap['type'] = type.index;
-    return pigeonMap;
+    return <Object?>[
+      result,
+      error,
+      indices,
+      extraData.encode(),
+      type.index,
+    ];
   }
 
-  static NonNullFieldSearchReply decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static NonNullFieldSearchReply decode(Object result) {
+    result as List<Object?>;
     return NonNullFieldSearchReply(
-      result: pigeonMap['result']! as String,
-      error: pigeonMap['error']! as String,
-      indices: (pigeonMap['indices'] as List<Object?>?)!.cast<int?>(),
-      extraData: ExtraData.decode(pigeonMap['extraData']!),
-      type: ReplyType.values[pigeonMap['type']! as int],
+      result: result[0]! as String,
+      error: result[1]! as String,
+      indices: (result[2] as List<Object?>?)!.cast<int?>(),
+      extraData: ExtraData.decode(result[3]! as List<Object?>),
+      type: ReplyType.values[result[4]! as int],
     );
   }
 }
@@ -150,28 +155,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.NonNullFieldHostApi.search', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_nested]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_nested]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as NonNullFieldSearchReply?)!;
+      return (replyList[0] as NonNullFieldSearchReply?)!;
     }
   }
 }
@@ -216,6 +219,7 @@
   static const MessageCodec<Object?> codec = _NonNullFieldFlutterApiCodec();
 
   NonNullFieldSearchReply search(NonNullFieldSearchRequest request);
+
   static void setup(NonNullFieldFlutterApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart
index 6e26deb..94c9b86 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.2.7), do not edit directly.
+// Autogenerated from Pigeon (v4.2.11), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -23,20 +23,21 @@
   });
 
   String? query;
+
   int identifier;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['query'] = query;
-    pigeonMap['identifier'] = identifier;
-    return pigeonMap;
+    return <Object?>[
+      query,
+      identifier,
+    ];
   }
 
-  static NullFieldsSearchRequest decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static NullFieldsSearchRequest decode(Object result) {
+    result as List<Object?>;
     return NullFieldsSearchRequest(
-      query: pigeonMap['query'] as String?,
-      identifier: pigeonMap['identifier']! as int,
+      query: result[0] as String?,
+      identifier: result[1]! as int,
     );
   }
 }
@@ -51,32 +52,36 @@
   });
 
   String? result;
+
   String? error;
+
   List<int?>? indices;
+
   NullFieldsSearchRequest? request;
+
   NullFieldsSearchReplyType? type;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['result'] = result;
-    pigeonMap['error'] = error;
-    pigeonMap['indices'] = indices;
-    pigeonMap['request'] = request?.encode();
-    pigeonMap['type'] = type?.index;
-    return pigeonMap;
+    return <Object?>[
+      result,
+      error,
+      indices,
+      request?.encode(),
+      type?.index,
+    ];
   }
 
-  static NullFieldsSearchReply decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static NullFieldsSearchReply decode(Object result) {
+    result as List<Object?>;
     return NullFieldsSearchReply(
-      result: pigeonMap['result'] as String?,
-      error: pigeonMap['error'] as String?,
-      indices: (pigeonMap['indices'] as List<Object?>?)?.cast<int?>(),
-      request: pigeonMap['request'] != null
-          ? NullFieldsSearchRequest.decode(pigeonMap['request']!)
+      result: result[0] as String?,
+      error: result[1] as String?,
+      indices: (result[2] as List<Object?>?)?.cast<int?>(),
+      request: result[3] != null
+          ? NullFieldsSearchRequest.decode(result[3]! as List<Object?>)
           : null,
-      type: pigeonMap['type'] != null
-          ? NullFieldsSearchReplyType.values[pigeonMap['type']! as int]
+      type: result[4] != null
+          ? NullFieldsSearchReplyType.values[result[4]! as int]
           : null,
     );
   }
@@ -127,28 +132,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.NullFieldsHostApi.search', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_nested]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_nested]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as NullFieldsSearchReply?)!;
+      return (replyList[0] as NullFieldsSearchReply?)!;
     }
   }
 }
@@ -187,6 +190,7 @@
   static const MessageCodec<Object?> codec = _NullFieldsFlutterApiCodec();
 
   NullFieldsSearchReply search(NullFieldsSearchRequest request);
+
   static void setup(NullFieldsFlutterApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart
index f643345..f376a13 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.2.7), do not edit directly.
+// Autogenerated from Pigeon (v4.2.11), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -19,15 +19,15 @@
   String? query;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['query'] = query;
-    return pigeonMap;
+    return <Object?>[
+      query,
+    ];
   }
 
-  static FlutterSearchRequest decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static FlutterSearchRequest decode(Object result) {
+    result as List<Object?>;
     return FlutterSearchRequest(
-      query: pigeonMap['query'] as String?,
+      query: result[0] as String?,
     );
   }
 }
@@ -39,20 +39,21 @@
   });
 
   String? result;
+
   String? error;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['result'] = result;
-    pigeonMap['error'] = error;
-    return pigeonMap;
+    return <Object?>[
+      result,
+      error,
+    ];
   }
 
-  static FlutterSearchReply decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static FlutterSearchReply decode(Object result) {
+    result as List<Object?>;
     return FlutterSearchReply(
-      result: pigeonMap['result'] as String?,
-      error: pigeonMap['error'] as String?,
+      result: result[0] as String?,
+      error: result[1] as String?,
     );
   }
 }
@@ -65,15 +66,15 @@
   List<Object?>? requests;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['requests'] = requests;
-    return pigeonMap;
+    return <Object?>[
+      requests,
+    ];
   }
 
-  static FlutterSearchRequests decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static FlutterSearchRequests decode(Object result) {
+    result as List<Object?>;
     return FlutterSearchRequests(
-      requests: pigeonMap['requests'] as List<Object?>?,
+      requests: result[0] as List<Object?>?,
     );
   }
 }
@@ -86,15 +87,15 @@
   List<Object?>? replies;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['replies'] = replies;
-    return pigeonMap;
+    return <Object?>[
+      replies,
+    ];
   }
 
-  static FlutterSearchReplies decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static FlutterSearchReplies decode(Object result) {
+    result as List<Object?>;
     return FlutterSearchReplies(
-      replies: pigeonMap['replies'] as List<Object?>?,
+      replies: result[0] as List<Object?>?,
     );
   }
 }
@@ -154,28 +155,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.Api.search', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_request]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_request]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as FlutterSearchReply?)!;
+      return (replyList[0] as FlutterSearchReply?)!;
     }
   }
 
@@ -184,28 +183,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.Api.doSearches', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_request]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_request]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as FlutterSearchReplies?)!;
+      return (replyList[0] as FlutterSearchReplies?)!;
     }
   }
 
@@ -213,28 +210,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.Api.echo', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_requests]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_requests]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as FlutterSearchRequests?)!;
+      return (replyList[0] as FlutterSearchRequests?)!;
     }
   }
 
@@ -242,28 +237,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.Api.anInt', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as int?)!;
+      return (replyList[0] as int?)!;
     }
   }
 }
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart
index 90bda83..e880283 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.2.7), do not edit directly.
+// Autogenerated from Pigeon (v4.2.11), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -25,23 +25,20 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.NullableReturnHostApi.doit', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as int?);
+      return (replyList[0] as int?);
     }
   }
 }
@@ -50,6 +47,7 @@
   static const MessageCodec<Object?> codec = StandardMessageCodec();
 
   int? doit();
+
   static void setup(NullableReturnFlutterApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
@@ -83,28 +81,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.NullableArgHostApi.doit', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_x]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_x]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as int?)!;
+      return (replyList[0] as int?)!;
     }
   }
 }
@@ -113,6 +109,7 @@
   static const MessageCodec<Object?> codec = StandardMessageCodec();
 
   int doit(int? x);
+
   static void setup(NullableArgFlutterApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
@@ -149,23 +146,20 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.NullableCollectionReturnHostApi.doit', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as List<Object?>?)?.cast<String?>();
+      return (replyList[0] as List<Object?>?)?.cast<String?>();
     }
   }
 }
@@ -174,6 +168,7 @@
   static const MessageCodec<Object?> codec = StandardMessageCodec();
 
   List<String?>? doit();
+
   static void setup(NullableCollectionReturnFlutterApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
@@ -207,28 +202,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.NullableCollectionArgHostApi.doit', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_x]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_x]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as List<Object?>?)!.cast<String?>();
+      return (replyList[0] as List<Object?>?)!.cast<String?>();
     }
   }
 }
@@ -237,6 +230,7 @@
   static const MessageCodec<Object?> codec = StandardMessageCodec();
 
   List<String?> doit(List<String?>? x);
+
   static void setup(NullableCollectionArgFlutterApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart
index 02ad428..178e315 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.2.7), do not edit directly.
+// Autogenerated from Pigeon (v4.2.11), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -25,28 +25,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.PrimitiveHostApi.anInt', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as int?)!;
+      return (replyList[0] as int?)!;
     }
   }
 
@@ -54,28 +52,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.PrimitiveHostApi.aBool', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as bool?)!;
+      return (replyList[0] as bool?)!;
     }
   }
 
@@ -83,28 +79,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.PrimitiveHostApi.aString', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as String?)!;
+      return (replyList[0] as String?)!;
     }
   }
 
@@ -112,28 +106,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.PrimitiveHostApi.aDouble', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as double?)!;
+      return (replyList[0] as double?)!;
     }
   }
 
@@ -141,28 +133,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.PrimitiveHostApi.aMap', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as Map<Object?, Object?>?)!;
+      return (replyList[0] as Map<Object?, Object?>?)!;
     }
   }
 
@@ -170,28 +160,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.PrimitiveHostApi.aList', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as List<Object?>?)!;
+      return (replyList[0] as List<Object?>?)!;
     }
   }
 
@@ -199,28 +187,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.PrimitiveHostApi.anInt32List', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as Int32List?)!;
+      return (replyList[0] as Int32List?)!;
     }
   }
 
@@ -228,28 +214,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.PrimitiveHostApi.aBoolList', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as List<Object?>?)!.cast<bool?>();
+      return (replyList[0] as List<Object?>?)!.cast<bool?>();
     }
   }
 
@@ -257,29 +241,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.PrimitiveHostApi.aStringIntMap', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_value]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_value]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as Map<Object?, Object?>?)!
-          .cast<String?, int?>();
+      return (replyList[0] as Map<Object?, Object?>?)!.cast<String?, int?>();
     }
   }
 }
@@ -288,14 +269,23 @@
   static const MessageCodec<Object?> codec = StandardMessageCodec();
 
   int anInt(int value);
+
   bool aBool(bool value);
+
   String aString(String value);
+
   double aDouble(double value);
+
   Map<Object?, Object?> aMap(Map<Object?, Object?> value);
+
   List<Object?> aList(List<Object?> value);
+
   Int32List anInt32List(Int32List value);
+
   List<bool?> aBoolList(List<bool?> value);
+
   Map<String?, int?> aStringIntMap(Map<String?, int?> value);
+
   static void setup(PrimitiveFlutterApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.dart
index b0ea0b5..95b38ea 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.dart
@@ -21,8 +21,7 @@
       final List<Object?> args = input as List<Object?>;
       final int x = (args[0] as int?)!;
       final int y = (args[1] as int?)!;
-      return MultipleArityHostApi.codec
-          .encodeMessage(<String, Object>{'result': x - y});
+      return MultipleArityHostApi.codec.encodeMessage(<Object>[x - y]);
     });
 
     final MultipleArityHostApi api =
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart
index 7cb73be..ec75a8e 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart
@@ -44,36 +44,35 @@
 
   test('test request decode with values', () {
     final NullFieldsSearchRequest request =
-        NullFieldsSearchRequest.decode(<String, dynamic>{
-      'query': 'query',
-      'identifier': 1,
-    });
+        NullFieldsSearchRequest.decode(<dynamic>[
+      'query',
+      1,
+    ]);
 
     expect(request.query, 'query');
   });
 
   test('test request decode with null', () {
     final NullFieldsSearchRequest request =
-        NullFieldsSearchRequest.decode(<String, dynamic>{
-      'query': null,
-      'identifier': 1,
-    });
+        NullFieldsSearchRequest.decode(<dynamic>[
+      null,
+      1,
+    ]);
 
     expect(request.query, isNull);
   });
 
   test('test reply decode with values', () {
-    final NullFieldsSearchReply reply =
-        NullFieldsSearchReply.decode(<String, dynamic>{
-      'result': 'result',
-      'error': 'error',
-      'indices': <int>[1, 2, 3],
-      'request': <String, dynamic>{
-        'query': 'query',
-        'identifier': 1,
-      },
-      'type': NullFieldsSearchReplyType.success.index,
-    });
+    final NullFieldsSearchReply reply = NullFieldsSearchReply.decode(<dynamic>[
+      'result',
+      'error',
+      <int>[1, 2, 3],
+      <dynamic>[
+        'query',
+        1,
+      ],
+      NullFieldsSearchReplyType.success.index,
+    ]);
 
     expect(reply.result, 'result');
     expect(reply.error, 'error');
@@ -83,14 +82,13 @@
   });
 
   test('test reply decode with nulls', () {
-    final NullFieldsSearchReply reply =
-        NullFieldsSearchReply.decode(<String, dynamic>{
-      'result': null,
-      'error': null,
-      'indices': null,
-      'request': null,
-      'type': null,
-    });
+    final NullFieldsSearchReply reply = NullFieldsSearchReply.decode(<dynamic>[
+      null,
+      null,
+      null,
+      null,
+      null,
+    ]);
 
     expect(reply.result, isNull);
     expect(reply.error, isNull);
@@ -103,20 +101,20 @@
     final NullFieldsSearchRequest request =
         NullFieldsSearchRequest(query: 'query', identifier: 1);
 
-    expect(request.encode(), <String, dynamic>{
-      'query': 'query',
-      'identifier': 1,
-    });
+    expect(request.encode(), <Object?>[
+      'query',
+      1,
+    ]);
   });
 
   test('test request encode with null', () {
     final NullFieldsSearchRequest request =
         NullFieldsSearchRequest(identifier: 1);
 
-    expect(request.encode(), <String, dynamic>{
-      'query': null,
-      'identifier': 1,
-    });
+    expect(request.encode(), <Object?>[
+      null,
+      1,
+    ]);
   });
 
   test('test reply encode with values', () {
@@ -128,27 +126,27 @@
       type: NullFieldsSearchReplyType.success,
     );
 
-    expect(reply.encode(), <String, dynamic>{
-      'result': 'result',
-      'error': 'error',
-      'indices': <int>[1, 2, 3],
-      'request': <String, dynamic>{
-        'query': 'query',
-        'identifier': 1,
-      },
-      'type': NullFieldsSearchReplyType.success.index,
-    });
+    expect(reply.encode(), <Object?>[
+      'result',
+      'error',
+      <int>[1, 2, 3],
+      <Object?>[
+        'query',
+        1,
+      ],
+      NullFieldsSearchReplyType.success.index,
+    ]);
   });
 
   test('test reply encode with nulls', () {
     final NullFieldsSearchReply reply = NullFieldsSearchReply();
 
-    expect(reply.encode(), <String, dynamic>{
-      'result': null,
-      'error': null,
-      'indices': null,
-      'request': null,
-      'type': null,
-    });
+    expect(reply.encode(), <Object?>[
+      null,
+      null,
+      null,
+      null,
+      null,
+    ]);
   });
 }
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart
index 4d944a4..317bea9 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart
@@ -28,7 +28,7 @@
     final FlutterSearchReply reply = FlutterSearchReply()
       ..result = 'foo'
       ..error = 'bar';
-    final Object encoded = reply.encode();
+    final List<Object?> encoded = reply.encode() as List<Object?>;
     final FlutterSearchReply decoded = FlutterSearchReply.decode(encoded);
     expect(reply.result, decoded.result);
     expect(reply.error, decoded.error);
@@ -38,7 +38,7 @@
     final FlutterSearchReply reply = FlutterSearchReply()
       ..result = 'foo'
       ..error = null;
-    final Object encoded = reply.encode();
+    final List<Object?> encoded = reply.encode() as List<Object?>;
     final FlutterSearchReply decoded = FlutterSearchReply.decode(encoded);
     expect(reply.result, decoded.result);
     expect(reply.error, decoded.error);
@@ -49,8 +49,7 @@
     final FlutterSearchReply reply = FlutterSearchReply()..result = 'ho';
     final BinaryMessenger mockMessenger = MockBinaryMessenger();
     final Completer<ByteData?> completer = Completer<ByteData?>();
-    completer
-        .complete(Api.codec.encodeMessage(<String, Object>{'result': reply}));
+    completer.complete(Api.codec.encodeMessage(<Object>[reply]));
     final Future<ByteData?> sendResult = completer.future;
     when(mockMessenger.send('dev.flutter.pigeon.Api.search', any))
         .thenAnswer((Invocation realInvocation) => sendResult);
@@ -93,7 +92,7 @@
     const String channel = 'dev.flutter.pigeon.Api.anInt';
     when(mockMessenger.send(channel, any))
         .thenAnswer((Invocation realInvocation) async {
-      return Api.codec.encodeMessage(<String?, Object?>{'result': null});
+      return Api.codec.encodeMessage(<Object?>[null]);
     });
     final Api api = Api(binaryMessenger: mockMessenger);
     expect(() async => api.anInt(1),
@@ -105,7 +104,7 @@
     const String channel = 'dev.flutter.pigeon.NullableArgHostApi.doit';
     when(mockMessenger.send(channel, any))
         .thenAnswer((Invocation realInvocation) async {
-      return Api.codec.encodeMessage(<String?, Object?>{'result': 123});
+      return Api.codec.encodeMessage(<Object?>[123]);
     });
     final NullableArgHostApi api =
         NullableArgHostApi(binaryMessenger: mockMessenger);
@@ -118,9 +117,9 @@
         'dev.flutter.pigeon.NullableCollectionArgHostApi.doit';
     when(mockMessenger.send(channel, any))
         .thenAnswer((Invocation realInvocation) async {
-      return Api.codec.encodeMessage(<String?, Object?>{
-        'result': <String?>['123']
-      });
+      return Api.codec.encodeMessage(<Object?>[
+        <String?>['123']
+      ]);
     });
     final NullableCollectionArgHostApi api =
         NullableCollectionArgHostApi(binaryMessenger: mockMessenger);
@@ -182,8 +181,7 @@
     const String channel = 'dev.flutter.pigeon.NullableReturnHostApi.doit';
     when(mockMessenger.send(channel, any))
         .thenAnswer((Invocation realInvocation) async {
-      return NullableReturnHostApi.codec
-          .encodeMessage(<String?, Object?>{'result': null});
+      return NullableReturnHostApi.codec.encodeMessage(<Object?>[null]);
     });
     final NullableReturnHostApi api =
         NullableReturnHostApi(binaryMessenger: mockMessenger);
@@ -197,7 +195,7 @@
     when(mockMessenger.send(channel, any))
         .thenAnswer((Invocation realInvocation) async {
       return NullableCollectionReturnHostApi.codec
-          .encodeMessage(<String?, Object?>{'result': null});
+          .encodeMessage(<Object?>[null]);
     });
     final NullableCollectionReturnHostApi api =
         NullableCollectionReturnHostApi(binaryMessenger: mockMessenger);
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/test_util.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/test_util.dart
index ec695fc..a776c00 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/test_util.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/test_util.dart
@@ -15,6 +15,6 @@
     final Object input =
         codec.decodeMessage(realInvocation.positionalArguments[1])!;
     final List<Object?> args = input as List<Object?>;
-    return codec.encodeMessage(<String, Object>{'result': args[0]!});
+    return codec.encodeMessage(<Object>[args[0]!]);
   });
 }
diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Flutter/AppFrameworkInfo.plist b/packages/pigeon/platform_tests/ios_unit_tests/ios/Flutter/AppFrameworkInfo.plist
index f2872cf..4f8d4d2 100644
--- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Flutter/AppFrameworkInfo.plist
+++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
   <key>CFBundleVersion</key>
   <string>1.0</string>
   <key>MinimumOSVersion</key>
-  <string>9.0</string>
+  <string>11.0</string>
 </dict>
 </plist>
diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj
index 8122323..aa01ef9 100644
--- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj
+++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 46;
+	objectVersion = 54;
 	objects = {
 
 /* Begin PBXBuildFile section */
@@ -366,6 +366,7 @@
 /* Begin PBXShellScriptBuildPhase section */
 		3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
 			isa = PBXShellScriptBuildPhase;
+			alwaysOutOfDate = 1;
 			buildActionMask = 2147483647;
 			files = (
 			);
@@ -380,6 +381,7 @@
 		};
 		9740EEB61CF901F6004384FC /* Run Script */ = {
 			isa = PBXShellScriptBuildPhase;
+			alwaysOutOfDate = 1;
 			buildActionMask = 2147483647;
 			files = (
 			);
@@ -591,7 +593,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				SUPPORTED_PLATFORMS = iphoneos;
@@ -670,7 +672,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
@@ -719,7 +721,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				SUPPORTED_PLATFORMS = iphoneos;
diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/Info.plist b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/Info.plist
index db82370..83d9435 100644
--- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/Info.plist
+++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/Info.plist
@@ -43,5 +43,7 @@
 	<false/>
 	<key>CADisableMinimumFrameDurationOnPhone</key>
 	<true/>
+	<key>UIApplicationSupportsIndirectInputEvents</key>
+	<true/>
 </dict>
 </plist>
diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart
index 0484151..4ff2bc0 100644
--- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart
+++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// Autogenerated from Pigeon (v4.2.11), do not edit directly.
+// Autogenerated from Pigeon (v4.2.12), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 import 'dart:async';
@@ -33,47 +33,57 @@
   });
 
   bool aBool;
+
   int anInt;
+
   double aDouble;
+
   String aString;
+
   Uint8List aByteArray;
+
   Int32List a4ByteArray;
+
   Int64List a8ByteArray;
+
   Float64List aFloatArray;
+
   List<Object?> aList;
+
   Map<Object?, Object?> aMap;
+
   AnEnum anEnum;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['aBool'] = aBool;
-    pigeonMap['anInt'] = anInt;
-    pigeonMap['aDouble'] = aDouble;
-    pigeonMap['aString'] = aString;
-    pigeonMap['aByteArray'] = aByteArray;
-    pigeonMap['a4ByteArray'] = a4ByteArray;
-    pigeonMap['a8ByteArray'] = a8ByteArray;
-    pigeonMap['aFloatArray'] = aFloatArray;
-    pigeonMap['aList'] = aList;
-    pigeonMap['aMap'] = aMap;
-    pigeonMap['anEnum'] = anEnum.index;
-    return pigeonMap;
+    return <Object?>[
+      aBool,
+      anInt,
+      aDouble,
+      aString,
+      aByteArray,
+      a4ByteArray,
+      a8ByteArray,
+      aFloatArray,
+      aList,
+      aMap,
+      anEnum.index,
+    ];
   }
 
-  static AllTypes decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static AllTypes decode(Object result) {
+    result as List<Object?>;
     return AllTypes(
-      aBool: pigeonMap['aBool']! as bool,
-      anInt: pigeonMap['anInt']! as int,
-      aDouble: pigeonMap['aDouble']! as double,
-      aString: pigeonMap['aString']! as String,
-      aByteArray: pigeonMap['aByteArray']! as Uint8List,
-      a4ByteArray: pigeonMap['a4ByteArray']! as Int32List,
-      a8ByteArray: pigeonMap['a8ByteArray']! as Int64List,
-      aFloatArray: pigeonMap['aFloatArray']! as Float64List,
-      aList: pigeonMap['aList']! as List<Object?>,
-      aMap: pigeonMap['aMap']! as Map<Object?, Object?>,
-      anEnum: AnEnum.values[pigeonMap['anEnum']! as int],
+      aBool: result[0]! as bool,
+      anInt: result[1]! as int,
+      aDouble: result[2]! as double,
+      aString: result[3]! as String,
+      aByteArray: result[4]! as Uint8List,
+      a4ByteArray: result[5]! as Int32List,
+      a8ByteArray: result[6]! as Int64List,
+      aFloatArray: result[7]! as Float64List,
+      aList: result[8]! as List<Object?>,
+      aMap: result[9]! as Map<Object?, Object?>,
+      anEnum: AnEnum.values[result[10]! as int],
     );
   }
 }
@@ -97,63 +107,72 @@
   });
 
   bool? aNullableBool;
+
   int? aNullableInt;
+
   double? aNullableDouble;
+
   String? aNullableString;
+
   Uint8List? aNullableByteArray;
+
   Int32List? aNullable4ByteArray;
+
   Int64List? aNullable8ByteArray;
+
   Float64List? aNullableFloatArray;
+
   List<Object?>? aNullableList;
+
   Map<Object?, Object?>? aNullableMap;
+
   List<List<bool?>?>? nullableNestedList;
+
   Map<String?, String?>? nullableMapWithAnnotations;
+
   Map<String?, Object?>? nullableMapWithObject;
+
   AnEnum? aNullableEnum;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['aNullableBool'] = aNullableBool;
-    pigeonMap['aNullableInt'] = aNullableInt;
-    pigeonMap['aNullableDouble'] = aNullableDouble;
-    pigeonMap['aNullableString'] = aNullableString;
-    pigeonMap['aNullableByteArray'] = aNullableByteArray;
-    pigeonMap['aNullable4ByteArray'] = aNullable4ByteArray;
-    pigeonMap['aNullable8ByteArray'] = aNullable8ByteArray;
-    pigeonMap['aNullableFloatArray'] = aNullableFloatArray;
-    pigeonMap['aNullableList'] = aNullableList;
-    pigeonMap['aNullableMap'] = aNullableMap;
-    pigeonMap['nullableNestedList'] = nullableNestedList;
-    pigeonMap['nullableMapWithAnnotations'] = nullableMapWithAnnotations;
-    pigeonMap['nullableMapWithObject'] = nullableMapWithObject;
-    pigeonMap['aNullableEnum'] = aNullableEnum?.index;
-    return pigeonMap;
+    return <Object?>[
+      aNullableBool,
+      aNullableInt,
+      aNullableDouble,
+      aNullableString,
+      aNullableByteArray,
+      aNullable4ByteArray,
+      aNullable8ByteArray,
+      aNullableFloatArray,
+      aNullableList,
+      aNullableMap,
+      nullableNestedList,
+      nullableMapWithAnnotations,
+      nullableMapWithObject,
+      aNullableEnum?.index,
+    ];
   }
 
-  static AllNullableTypes decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static AllNullableTypes decode(Object result) {
+    result as List<Object?>;
     return AllNullableTypes(
-      aNullableBool: pigeonMap['aNullableBool'] as bool?,
-      aNullableInt: pigeonMap['aNullableInt'] as int?,
-      aNullableDouble: pigeonMap['aNullableDouble'] as double?,
-      aNullableString: pigeonMap['aNullableString'] as String?,
-      aNullableByteArray: pigeonMap['aNullableByteArray'] as Uint8List?,
-      aNullable4ByteArray: pigeonMap['aNullable4ByteArray'] as Int32List?,
-      aNullable8ByteArray: pigeonMap['aNullable8ByteArray'] as Int64List?,
-      aNullableFloatArray: pigeonMap['aNullableFloatArray'] as Float64List?,
-      aNullableList: pigeonMap['aNullableList'] as List<Object?>?,
-      aNullableMap: pigeonMap['aNullableMap'] as Map<Object?, Object?>?,
-      nullableNestedList: (pigeonMap['nullableNestedList'] as List<Object?>?)
-          ?.cast<List<bool?>?>(),
+      aNullableBool: result[0] as bool?,
+      aNullableInt: result[1] as int?,
+      aNullableDouble: result[2] as double?,
+      aNullableString: result[3] as String?,
+      aNullableByteArray: result[4] as Uint8List?,
+      aNullable4ByteArray: result[5] as Int32List?,
+      aNullable8ByteArray: result[6] as Int64List?,
+      aNullableFloatArray: result[7] as Float64List?,
+      aNullableList: result[8] as List<Object?>?,
+      aNullableMap: result[9] as Map<Object?, Object?>?,
+      nullableNestedList: (result[10] as List<Object?>?)?.cast<List<bool?>?>(),
       nullableMapWithAnnotations:
-          (pigeonMap['nullableMapWithAnnotations'] as Map<Object?, Object?>?)
-              ?.cast<String?, String?>(),
+          (result[11] as Map<Object?, Object?>?)?.cast<String?, String?>(),
       nullableMapWithObject:
-          (pigeonMap['nullableMapWithObject'] as Map<Object?, Object?>?)
-              ?.cast<String?, Object?>(),
-      aNullableEnum: pigeonMap['aNullableEnum'] != null
-          ? AnEnum.values[pigeonMap['aNullableEnum']! as int]
-          : null,
+          (result[12] as Map<Object?, Object?>?)?.cast<String?, Object?>(),
+      aNullableEnum:
+          result[13] != null ? AnEnum.values[result[13]! as int] : null,
     );
   }
 }
@@ -166,15 +185,15 @@
   AllNullableTypes values;
 
   Object encode() {
-    final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
-    pigeonMap['values'] = values.encode();
-    return pigeonMap;
+    return <Object?>[
+      values.encode(),
+    ];
   }
 
-  static AllNullableTypesWrapper decode(Object message) {
-    final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+  static AllNullableTypesWrapper decode(Object result) {
+    result as List<Object?>;
     return AllNullableTypesWrapper(
-      values: AllNullableTypes.decode(pigeonMap['values']!),
+      values: AllNullableTypes.decode(result[0]! as List<Object?>),
     );
   }
 }
@@ -239,20 +258,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.noop', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
@@ -264,28 +280,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_everything]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_everything]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as AllTypes?)!;
+      return (replyList[0] as AllTypes?)!;
     }
   }
 
@@ -295,23 +309,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_everything]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_everything]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as AllNullableTypes?);
+      return (replyList[0] as AllNullableTypes?);
     }
   }
 
@@ -320,20 +332,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.throwError', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
@@ -345,28 +354,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoInt', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_anInt]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_anInt]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as int?)!;
+      return (replyList[0] as int?)!;
     }
   }
 
@@ -375,28 +382,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aDouble]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aDouble]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as double?)!;
+      return (replyList[0] as double?)!;
     }
   }
 
@@ -405,28 +410,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoBool', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aBool]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aBool]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as bool?)!;
+      return (replyList[0] as bool?)!;
     }
   }
 
@@ -435,28 +438,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoString', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as String?)!;
+      return (replyList[0] as String?)!;
     }
   }
 
@@ -465,28 +466,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aUint8List]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aUint8List]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as Uint8List?)!;
+      return (replyList[0] as Uint8List?)!;
     }
   }
 
@@ -498,23 +497,21 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_wrapper]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_wrapper]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as String?);
+      return (replyList[0] as String?);
     }
   }
 
@@ -526,28 +523,26 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_nullableString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_nullableString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as AllNullableTypesWrapper?)!;
+      return (replyList[0] as AllNullableTypesWrapper?)!;
     }
   }
 
@@ -558,29 +553,27 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel.send(
+    final List<Object?>? replyList = await channel.send(
             <Object?>[arg_aNullableBool, arg_aNullableInt, arg_aNullableString])
-        as Map<Object?, Object?>?;
-    if (replyMap == null) {
+        as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as AllNullableTypes?)!;
+      return (replyList[0] as AllNullableTypes?)!;
     }
   }
 
@@ -589,23 +582,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableInt]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableInt]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as int?);
+      return (replyList[0] as int?);
     }
   }
 
@@ -614,23 +605,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableDouble]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableDouble]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as double?);
+      return (replyList[0] as double?);
     }
   }
 
@@ -639,23 +628,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableBool]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableBool]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as bool?);
+      return (replyList[0] as bool?);
     }
   }
 
@@ -664,23 +651,21 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as String?);
+      return (replyList[0] as String?);
     }
   }
 
@@ -691,23 +676,21 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap = await channel
-        .send(<Object?>[arg_aNullableUint8List]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aNullableUint8List]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
-      return (replyMap['result'] as Uint8List?);
+      return (replyList[0] as Uint8List?);
     }
   }
 
@@ -717,20 +700,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
@@ -742,28 +722,26 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as String?)!;
+      return (replyList[0] as String?)!;
     }
   }
 
@@ -771,20 +749,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
@@ -796,28 +771,26 @@
         'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString',
         codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(<Object?>[arg_aString]) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList =
+        await channel.send(<Object?>[arg_aString]) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
-    } else if (replyMap['result'] == null) {
+    } else if (replyList[0] == null) {
       throw PlatformException(
         code: 'null-error',
         message: 'Host platform returned null value for non-null return value.',
       );
     } else {
-      return (replyMap['result'] as String?)!;
+      return (replyList[0] as String?)!;
     }
   }
 }
@@ -869,6 +842,7 @@
 
   /// Returns the passed string, to test serialization and deserialization.
   String echoString(String aString);
+
   static void setup(FlutterIntegrationCoreApi? api,
       {BinaryMessenger? binaryMessenger}) {
     {
@@ -963,20 +937,17 @@
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
         'dev.flutter.pigeon.HostTrivialApi.noop', codec,
         binaryMessenger: _binaryMessenger);
-    final Map<Object?, Object?>? replyMap =
-        await channel.send(null) as Map<Object?, Object?>?;
-    if (replyMap == null) {
+    final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
+    if (replyList == null) {
       throw PlatformException(
         code: 'channel-error',
         message: 'Unable to establish connection on channel.',
       );
-    } else if (replyMap['error'] != null) {
-      final Map<Object?, Object?> error =
-          (replyMap['error'] as Map<Object?, Object?>?)!;
+    } else if (replyList.length > 1) {
       throw PlatformException(
-        code: (error['code'] as String?)!,
-        message: error['message'] as String?,
-        details: error['details'],
+        code: replyList[0]! as String,
+        message: replyList[1] as String?,
+        details: replyList[2],
       );
     } else {
       return;
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AllDatatypesTest.kt b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AllDatatypesTest.kt
index ceba13b..9f42e1e 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AllDatatypesTest.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AllDatatypesTest.kt
@@ -101,11 +101,14 @@
     @Test
     fun testIntegerToLong() {
         val everything = AllNullableTypes(aNullableInt = 123L)
-        val map = everything.toMap()
-        assertTrue(map.containsKey("aNullableInt"))
+        val list = everything.toList()
+        assertNotNull(list)
+        assertNull(list.first())
+        assertNotNull(list[1])
+        assertTrue(list[1] == 123L)
 
-        val map2 = hashMapOf("aNullableInt" to 123)
-        val everything2 = AllNullableTypes.fromMap(map2)
+        val list2 = listOf(null, 123, null, null, null, null, null, null, null, null, null, null, null, null)
+        val everything2 = AllNullableTypes.fromList(list2)
 
         assertEquals(everything.aNullableInt, everything2.aNullableInt)
     }
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AsyncHandlersTest.kt b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AsyncHandlersTest.kt
index 5a12c20..668e3d7 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AsyncHandlersTest.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AsyncHandlersTest.kt
@@ -70,10 +70,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as MutableList<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(output, wrapped["result"])
+                assertEquals(output, wrapped.first())
             }
         }
 
@@ -104,7 +104,7 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as MutableList<Any>?
             assertNull(wrapped)
         }
 
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/EnumTest.kt b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/EnumTest.kt
index a0cf3f9..205f90a 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/EnumTest.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/EnumTest.kt
@@ -36,11 +36,11 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertTrue(wrapped.containsKey("result"))
-                assertEquals(input, wrapped["result"])
+                assertNotNull(wrapped[0])
+                assertEquals(input, wrapped[0])
             }
         }
 
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/MultipleArityTests.kt b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/MultipleArityTests.kt
index bbb1e6c..55ff163 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/MultipleArityTests.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/MultipleArityTests.kt
@@ -36,10 +36,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(inputX - inputY, wrapped["result"])
+                assertEquals(inputX - inputY, wrapped[0])
             }
         }
     }
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/NullableReturnsTest.kt b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/NullableReturnsTest.kt
index 7bb1474..14e09af 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/NullableReturnsTest.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/NullableReturnsTest.kt
@@ -34,10 +34,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(output, wrapped["result"])
+                assertEquals(output, wrapped[0])
             }
         }
 
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/PrimitiveTest.kt b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/PrimitiveTest.kt
index c79adbe..4deb327 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/PrimitiveTest.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/PrimitiveTest.kt
@@ -36,10 +36,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(input.toLong(), wrapped["result"])
+                assertEquals(input.toLong(), wrapped[0])
             }
         }
 
@@ -84,10 +84,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(input, wrapped["result"])
+                assertEquals(input, wrapped[0])
             }
         }
 
@@ -132,10 +132,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(input, wrapped["result"])
+                assertEquals(input, wrapped[0])
             }
         }
 
@@ -164,10 +164,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(input, wrapped["result"])
+                assertEquals(input, wrapped[0])
             }
         }
 
@@ -212,10 +212,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(input, wrapped["result"])
+                assertEquals(input, wrapped[0])
             }
         }
 
@@ -260,10 +260,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(input, wrapped["result"])
+                assertEquals(input, wrapped[0])
             }
         }
 
@@ -308,10 +308,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertTrue(input.contentEquals(wrapped["result"] as IntArray))
+                assertTrue(input.contentEquals(wrapped[0] as IntArray))
             }
         }
 
@@ -356,10 +356,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(input, wrapped["result"])
+                assertEquals(input, wrapped[0])
             }
         }
 
@@ -404,10 +404,10 @@
         handlerSlot.captured.onMessage(message) {
             it?.rewind()
             @Suppress("UNCHECKED_CAST")
-            val wrapped = codec.decodeMessage(it) as HashMap<String, Any>?
+            val wrapped = codec.decodeMessage(it) as List<Any>?
             assertNotNull(wrapped)
             wrapped?.let {
-                assertEquals(input, wrapped["result"])
+                assertEquals(input, wrapped[0])
             }
         }
 
diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift
index 817e04e..a5a4ae7 100644
--- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift
+++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift
@@ -1,7 +1,6 @@
 // Copyright 2013 The Flutter Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
-
 import XCTest
 @testable import test_plugin
 
@@ -43,9 +42,8 @@
 
     let expectation = XCTestExpectation(description: "voidvoid callback")
     binaryMessenger.handlers[channelName]?(nil) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
-      XCTAssertEqual(outputMap?["result"] as! NSNull, NSNull())
-      XCTAssertNil(outputMap?["error"])
+      let outputList = binaryMessenger.codec.decode(data) as? [Any]
+        XCTAssertEqual(outputList?.first as! NSNull, NSNull())
       expectation.fulfill()
     }
     wait(for: [expectation], timeout: 1.0)
@@ -64,8 +62,8 @@
 
     let expectation = XCTestExpectation(description: "calculate callback")
     binaryMessenger.handlers[channelName]?(inputEncoded) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
-      let output = outputMap?["result"] as? Value
+      let outputList = binaryMessenger.codec.decode(data) as? [Any]
+        let output = outputList?.first as? Value
       XCTAssertEqual(output?.number, 2)
       expectation.fulfill()
     }
diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift
index cc789c6..0247f88 100644
--- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift
+++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift
@@ -30,12 +30,12 @@
 
     let expectation = XCTestExpectation(description: "echo")
     binaryMessenger.handlers[channelName]?(inputEncoded) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
+      let outputMap = binaryMessenger.codec.decode(data) as? [Any]
       XCTAssertNotNil(outputMap)
-
-      let output = outputMap?["result"] as? DataWithEnum
+      
+      let output = outputMap?.first as? DataWithEnum
       XCTAssertEqual(output, input)
-      XCTAssertNil(outputMap?["error"])
+      XCTAssertTrue(outputMap?.count == 1)
       expectation.fulfill()
     }
     wait(for: [expectation], timeout: 1.0)
diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift
index adf3182..6aead9f 100644
--- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift
+++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift
@@ -26,12 +26,12 @@
 
     let expectation = XCTestExpectation(description: "subtraction")
     binaryMessenger.handlers[channelName]?(inputEncoded) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
-      XCTAssertNotNil(outputMap)
-
-      let output = outputMap!["result"] as? Int32
+      let outputList = binaryMessenger.codec.decode(data) as? [Any]
+      XCTAssertNotNil(outputList)
+      
+      let output = outputList![0] as? Int32
       XCTAssertEqual(3, output)
-      XCTAssertNil(outputMap?["error"])
+        XCTAssertTrue(outputList?.count == 1)
       expectation.fulfill()
     }
     wait(for: [expectation], timeout: 1.0)
diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift
index 7740ada..2734f3c 100644
--- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift
+++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift
@@ -32,12 +32,12 @@
 
     let expectation = XCTestExpectation(description: "anInt")
     binaryMessenger.handlers[channelName]?(inputEncoded) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
-      XCTAssertNotNil(outputMap)
-
-      let output = outputMap!["result"] as? Int32
+      let outputList = binaryMessenger.codec.decode(data) as? [Any]
+      XCTAssertNotNil(outputList)
+      
+      let output = outputList!.first as? Int32
       XCTAssertEqual(1, output)
-      XCTAssertNil(outputMap?["error"])
+      XCTAssertTrue(outputList!.count == 1)
       expectation.fulfill()
     }
     wait(for: [expectation], timeout: 1.0)
@@ -66,12 +66,12 @@
 
     let expectation = XCTestExpectation(description: "aBool")
     binaryMessenger.handlers[channelName]?(inputEncoded) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
-      XCTAssertNotNil(outputMap)
-
-      let output = outputMap!["result"] as? Bool
+      let outputList = binaryMessenger.codec.decode(data) as? [Any]
+      XCTAssertNotNil(outputList)
+      
+      let output = outputList!.first as? Bool
       XCTAssertEqual(true, output)
-      XCTAssertNil(outputMap?["error"])
+      XCTAssertTrue(outputList!.count == 1)
       expectation.fulfill()
     }
     wait(for: [expectation], timeout: 1.0)
@@ -100,12 +100,12 @@
 
     let expectation = XCTestExpectation(description: "aDouble")
     binaryMessenger.handlers[channelName]?(inputEncoded) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
-      XCTAssertNotNil(outputMap)
-
-      let output = outputMap!["result"] as? Double
+      let outputList = binaryMessenger.codec.decode(data) as? [Any]
+      XCTAssertNotNil(outputList)
+      
+      let output = outputList!.first as? Double
       XCTAssertEqual(1.0, output)
-      XCTAssertNil(outputMap?["error"])
+      XCTAssertTrue(outputList!.count == 1)
       expectation.fulfill()
     }
     wait(for: [expectation], timeout: 1.0)
@@ -135,12 +135,12 @@
 
     let expectation = XCTestExpectation(description: "aString")
     binaryMessenger.handlers[channelName]?(inputEncoded) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
-      XCTAssertNotNil(outputMap)
-
-      let output = outputMap!["result"] as? String
+      let outputList = binaryMessenger.codec.decode(data) as? [Any]
+      XCTAssertNotNil(outputList)
+      
+      let output = outputList!.first as? String
       XCTAssertEqual("hello", output)
-      XCTAssertNil(outputMap?["error"])
+      XCTAssertTrue(outputList!.count == 1)
       expectation.fulfill()
     }
     wait(for: [expectation], timeout: 1.0)
@@ -170,12 +170,12 @@
 
     let expectation = XCTestExpectation(description: "aList")
     binaryMessenger.handlers[channelName]?(inputEncoded) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
-      XCTAssertNotNil(outputMap)
-
-      let output = outputMap!["result"] as? [Int]
+      let outputList = binaryMessenger.codec.decode(data) as? [Any]
+      XCTAssertNotNil(outputList)
+      
+      let output = outputList!.first as? [Int]
       XCTAssertEqual([1, 2, 3], output)
-      XCTAssertNil(outputMap?["error"])
+      XCTAssertTrue(outputList!.count == 1)
       expectation.fulfill()
     }
     wait(for: [expectation], timeout: 1.0)
@@ -205,12 +205,12 @@
 
     let expectation = XCTestExpectation(description: "aMap")
     binaryMessenger.handlers[channelName]?(inputEncoded) { data in
-      let outputMap = binaryMessenger.codec.decode(data) as? [String: Any]
-      XCTAssertNotNil(outputMap)
+      let output = binaryMessenger.codec.decode(data) as? [Any]
+      XCTAssertTrue(output?.count == 1)
 
-      let output = outputMap!["result"] as? [String: Int]
-      XCTAssertEqual(["hello": 1, "world": 2], output)
-      XCTAssertNil(outputMap?["error"])
+      let outputMap = output?.first as? [String: Int]
+      XCTAssertNotNil(outputMap)
+      XCTAssertEqual(["hello": 1, "world": 2], outputMap)
       expectation.fulfill()
     }
     wait(for: [expectation], timeout: 1.0)
diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/RunnerTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/RunnerTests.swift
index ed59c9c..4cbd6b0 100644
--- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/RunnerTests.swift
+++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/RunnerTests.swift
@@ -6,25 +6,25 @@
 @testable import test_plugin
 
 class RunnerTests: XCTestCase {
-
-  func testToMapAndBack() throws {
+  
+  func testToListAndBack() throws {
     let reply = MessageSearchReply(result: "foobar")
-    let dict = reply.toMap()
-    let copy = MessageSearchReply.fromMap(dict)
+    let dict = reply.toList()
+    let copy = MessageSearchReply.fromList(dict)
     XCTAssertEqual(reply.result, copy?.result)
   }
 
   func testHandlesNull() throws {
     let reply = MessageSearchReply()
-    let dict = reply.toMap()
-    let copy = MessageSearchReply.fromMap(dict)
+    let dict = reply.toList()
+    let copy = MessageSearchReply.fromList(dict)
     XCTAssertNil(copy?.result)
   }
 
   func testHandlesNullFirst() throws {
     let reply = MessageSearchReply(error: "foobar")
-    let dict = reply.toMap()
-    let copy = MessageSearchReply.fromMap(dict)
+    let dict = reply.toList()
+    let copy = MessageSearchReply.fromList(dict)
     XCTAssertEqual(reply.error, copy?.error)
   }
 }
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/test/multiple_arity_test.cpp b/packages/pigeon/platform_tests/test_plugin/windows/test/multiple_arity_test.cpp
index 7577afd..fc48a81 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/test/multiple_arity_test.cpp
+++ b/packages/pigeon/platform_tests/test_plugin/windows/test/multiple_arity_test.cpp
@@ -25,7 +25,7 @@
 };
 
 const EncodableValue& GetResult(const EncodableValue& pigeon_response) {
-  return std::get<EncodableMap>(pigeon_response).at(EncodableValue("result"));
+  return std::get<EncodableList>(pigeon_response)[0];
 }
 }  // namespace
 
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/test/null_fields_test.cpp b/packages/pigeon/platform_tests/test_plugin/windows/test/null_fields_test.cpp
index 22a42e7..3e6a542 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/test/null_fields_test.cpp
+++ b/packages/pigeon/platform_tests/test_plugin/windows/test/null_fields_test.cpp
@@ -15,20 +15,21 @@
 using flutter::EncodableMap;
 using flutter::EncodableValue;
 
-// EXPECTs that 'map' contains 'key', and then returns a pointer to its value.
-//
-// This gives useful test failure messages instead of silent crashes when the
-// value isn't present, or has the wrong type.
+/// EXPECTs that 'list' contains 'index', and then returns a pointer to its
+/// value.
+///
+/// This gives useful test failure messages instead of silent crashes when the
+/// value isn't present, or has the wrong type.
 template <class T>
-const T* ExpectAndGet(const EncodableMap& map, const std::string& key) {
-  auto it = map.find(EncodableValue(key));
-  EXPECT_TRUE(it != map.end()) << "Could not find value for '" << key << '"';
-  if (it == map.end()) {
+const T* ExpectAndGetIndex(const EncodableList& list, const int i) {
+  EXPECT_LT(i, list.size())
+      << "Index " << i << " is out of bounds; size is " << list.size();
+  if (i >= list.size()) {
     return nullptr;
   }
-  const T* value_ptr = std::get_if<T>(&(it->second));
+  const T* value_ptr = std::get_if<T>(&(list[i]));
   EXPECT_NE(value_ptr, nullptr)
-      << "Value for '" << key << "' has incorrect type";
+      << "Value for index " << i << " has incorrect type";
   return value_ptr;
 }
 
@@ -36,22 +37,22 @@
 
 class NullFieldsTest : public ::testing::Test {
  protected:
-  // Wrapper for access to private NullFieldsSearchRequest map constructor.
-  NullFieldsSearchRequest RequestFromMap(const EncodableMap& map) {
-    return NullFieldsSearchRequest(map);
+  // Wrapper for access to private NullFieldsSearchRequest list constructor.
+  NullFieldsSearchRequest RequestFromList(const EncodableList& list) {
+    return NullFieldsSearchRequest(list);
   }
 
-  // Wrapper for access to private NullFieldsSearchRequest map constructor.
-  NullFieldsSearchReply ReplyFromMap(const EncodableMap& map) {
-    return NullFieldsSearchReply(map);
+  // Wrapper for access to private NullFieldsSearchRequest list constructor.
+  NullFieldsSearchReply ReplyFromList(const EncodableList& list) {
+    return NullFieldsSearchReply(list);
   }
-  // Wrapper for access to private NullFieldsSearchRequest::ToEncodableMap.
-  EncodableMap MapFromRequest(const NullFieldsSearchRequest& request) {
-    return request.ToEncodableMap();
+  // Wrapper for access to private NullFieldsSearchRequest::ToEncodableList.
+  EncodableList ListFromRequest(const NullFieldsSearchRequest& request) {
+    return request.ToEncodableList();
   }
-  // Wrapper for access to private NullFieldsSearchRequest map constructor.
-  EncodableMap MapFromReply(const NullFieldsSearchReply& reply) {
-    return reply.ToEncodableMap();
+  // Wrapper for access to private NullFieldsSearchRequest list constructor.
+  EncodableList ListFromReply(const NullFieldsSearchReply& reply) {
+    return reply.ToEncodableList();
   }
 };
 
@@ -89,45 +90,44 @@
   EXPECT_EQ(reply.type(), nullptr);
 }
 
-TEST_F(NullFieldsTest, RequestFromMapWithValues) {
-  EncodableMap map{
-      {EncodableValue("query"), EncodableValue("hello")},
-      {EncodableValue("identifier"), EncodableValue(1)},
+TEST_F(NullFieldsTest, RequestFromListWithValues) {
+  EncodableList list{
+      EncodableValue("hello"),
+      EncodableValue(1),
   };
-  NullFieldsSearchRequest request = RequestFromMap(map);
+  NullFieldsSearchRequest request = RequestFromList(list);
 
   EXPECT_EQ(*request.query(), "hello");
   EXPECT_EQ(request.identifier(), 1);
 }
 
-TEST_F(NullFieldsTest, RequestFromMapWithNulls) {
-  EncodableMap map{
-      {EncodableValue("query"), EncodableValue()},
-      {EncodableValue("identifier"), EncodableValue(1)},
+TEST_F(NullFieldsTest, RequestFromListWithNulls) {
+  EncodableList list{
+      EncodableValue(),
+      EncodableValue(1),
   };
-  NullFieldsSearchRequest request = RequestFromMap(map);
+  NullFieldsSearchRequest request = RequestFromList(list);
 
   EXPECT_EQ(request.query(), nullptr);
   EXPECT_EQ(request.identifier(), 1);
 }
 
-TEST_F(NullFieldsTest, ReplyFromMapWithValues) {
-  EncodableMap map{
-      {EncodableValue("result"), EncodableValue("result")},
-      {EncodableValue("error"), EncodableValue("error")},
-      {EncodableValue("indices"), EncodableValue(EncodableList{
-                                      EncodableValue(1),
-                                      EncodableValue(2),
-                                      EncodableValue(3),
-                                  })},
-      {EncodableValue("request"),
-       EncodableValue(EncodableMap{
-           {EncodableValue("query"), EncodableValue("hello")},
-           {EncodableValue("identifier"), EncodableValue(1)},
-       })},
-      {EncodableValue("type"), EncodableValue(0)},
+TEST_F(NullFieldsTest, ReplyFromListWithValues) {
+  EncodableList list{
+      EncodableValue("result"),
+      EncodableValue("error"),
+      EncodableValue(EncodableList{
+          EncodableValue(1),
+          EncodableValue(2),
+          EncodableValue(3),
+      }),
+      EncodableValue(EncodableList{
+          EncodableValue("hello"),
+          EncodableValue(1),
+      }),
+      EncodableValue(0),
   };
-  NullFieldsSearchReply reply = ReplyFromMap(map);
+  NullFieldsSearchReply reply = ReplyFromList(list);
 
   EXPECT_EQ(*reply.result(), "result");
   EXPECT_EQ(*reply.error(), "error");
@@ -137,15 +137,12 @@
   EXPECT_EQ(*reply.type(), NullFieldsSearchReplyType::success);
 }
 
-TEST_F(NullFieldsTest, ReplyFromMapWithNulls) {
-  EncodableMap map{
-      {EncodableValue("result"), EncodableValue()},
-      {EncodableValue("error"), EncodableValue()},
-      {EncodableValue("indices"), EncodableValue()},
-      {EncodableValue("request"), EncodableValue()},
-      {EncodableValue("type"), EncodableValue()},
+TEST_F(NullFieldsTest, ReplyFromListWithNulls) {
+  EncodableList list{
+      EncodableValue(), EncodableValue(), EncodableValue(),
+      EncodableValue(), EncodableValue(),
   };
-  NullFieldsSearchReply reply = ReplyFromMap(map);
+  NullFieldsSearchReply reply = ReplyFromList(list);
 
   EXPECT_EQ(reply.result(), nullptr);
   EXPECT_EQ(reply.error(), nullptr);
@@ -154,16 +151,17 @@
   EXPECT_EQ(reply.type(), nullptr);
 }
 
-TEST_F(NullFieldsTest, RequestToMapWithValues) {
+TEST_F(NullFieldsTest, RequestToListWithValues) {
   NullFieldsSearchRequest request;
   request.set_query("hello");
   request.set_identifier(1);
 
-  EncodableMap map = MapFromRequest(request);
+  EncodableList list = ListFromRequest(request);
 
-  EXPECT_EQ(map.size(), 2);
-  EXPECT_EQ(*ExpectAndGet<std::string>(map, "query"), "hello");
-  EXPECT_EQ(*ExpectAndGet<int64_t>(map, "identifier"), 1);
+  EXPECT_EQ(list.size(), 2);
+
+  EXPECT_EQ(*ExpectAndGetIndex<std::string>(list, 0), "hello");
+  EXPECT_EQ(*ExpectAndGetIndex<int64_t>(list, 1), 1);
 }
 
 TEST_F(NullFieldsTest, RequestToMapWithNulls) {
@@ -171,16 +169,17 @@
   // TODO(gaaclarke): This needs a way to be enforced.
   request.set_identifier(1);
 
-  EncodableMap map = MapFromRequest(request);
+  EncodableList list = ListFromRequest(request);
 
-  EXPECT_EQ(map.size(), 2);
-  EXPECT_TRUE(map[EncodableValue("hello")].IsNull());
-  EXPECT_EQ(*ExpectAndGet<int64_t>(map, "identifier"), 1);
+  EXPECT_EQ(list.size(), 2);
+  EXPECT_TRUE(list[0].IsNull());
+  EXPECT_EQ(*ExpectAndGetIndex<int64_t>(list, 1), 1);
 }
 
 TEST_F(NullFieldsTest, ReplyToMapWithValues) {
   NullFieldsSearchRequest request;
   request.set_query("hello");
+  request.set_identifier(1);
 
   NullFieldsSearchReply reply;
   reply.set_result("result");
@@ -189,32 +188,32 @@
   reply.set_request(request);
   reply.set_type(NullFieldsSearchReplyType::success);
 
-  EncodableMap map = MapFromReply(reply);
+  const EncodableList list = ListFromReply(reply);
 
-  EXPECT_EQ(map.size(), 5);
-  EXPECT_EQ(*ExpectAndGet<std::string>(map, "result"), "result");
-  EXPECT_EQ(*ExpectAndGet<std::string>(map, "error"), "error");
-  const EncodableList& indices = *ExpectAndGet<EncodableList>(map, "indices");
+  EXPECT_EQ(list.size(), 5);
+  EXPECT_EQ(*ExpectAndGetIndex<std::string>(list, 0), "result");
+  EXPECT_EQ(*ExpectAndGetIndex<std::string>(list, 1), "error");
+  const EncodableList& indices = *ExpectAndGetIndex<EncodableList>(list, 2);
   EXPECT_EQ(indices.size(), 3);
   EXPECT_EQ(indices[0].LongValue(), 1L);
   EXPECT_EQ(indices[1].LongValue(), 2L);
   EXPECT_EQ(indices[2].LongValue(), 3L);
-  const EncodableMap& request_map = *ExpectAndGet<EncodableMap>(map, "request");
-  EXPECT_EQ(*ExpectAndGet<std::string>(request_map, "query"), "hello");
-  EXPECT_EQ(*ExpectAndGet<int>(map, "type"), 0);
+  const EncodableList& request_list =
+      *ExpectAndGetIndex<EncodableList>(list, 3);
+  EXPECT_EQ(*ExpectAndGetIndex<std::string>(request_list, 0), "hello");
+  EXPECT_EQ(*ExpectAndGetIndex<int64_t>(request_list, 1), 1);
 }
 
-TEST_F(NullFieldsTest, ReplyToMapWithNulls) {
+TEST_F(NullFieldsTest, ReplyToListWithNulls) {
   NullFieldsSearchReply reply;
 
-  EncodableMap map = MapFromReply(reply);
+  const EncodableList list = ListFromReply(reply);
 
-  EXPECT_EQ(map.size(), 5);
-  EXPECT_TRUE(map[EncodableValue("result")].IsNull());
-  EXPECT_TRUE(map[EncodableValue("error")].IsNull());
-  EXPECT_TRUE(map[EncodableValue("indices")].IsNull());
-  EXPECT_TRUE(map[EncodableValue("request")].IsNull());
-  EXPECT_TRUE(map[EncodableValue("type")].IsNull());
+  const int field_count = 5;
+  EXPECT_EQ(list.size(), field_count);
+  for (int i = 0; i < field_count; ++i) {
+    EXPECT_TRUE(list[i].IsNull());
+  }
 }
 
 }  // namespace null_fields_pigeontest
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/test/nullable_returns_test.cpp b/packages/pigeon/platform_tests/test_plugin/windows/test/nullable_returns_test.cpp
index 356ff44..821df75 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/test/nullable_returns_test.cpp
+++ b/packages/pigeon/platform_tests/test_plugin/windows/test/nullable_returns_test.cpp
@@ -42,7 +42,7 @@
 };
 
 const EncodableValue& GetResult(const EncodableValue& pigeon_response) {
-  return std::get<EncodableMap>(pigeon_response).at(EncodableValue("result"));
+  return std::get<EncodableList>(pigeon_response)[0];
 }
 }  // namespace
 
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/test/primitive_test.cpp b/packages/pigeon/platform_tests/test_plugin/windows/test/primitive_test.cpp
index 782575a..518c539 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/test/primitive_test.cpp
+++ b/packages/pigeon/platform_tests/test_plugin/windows/test/primitive_test.cpp
@@ -50,7 +50,7 @@
 };
 
 const EncodableValue& GetResult(const EncodableValue& pigeon_response) {
-  return std::get<EncodableMap>(pigeon_response).at(EncodableValue("result"));
+  return std::get<EncodableList>(pigeon_response)[0];
 }
 }  // namespace
 
diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml
index 24bc2af..cb8f5f4 100644
--- a/packages/pigeon/pubspec.yaml
+++ b/packages/pigeon/pubspec.yaml
@@ -2,7 +2,7 @@
 description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
 repository: https://github.com/flutter/packages/tree/main/packages/pigeon
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon
-version: 4.2.11 # This must match the version in lib/generator_tools.dart
+version: 4.2.12 # This must match the version in lib/generator_tools.dart
 
 environment:
   sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/pigeon/test/cpp_generator_test.dart b/packages/pigeon/test/cpp_generator_test.dart
index d4816c8..4d7c218 100644
--- a/packages/pigeon/test/cpp_generator_test.dart
+++ b/packages/pigeon/test/cpp_generator_test.dart
@@ -457,14 +457,13 @@
       // Serialization handles optionals.
       expect(
           code,
-          contains('{flutter::EncodableValue("nullableBool"), '
-              'nullable_bool_ ? flutter::EncodableValue(*nullable_bool_) '
-              ': flutter::EncodableValue()}'));
+          contains('nullable_bool_ ? flutter::EncodableValue(*nullable_bool_) '
+              ': flutter::EncodableValue()'));
       expect(
           code,
-          contains('{flutter::EncodableValue("nullableNested"), '
-              'nullable_nested_ ? nullable_nested_->ToEncodableMap() '
-              ': flutter::EncodableValue()}'));
+          contains(
+              'nullable_nested_ ? flutter::EncodableValue(nullable_nested_->ToEncodableList()) '
+              ': flutter::EncodableValue()'));
     }
   });
 
@@ -560,14 +559,8 @@
       expect(code, contains('non_nullable_string_ = value_arg;'));
       expect(code, contains('non_nullable_nested_ = value_arg;'));
       // Serialization uses the value directly.
-      expect(
-          code,
-          contains('{flutter::EncodableValue("nonNullableBool"), '
-              'flutter::EncodableValue(non_nullable_bool_)}'));
-      expect(
-          code,
-          contains('{flutter::EncodableValue("nonNullableNested"), '
-              'non_nullable_nested_.ToEncodableMap()}'));
+      expect(code, contains('flutter::EncodableValue(non_nullable_bool_)'));
+      expect(code, contains('non_nullable_nested_.ToEncodableList()'));
     }
   });
 
diff --git a/packages/pigeon/test/dart_generator_test.dart b/packages/pigeon/test/dart_generator_test.dart
index da1875e..f56fe0a 100644
--- a/packages/pigeon/test/dart_generator_test.dart
+++ b/packages/pigeon/test/dart_generator_test.dart
@@ -187,13 +187,13 @@
     expect(
       code,
       contains(
-        "pigeonMap['nested'] = nested?.encode()",
+        'nested?.encode(),',
       ),
     );
     expect(
       code.replaceAll('\n', ' ').replaceAll('  ', ''),
       contains(
-        "nested: pigeonMap['nested'] != null ? Input.decode(pigeonMap['nested']!) : null",
+        'nested: result[0] != null ? Input.decode(result[0]! as List<Object?>) : null',
       ),
     );
   });
@@ -229,13 +229,13 @@
     expect(
       code,
       contains(
-        "pigeonMap['nested'] = nested.encode()",
+        'nested.encode(),',
       ),
     );
     expect(
       code.replaceAll('\n', ' ').replaceAll('  ', ''),
       contains(
-        "nested: Input.decode(pigeonMap['nested']!)",
+        'nested: Input.decode(result[0]! as List<Object?>)',
       ),
     );
   });
@@ -417,8 +417,8 @@
     final StringBuffer sink = StringBuffer();
     generateDart(const DartOptions(), root, sink);
     final String code = sink.toString();
-    expect(code, contains("pigeonMap['enum1'] = enum1?.index;"));
-    expect(code, contains("? Enum.values[pigeonMap['enum1']! as int]"));
+    expect(code, contains('enum1?.index,'));
+    expect(code, contains('? Enum.values[result[0]! as int]'));
     expect(code, contains('EnumClass doSomething(EnumClass arg0);'));
   });
 
@@ -484,8 +484,8 @@
     final StringBuffer sink = StringBuffer();
     generateDart(const DartOptions(), root, sink);
     final String code = sink.toString();
-    expect(code, contains("pigeonMap['enum1'] = enum1.index;"));
-    expect(code, contains("enum1: Enum.values[pigeonMap['enum1']! as int]"));
+    expect(code, contains('enum1.index,'));
+    expect(code, contains('enum1: Enum.values[result[0]! as int]'));
   });
 
   test('host void argument', () {
@@ -574,7 +574,7 @@
     expect(mainCode, isNot(contains('abstract class ApiMock')));
     expect(mainCode, isNot(contains('.ApiMock.doSomething')));
     expect(mainCode, isNot(contains("'${Keys.result}': output")));
-    expect(mainCode, isNot(contains('return <Object, Object>{};')));
+    expect(mainCode, isNot(contains('return <Object>[];')));
     generateTestDart(
       const DartOptions(),
       root,
@@ -587,8 +587,8 @@
     expect(testCode, isNot(contains('class Api {')));
     expect(testCode, contains('abstract class ApiMock'));
     expect(testCode, isNot(contains('.ApiMock.doSomething')));
-    expect(testCode, contains("'${Keys.result}': output"));
-    expect(testCode, contains('return <Object?, Object?>{};'));
+    expect(testCode, contains('output'));
+    expect(testCode, contains('return <Object?>[];'));
   });
 
   test('gen one async Flutter Api', () {
@@ -896,10 +896,8 @@
     generateDart(const DartOptions(), root, sink);
     final String code = sink.toString();
     expect(code, contains('Future<List<int?>> doit('));
-    expect(
-        code,
-        contains(
-            "return (replyMap['result'] as List<Object?>?)!.cast<int?>();"));
+    expect(code,
+        contains('return (replyList[0] as List<Object?>?)!.cast<int?>();'));
   });
 
   test('flutter generics argument non void return', () {
@@ -960,7 +958,7 @@
     generateDart(const DartOptions(), root, sink);
     final String code = sink.toString();
     expect(code, contains('Future<int?> doit()'));
-    expect(code, contains("return (replyMap['result'] as int?);"));
+    expect(code, contains('return (replyList[0] as int?);'));
   });
 
   test('return nullable collection host', () {
@@ -985,10 +983,8 @@
     generateDart(const DartOptions(), root, sink);
     final String code = sink.toString();
     expect(code, contains('Future<List<int?>?> doit()'));
-    expect(
-        code,
-        contains(
-            "return (replyMap['result'] as List<Object?>?)?.cast<int?>();"));
+    expect(code,
+        contains('return (replyList[0] as List<Object?>?)?.cast<int?>();'));
   });
 
   test('return nullable async host', () {
@@ -1012,7 +1008,7 @@
     generateDart(const DartOptions(), root, sink);
     final String code = sink.toString();
     expect(code, contains('Future<int?> doit()'));
-    expect(code, contains("return (replyMap['result'] as int?);"));
+    expect(code, contains('return (replyList[0] as int?);'));
   });
 
   test('return nullable flutter', () {
diff --git a/packages/pigeon/test/java_generator_test.dart b/packages/pigeon/test/java_generator_test.dart
index c621006..b9b5214 100644
--- a/packages/pigeon/test/java_generator_test.dart
+++ b/packages/pigeon/test/java_generator_test.dart
@@ -36,7 +36,7 @@
     expect(
         code,
         contains(
-            '@NonNull private static Map<String, Object> wrapError(@NonNull Throwable exception)'));
+            '@NonNull private static ArrayList<Object> wrapError(@NonNull Throwable exception)'));
   });
 
   test('gen one enum', () {
@@ -89,7 +89,7 @@
     generateJava(javaOptions, root, sink);
     final String code = sink.toString();
     expect(code, contains('package com.google.foobar;'));
-    expect(code, contains('Map<String, Object> toMap()'));
+    expect(code, contains('ArrayList<Object> toList()'));
   });
 
   test('gen one host api', () {
@@ -453,10 +453,11 @@
     expect(code, contains('public static class Outer'));
     expect(code, contains('public static class Nested'));
     expect(code, contains('private @Nullable Nested nested;'));
-    expect(code,
-        contains('(nested == null) ? null : Nested.fromMap((Map)nested)'));
-    expect(code,
-        contains('put("nested", (nested == null) ? null : nested.toMap());'));
+    expect(
+        code,
+        contains(
+            '(nested == null) ? null : Nested.fromList((ArrayList<Object>)nested)'));
+    expect(code, contains('add((nested == null) ? null : nested.toList());'));
   });
 
   test('gen one async Host Api', () {
@@ -591,10 +592,8 @@
     expect(code, contains('private Enum1(final int index) {'));
     expect(code, contains('      this.index = index;'));
 
-    expect(
-        code,
-        contains(
-            'toMapResult.put("enum1", enum1 == null ? null : enum1.index);'));
+    expect(code,
+        contains('toListResult.add(enum1 == null ? null : enum1.index);'));
     expect(
         code,
         contains(
diff --git a/packages/pigeon/test/kotlin_generator_test.dart b/packages/pigeon/test/kotlin_generator_test.dart
index 9a347d7..4ed3a6c 100644
--- a/packages/pigeon/test/kotlin_generator_test.dart
+++ b/packages/pigeon/test/kotlin_generator_test.dart
@@ -31,8 +31,8 @@
     final String code = sink.toString();
     expect(code, contains('data class Foobar ('));
     expect(code, contains('val field1: Long? = null'));
-    expect(code, contains('fun fromMap(map: Map<String, Any?>): Foobar'));
-    expect(code, contains('fun toMap(): Map<String, Any?>'));
+    expect(code, contains('fun fromList(list: List<Any?>): Foobar'));
+    expect(code, contains('fun toList(): List<Any?>'));
   });
 
   test('gen one enum', () {
@@ -129,13 +129,13 @@
     expect(code, contains('''
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            val wrapped = hashMapOf<String, Any?>()
+            var wrapped = listOf<Any?>()
             try {
               val args = message as List<Any?>
               val inputArg = args[0] as Input
-              wrapped["result"] = api.doSomething(inputArg)
+              wrapped = listOf<Any?>(api.doSomething(inputArg))
             } catch (exception: Error) {
-              wrapped["error"] = wrapError(exception)
+              wrapped = wrapError(exception)
             }
             reply.reply(wrapped)
           }
@@ -367,8 +367,8 @@
     generateKotlin(kotlinOptions, root, sink);
     final String code = sink.toString();
     expect(code, contains('fun doSomething(): Output'));
-    expect(code, contains('wrapped["result"] = api.doSomething()'));
-    expect(code, contains('wrapped["error"] = wrapError(exception)'));
+    expect(code, contains('wrapped = listOf<Any?>(api.doSomething())'));
+    expect(code, contains('wrapped = wrapError(exception)'));
     expect(code, contains('reply(wrapped)'));
   });
 
@@ -478,13 +478,11 @@
     expect(code, contains('data class Outer'));
     expect(code, contains('data class Nested'));
     expect(code, contains('val nested: Nested? = null'));
-    expect(code, contains('fun fromMap(map: Map<String, Any?>): Outer'));
+    expect(code, contains('fun fromList(list: List<Any?>): Outer'));
     expect(
-        code,
-        contains(
-            'val nested: Nested? = (map["nested"] as? Map<String, Any?>)?.let'));
-    expect(code, contains('Nested.fromMap(it)'));
-    expect(code, contains('fun toMap(): Map<String, Any?>'));
+        code, contains('val nested: Nested? = (list[0] as? List<Any?>)?.let'));
+    expect(code, contains('Nested.fromList(it)'));
+    expect(code, contains('fun toList(): List<Any?>'));
   });
 
   test('gen one async Host Api', () {
@@ -771,7 +769,7 @@
     generateKotlin(kotlinOptions, root, sink);
     final String code = sink.toString();
     expect(code, contains('fun doit(): List<Long?>'));
-    expect(code, contains('wrapped["result"] = api.doit()'));
+    expect(code, contains('wrapped = listOf<Any?>(api.doit())'));
     expect(code, contains('reply.reply(wrapped)'));
   });
 
@@ -835,7 +833,7 @@
         code,
         contains(
             'val yArg = args[1].let { if (it is Int) it.toLong() else it as Long }'));
-    expect(code, contains('wrapped["result"] = api.add(xArg, yArg)'));
+    expect(code, contains('wrapped = listOf<Any?>(api.add(xArg, yArg))'));
     expect(code, contains('reply.reply(wrapped)'));
   });
 
diff --git a/packages/pigeon/test/objc_generator_test.dart b/packages/pigeon/test/objc_generator_test.dart
index 0a56629..fef4641 100644
--- a/packages/pigeon/test/objc_generator_test.dart
+++ b/packages/pigeon/test/objc_generator_test.dart
@@ -110,7 +110,7 @@
     expect(
         code,
         contains(
-            'pigeonResult.enum1 = [GetNullableObject(dict, @"enum1") integerValue];'));
+            'pigeonResult.enum1 = [GetNullableObjectAtIndex(list, 1) integerValue];'));
   });
 
   test('primitive enum host', () {
@@ -348,7 +348,7 @@
     final String code = sink.toString();
     expect(code, contains('@implementation Foobar'));
     expect(code,
-        contains('pigeonResult.aBool = GetNullableObject(dict, @"aBool");'));
+        contains('pigeonResult.aBool = GetNullableObjectAtIndex(list, 0);'));
   });
 
   test('nested class header', () {
@@ -390,8 +390,9 @@
     expect(
         code,
         contains(
-            'pigeonResult.nested = [Input nullableFromMap:GetNullableObject(dict, @"nested")];'));
-    expect(code, matches('[self.nested toMap].*@"nested"'));
+            'pigeonResult.nested = [Input nullableFromList:(GetNullableObjectAtIndex(list, 0))];'));
+    expect(
+        code, contains('self.nested ? [self.nested toList] : [NSNull null]'));
   });
 
   test('prefix class header', () {
@@ -489,7 +490,7 @@
     final StringBuffer sink = StringBuffer();
     generateObjcSource(const ObjcOptions(prefix: 'ABC'), root, sink);
     final String code = sink.toString();
-    expect(code, contains('ABCInput fromMap'));
+    expect(code, contains('ABCInput fromList'));
     expect(code, matches(r'ABCInput.*=.*args.*0.*\;'));
     expect(code, contains('void ABCApiSetup('));
   });
diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart
index cda0f48..1ba2fde 100644
--- a/packages/pigeon/test/swift_generator_test.dart
+++ b/packages/pigeon/test/swift_generator_test.dart
@@ -30,9 +30,8 @@
     final String code = sink.toString();
     expect(code, contains('struct Foobar'));
     expect(code, contains('var field1: Int32? = nil'));
-    expect(code,
-        contains('static func fromMap(_ map: [String: Any?]) -> Foobar?'));
-    expect(code, contains('func toMap() -> [String: Any?]'));
+    expect(code, contains('static func fromList(_ list: [Any?]) -> Foobar?'));
+    expect(code, contains('func toList() -> [Any?]'));
   });
 
   test('gen one enum', () {
@@ -436,10 +435,9 @@
     expect(code, contains('struct Outer'));
     expect(code, contains('struct Nested'));
     expect(code, contains('var nested: Nested? = nil'));
-    expect(
-        code, contains('static func fromMap(_ map: [String: Any?]) -> Outer?'));
-    expect(code, contains('nested = Nested.fromMap(nestedMap)'));
-    expect(code, contains('func toMap() -> [String: Any?]'));
+    expect(code, contains('static func fromList(_ list: [Any?]) -> Outer?'));
+    expect(code, contains('nested = Nested.fromList(nestedList)'));
+    expect(code, contains('func toList() -> [Any?]'));
   });
 
   test('gen one async Host Api', () {