[pigeon] Enable warnings as errors for remaining languages (#3317)

[pigeon] Enable warnings as errors for remaining languages
diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md
index dc35906..4e59439 100644
--- a/packages/pigeon/CHANGELOG.md
+++ b/packages/pigeon/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 9.0.3
+
+* [kotlin] Fixes compiler warnings in generated output.
+* [swift] Fixes compiler warnings in generated output.
+
 ## 9.0.2
 
 * [swift] Removes safe casting from decode process.
diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart
index b7f3b24..0f7c50f 100644
--- a/packages/pigeon/lib/generator_tools.dart
+++ b/packages/pigeon/lib/generator_tools.dart
@@ -11,7 +11,7 @@
 /// The current version of pigeon.
 ///
 /// This must match the version in pubspec.yaml.
-const String pigeonVersion = '9.0.2';
+const String pigeonVersion = '9.0.3';
 
 /// Read all the content from [stdin] to a String.
 String readStdin() {
diff --git a/packages/pigeon/lib/java_generator.dart b/packages/pigeon/lib/java_generator.dart
index 4d348a3..18677b3 100644
--- a/packages/pigeon/lib/java_generator.dart
+++ b/packages/pigeon/lib/java_generator.dart
@@ -458,7 +458,7 @@
                       '$returnType $output = channelReply == null ? null : ((Number) channelReply).longValue();');
                 } else {
                   indent.writeln(
-                      '$returnType $output = ($returnType) channelReply;');
+                      '$returnType $output = ${_cast('channelReply', javaType: returnType)};');
                 }
                 indent.writeln('callback.reply($output);');
               });
@@ -627,8 +627,8 @@
                   String accessor = 'args.get($index)';
                   if (isEnum(root, arg.type)) {
                     accessor = _intToEnum(accessor, arg.type.baseName);
-                  } else if (argType != 'Object') {
-                    accessor = '($argType) $accessor';
+                  } else {
+                    accessor = _cast(accessor, javaType: argType);
                   }
                   indent.writeln('$argType $argName = $accessor;');
                   if (!arg.type.isNullable) {
@@ -646,7 +646,7 @@
                     method.returnType.isVoid ? 'null' : 'result';
                 const String resultName = 'resultCallback';
                 indent.format('''
-Result<$returnType> $resultName = 
+Result<$returnType> $resultName =
 \t\tnew Result<$returnType>() {
 \t\t\tpublic void success($returnType result) {
 \t\t\t\twrapped.add(0, $resultValue);
@@ -871,6 +871,13 @@
   return '$nullSafe${_javaTypeForDartType(type)}';
 }
 
+/// Returns an expression to cast [variable] to [javaType].
+String _cast(String variable, {required String javaType}) {
+  // Special-case Object, since casting to Object doesn't do anything, and
+  // causes a warning.
+  return javaType == 'Object' ? variable : '($javaType) $variable';
+}
+
 /// Casts variable named [varName] to the correct host datatype for [field].
 /// This is for use in codecs where we may have a map representation of an
 /// object.
@@ -884,6 +891,6 @@
       classes.map((Class x) => x.name).contains(field.type.baseName)) {
     return '($varName == null) ? null : ${hostDatatype.datatype}.fromList((ArrayList<Object>) $varName)';
   } else {
-    return '(${hostDatatype.datatype}) $varName';
+    return _cast(varName, javaType: hostDatatype.datatype);
   }
 }
diff --git a/packages/pigeon/lib/kotlin_generator.dart b/packages/pigeon/lib/kotlin_generator.dart
index b775b39..68584ae 100644
--- a/packages/pigeon/lib/kotlin_generator.dart
+++ b/packages/pigeon/lib/kotlin_generator.dart
@@ -180,12 +180,13 @@
           final HostDatatype hostDatatype = _getHostDatatype(root, field);
           String toWriteValue = '';
           final String fieldName = field.name;
+          final String safeCall = field.type.isNullable ? '?' : '';
           if (!hostDatatype.isBuiltin &&
               customClassNames.contains(field.type.baseName)) {
-            toWriteValue = '$fieldName?.toList()';
+            toWriteValue = '$fieldName$safeCall.toList()';
           } else if (!hostDatatype.isBuiltin &&
               customEnumNames.contains(field.type.baseName)) {
-            toWriteValue = '$fieldName?.raw';
+            toWriteValue = '$fieldName$safeCall.raw';
           } else {
             toWriteValue = fieldName;
           }
@@ -244,7 +245,8 @@
               indent.addln(
                   '.let { if (it is Int) it.toLong() else it as Long? }');
             } else {
-              indent.writeln('val ${field.name} = $listValue as $fieldType?');
+              indent.writeln(
+                  'val ${field.name} = ${_cast(listValue, kotlinType: '$fieldType?')}');
             }
           } else {
             if (!hostDatatype.isBuiltin &&
@@ -260,7 +262,8 @@
               indent
                   .addln('.let { if (it is Int) it.toLong() else it as Long }');
             } else {
-              indent.writeln('val ${field.name} = $listValue as $fieldType');
+              indent.writeln(
+                  'val ${field.name} = ${_cast(listValue, kotlinType: fieldType)}');
             }
           }
         });
@@ -380,13 +383,15 @@
               indent.writeln('callback()');
             });
           } else {
-            final String forceUnwrap = func.returnType.isNullable ? '?' : '';
             indent.addScoped('{', '}', () {
               if (func.returnType.baseName == 'int') {
+                final String forceUnwrap =
+                    func.returnType.isNullable ? '?' : '';
                 indent.writeln(
                     'val result = if (it is Int) it.toLong() else it as$forceUnwrap Long');
               } else {
-                indent.writeln('val result = it as$forceUnwrap $returnType');
+                indent.writeln(
+                    'val result = ${_cast('it', kotlinType: returnType, safeCast: func.returnType.isNullable)}');
               }
               indent.writeln('callback(result)');
             });
@@ -507,7 +512,6 @@
 
                 indent.write('channel.setMessageHandler ');
                 indent.addScoped('{ $messageVarName, reply ->', '}', () {
-                  indent.writeln('var wrapped = listOf<Any?>()');
                   final List<String> methodArguments = <String>[];
                   if (method.arguments.isNotEmpty) {
                     indent.writeln('val args = message as List<Any?>');
@@ -543,6 +547,7 @@
                       });
                     });
                   } else {
+                    indent.writeln('var wrapped: List<Any?>');
                     indent.write('try ');
                     indent.addScoped('{', '}', () {
                       if (method.returnType.isVoid) {
@@ -669,15 +674,15 @@
         type.isNullable ? '$value == null ? null : ' : '';
     return '$nullableConditionPrefix${_kotlinTypeForDartType(type)}.ofRaw($value as Int)$forceUnwrap';
   } else {
-    final String castUnwrap = type.isNullable ? '?' : '';
-
     // The StandardMessageCodec can give us [Integer, Long] for
     // a Dart 'int'.  To keep things simple we just use 64bit
     // longs in Pigeon with Kotlin.
     if (type.baseName == 'int') {
+      final String castUnwrap = type.isNullable ? '?' : '';
       return '$value.let { if (it is Int) it.toLong() else it as$castUnwrap Long }';
     } else {
-      return '$value as$castUnwrap ${_kotlinTypeForDartType(type)}';
+      return _cast(value,
+          kotlinType: _kotlinTypeForDartType(type), safeCast: type.isNullable);
     }
   }
 }
@@ -741,3 +746,13 @@
   final String nullSafe = type.isNullable ? '?' : '';
   return '${_kotlinTypeForDartType(type)}$nullSafe';
 }
+
+/// Returns an expression to cast [variable] to [kotlinType].
+String _cast(String variable,
+    {required String kotlinType, bool safeCast = false}) {
+  // Special-case Any, since no-op casts cause warnings.
+  if (kotlinType == 'Any?' || (safeCast && kotlinType == 'Any')) {
+    return variable;
+  }
+  return '$variable as${safeCast ? '?' : ''} $kotlinType';
+}
diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart
index 71699ed..d804f6b 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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
 
diff --git a/packages/pigeon/mock_handler_tester/test/test.dart b/packages/pigeon/mock_handler_tester/test/test.dart
index 88c1c1e..22d29c6 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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
diff --git a/packages/pigeon/pigeons/android_unittests.dart b/packages/pigeon/pigeons/android_unittests.dart
deleted file mode 100644
index 45ecf19..0000000
--- a/packages/pigeon/pigeons/android_unittests.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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 'package:pigeon/pigeon.dart';
-
-enum AndroidLoadingState {
-  loading,
-  complete,
-}
-
-class AndroidSetRequest {
-  int? value;
-  AndroidLoadingState? state;
-}
-
-class AndroidNestedRequest {
-  String? context;
-  AndroidSetRequest? request;
-}
-
-@HostApi()
-abstract class AndroidApi {
-  void setValue(AndroidSetRequest request);
-}
-
-@HostApi()
-abstract class AndroidNestedApi {
-  void setValueWithContext(AndroidNestedRequest request);
-}
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle
index 5b8124b..ae0feab 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle
@@ -50,3 +50,7 @@
         testImplementation "org.mockito:mockito-core:5.+"
     }
 }
+
+project.getTasks().withType(JavaCompile){
+    options.compilerArgs.addAll(["-Xlint:all", "-Werror"])
+}
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java
index 4cf7c13..1659070 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java
@@ -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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 package com.example.alternate_language_test_plugin;
@@ -3239,7 +3239,7 @@
           null,
           channelReply -> {
             @SuppressWarnings("ConstantConditions")
-            Object output = (Object) channelReply;
+            Object output = channelReply;
             callback.reply(output);
           });
     }
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 61324c1..e2d6414 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
@@ -26,6 +26,7 @@
               ByteBuffer message = invocation.getArgument(1);
               BinaryMessenger.BinaryReply reply = invocation.getArgument(2);
               message.position(0);
+              @SuppressWarnings("unchecked")
               ArrayList<Object> args =
                   (ArrayList<Object>) FlutterIntegrationCoreApi.getCodec().decodeMessage(message);
               ByteBuffer replyData =
@@ -101,6 +102,7 @@
               ByteBuffer message = invocation.getArgument(1);
               BinaryMessenger.BinaryReply reply = invocation.getArgument(2);
               message.position(0);
+              @SuppressWarnings("unchecked")
               ArrayList<Object> args =
                   (ArrayList<Object>) FlutterIntegrationCoreApi.getCodec().decodeMessage(message);
               ByteBuffer replyData =
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 e5e7953..2434910 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
@@ -61,7 +61,7 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes);
+              ArrayList<Object> wrapped = (ArrayList<Object>) codec.decodeMessage(bytes);
               assertTrue(wrapped.size() == 1);
               didCall[0] = true;
             });
@@ -88,7 +88,7 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes);
+              ArrayList<Object> wrapped = (ArrayList<Object>) codec.decodeMessage(bytes);
               assertTrue(wrapped.size() > 1);
               assertEquals("java.lang.Exception: error", (String) wrapped.get(0));
               didCall[0] = true;
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 37ecef9..9594f57 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,7 +28,9 @@
               ByteBuffer message = invocation.getArgument(1);
               BinaryMessenger.BinaryReply reply = invocation.getArgument(2);
               message.position(0);
-              ArrayList args = (ArrayList) FlutterSmallApi.getCodec().decodeMessage(message);
+              @SuppressWarnings("unchecked")
+              ArrayList<Object> args =
+                  (ArrayList<Object>) FlutterSmallApi.getCodec().decodeMessage(message);
               ByteBuffer replyData = FlutterSmallApi.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/MultipleArityTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/MultipleArityTest.java
index ff6e24d..36f172a 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/MultipleArityTest.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/MultipleArityTest.java
@@ -22,6 +22,7 @@
               ByteBuffer message = invocation.getArgument(1);
               BinaryMessenger.BinaryReply reply = invocation.getArgument(2);
               message.position(0);
+              @SuppressWarnings("unchecked")
               ArrayList<Object> args =
                   (ArrayList<Object>) MultipleArityFlutterApi.getCodec().decodeMessage(message);
               Long arg0 = (Long) args.get(0);
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 041a83b..640a8ef 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
@@ -39,7 +39,7 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes);
+              ArrayList<Object> wrapped = (ArrayList<Object>) codec.decodeMessage(bytes);
               assertTrue(wrapped.size() == 1);
             });
   }
@@ -52,8 +52,9 @@
               ByteBuffer message = invocation.getArgument(1);
               BinaryMessenger.BinaryReply reply = invocation.getArgument(2);
               message.position(0);
-              ArrayList args =
-                  (ArrayList)
+              @SuppressWarnings("unchecked")
+              ArrayList<Object> args =
+                  (ArrayList<Object>)
                       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 865d4ef..e03ad37 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
@@ -46,7 +46,7 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              ArrayList error = (ArrayList) codec.decodeMessage(bytes);
+              ArrayList<Object> error = (ArrayList<Object>) codec.decodeMessage(bytes);
               assertNotNull(error.get(0));
               assertNotNull(error.get(1));
               String details = (String) error.get(2);
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 772b869..186d80b 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,7 +28,9 @@
               ByteBuffer message = invocation.getArgument(1);
               BinaryMessenger.BinaryReply reply = invocation.getArgument(2);
               message.position(0);
-              ArrayList args = (ArrayList) PrimitiveFlutterApi.getCodec().decodeMessage(message);
+              @SuppressWarnings("unchecked")
+              ArrayList<Object> args =
+                  (ArrayList<Object>) PrimitiveFlutterApi.getCodec().decodeMessage(message);
               Object arg = args.get(0);
               if (arg instanceof Long) {
                 Long longArg = (Long) arg;
@@ -88,7 +90,7 @@
         .setMessageHandler(eq("dev.flutter.pigeon.PrimitiveHostApi.anInt"), handler.capture());
     MessageCodec<Object> codec = PrimitiveHostApi.getCodec();
     @SuppressWarnings("unchecked")
-    ByteBuffer message = codec.encodeMessage(new ArrayList(Arrays.asList((Integer) 1)));
+    ByteBuffer message = codec.encodeMessage(new ArrayList<Object>(Arrays.asList((Integer) 1)));
     message.rewind();
     handler
         .getValue()
@@ -97,7 +99,7 @@
             (bytes) -> {
               bytes.rewind();
               @SuppressWarnings("unchecked")
-              ArrayList wrapped = (ArrayList) codec.decodeMessage(bytes);
+              ArrayList<Object> wrapped = (ArrayList<Object>) 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/Podfile b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Podfile
index 0a6a379..b17aced 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Podfile
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Podfile
@@ -38,5 +38,9 @@
 post_install do |installer|
   installer.pods_project.targets.each do |target|
     flutter_additional_ios_build_settings(target)
+
+    target.build_configurations.each do |config|
+      config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'
+    end
   end
 end
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h
index 61dc902..5a1498d 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h
@@ -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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 #import <Foundation/Foundation.h>
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m
index 64681f9..dbbf7d4 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m
@@ -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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 #import "CoreTests.gen.h"
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 5e38b60..9e2d981 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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
 
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart
index 16d1967..de1af35 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
 
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 103dd5b..6613c48 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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
 
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 061ee32..dc1170a 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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
 
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 7d7f337..30d4dca 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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
 
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 8a09cb3..c879370 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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
 
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart
index c6189e3..f36ecfc 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
 
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 5e38b60..9e2d981 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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), 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
 
diff --git a/packages/pigeon/platform_tests/test_plugin/android/build.gradle b/packages/pigeon/platform_tests/test_plugin/android/build.gradle
index 0bc44b2..6fe19e8 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/build.gradle
+++ b/packages/pigeon/platform_tests/test_plugin/android/build.gradle
@@ -34,6 +34,7 @@
 
     kotlinOptions {
         jvmTarget = '1.8'
+        allWarningsAsErrors = true
     }
 
     sourceSets {
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt
index 032f6da..3f4f25a 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt
@@ -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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 package com.example.test_plugin
@@ -82,7 +82,7 @@
       aFloatArray,
       aList,
       aMap,
-      anEnum?.raw,
+      anEnum.raw,
       aString,
     )
   }
@@ -162,7 +162,7 @@
   }
   fun toList(): List<Any?> {
     return listOf<Any?>(
-      values?.toList(),
+      values.toList(),
     )
   }
 }
@@ -381,7 +381,7 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
+            var wrapped: List<Any?>
             try {
               api.noop()
               wrapped = listOf<Any?>(null)
@@ -398,9 +398,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val everythingArg = args[0] as AllTypes
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoAllTypes(everythingArg))
             } catch (exception: Error) {
@@ -416,7 +416,7 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.throwError())
             } catch (exception: Error) {
@@ -432,7 +432,7 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwErrorFromVoid", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
+            var wrapped: List<Any?>
             try {
               api.throwErrorFromVoid()
               wrapped = listOf<Any?>(null)
@@ -449,9 +449,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long }
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoInt(anIntArg))
             } catch (exception: Error) {
@@ -467,9 +467,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aDoubleArg = args[0] as Double
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoDouble(aDoubleArg))
             } catch (exception: Error) {
@@ -485,9 +485,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aBoolArg = args[0] as Boolean
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoBool(aBoolArg))
             } catch (exception: Error) {
@@ -503,9 +503,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aStringArg = args[0] as String
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoString(aStringArg))
             } catch (exception: Error) {
@@ -521,9 +521,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aUint8ListArg = args[0] as ByteArray
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoUint8List(aUint8ListArg))
             } catch (exception: Error) {
@@ -539,9 +539,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val anObjectArg = args[0] as Any
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoObject(anObjectArg))
             } catch (exception: Error) {
@@ -557,9 +557,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoList", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aListArg = args[0] as List<Any?>
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoList(aListArg))
             } catch (exception: Error) {
@@ -575,9 +575,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoMap", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aMapArg = args[0] as Map<String?, Any?>
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoMap(aMapArg))
             } catch (exception: Error) {
@@ -593,9 +593,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val everythingArg = args[0] as? AllNullableTypes
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoAllNullableTypes(everythingArg))
             } catch (exception: Error) {
@@ -611,9 +611,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val wrapperArg = args[0] as AllNullableTypesWrapper
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.extractNestedNullableString(wrapperArg))
             } catch (exception: Error) {
@@ -629,9 +629,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val nullableStringArg = args[0] as? String
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.createNestedNullableString(nullableStringArg))
             } catch (exception: Error) {
@@ -647,11 +647,11 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aNullableBoolArg = args[0] as? Boolean
             val aNullableIntArg = args[1].let { if (it is Int) it.toLong() else it as? Long }
             val aNullableStringArg = args[2] as? String
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.sendMultipleNullableTypes(aNullableBoolArg, aNullableIntArg, aNullableStringArg))
             } catch (exception: Error) {
@@ -667,9 +667,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aNullableIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long }
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoNullableInt(aNullableIntArg))
             } catch (exception: Error) {
@@ -685,9 +685,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aNullableDoubleArg = args[0] as? Double
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoNullableDouble(aNullableDoubleArg))
             } catch (exception: Error) {
@@ -703,9 +703,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aNullableBoolArg = args[0] as? Boolean
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoNullableBool(aNullableBoolArg))
             } catch (exception: Error) {
@@ -721,9 +721,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aNullableStringArg = args[0] as? String
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoNullableString(aNullableStringArg))
             } catch (exception: Error) {
@@ -739,9 +739,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aNullableUint8ListArg = args[0] as? ByteArray
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoNullableUint8List(aNullableUint8ListArg))
             } catch (exception: Error) {
@@ -757,9 +757,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
-            val aNullableObjectArg = args[0] as? Any
+            val aNullableObjectArg = args[0]
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoNullableObject(aNullableObjectArg))
             } catch (exception: Error) {
@@ -775,9 +775,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableList", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aNullableListArg = args[0] as? List<Any?>
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoNullableList(aNullableListArg))
             } catch (exception: Error) {
@@ -793,9 +793,9 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableMap", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aNullableMapArg = args[0] as? Map<String?, Any?>
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.echoNullableMap(aNullableMapArg))
             } catch (exception: Error) {
@@ -811,7 +811,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
             api.noopAsync() { result: Result<Unit> ->
               val error = result.exceptionOrNull()
               if (error != null) {
@@ -829,7 +828,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncInt", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long }
             api.echoAsyncInt(anIntArg) { result: Result<Long> ->
@@ -850,7 +848,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncDouble", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aDoubleArg = args[0] as Double
             api.echoAsyncDouble(aDoubleArg) { result: Result<Double> ->
@@ -871,7 +868,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncBool", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aBoolArg = args[0] as Boolean
             api.echoAsyncBool(aBoolArg) { result: Result<Boolean> ->
@@ -892,7 +888,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aStringArg = args[0] as String
             api.echoAsyncString(aStringArg) { result: Result<String> ->
@@ -913,7 +908,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncUint8List", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aUint8ListArg = args[0] as ByteArray
             api.echoAsyncUint8List(aUint8ListArg) { result: Result<ByteArray> ->
@@ -934,7 +928,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncObject", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val anObjectArg = args[0] as Any
             api.echoAsyncObject(anObjectArg) { result: Result<Any> ->
@@ -955,7 +948,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncList", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aListArg = args[0] as List<Any?>
             api.echoAsyncList(aListArg) { result: Result<List<Any?>> ->
@@ -976,7 +968,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncMap", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aMapArg = args[0] as Map<String?, Any?>
             api.echoAsyncMap(aMapArg) { result: Result<Map<String?, Any?>> ->
@@ -997,7 +988,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncError", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
             api.throwAsyncError() { result: Result<Any?> ->
               val error = result.exceptionOrNull()
               if (error != null) {
@@ -1016,7 +1006,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncErrorFromVoid", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
             api.throwAsyncErrorFromVoid() { result: Result<Unit> ->
               val error = result.exceptionOrNull()
               if (error != null) {
@@ -1034,7 +1023,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncAllTypes", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val everythingArg = args[0] as AllTypes
             api.echoAsyncAllTypes(everythingArg) { result: Result<AllTypes> ->
@@ -1055,7 +1043,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val everythingArg = args[0] as? AllNullableTypes
             api.echoAsyncNullableAllNullableTypes(everythingArg) { result: Result<AllNullableTypes?> ->
@@ -1076,7 +1063,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableInt", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val anIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long }
             api.echoAsyncNullableInt(anIntArg) { result: Result<Long?> ->
@@ -1097,7 +1083,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableDouble", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aDoubleArg = args[0] as? Double
             api.echoAsyncNullableDouble(aDoubleArg) { result: Result<Double?> ->
@@ -1118,7 +1103,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableBool", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aBoolArg = args[0] as? Boolean
             api.echoAsyncNullableBool(aBoolArg) { result: Result<Boolean?> ->
@@ -1139,7 +1123,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableString", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aStringArg = args[0] as? String
             api.echoAsyncNullableString(aStringArg) { result: Result<String?> ->
@@ -1160,7 +1143,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableUint8List", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aUint8ListArg = args[0] as? ByteArray
             api.echoAsyncNullableUint8List(aUint8ListArg) { result: Result<ByteArray?> ->
@@ -1181,9 +1163,8 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableObject", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
-            val anObjectArg = args[0] as? Any
+            val anObjectArg = args[0]
             api.echoAsyncNullableObject(anObjectArg) { result: Result<Any?> ->
               val error = result.exceptionOrNull()
               if (error != null) {
@@ -1202,7 +1183,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableList", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aListArg = args[0] as? List<Any?>
             api.echoAsyncNullableList(aListArg) { result: Result<List<Any?>?> ->
@@ -1223,7 +1203,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableMap", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aMapArg = args[0] as? Map<String?, Any?>
             api.echoAsyncNullableMap(aMapArg) { result: Result<Map<String?, Any?>?> ->
@@ -1244,7 +1223,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
             api.callFlutterNoop() { result: Result<Unit> ->
               val error = result.exceptionOrNull()
               if (error != null) {
@@ -1262,7 +1240,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowError", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
             api.callFlutterThrowError() { result: Result<Any?> ->
               val error = result.exceptionOrNull()
               if (error != null) {
@@ -1281,7 +1258,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
             api.callFlutterThrowErrorFromVoid() { result: Result<Unit> ->
               val error = result.exceptionOrNull()
               if (error != null) {
@@ -1299,7 +1275,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val everythingArg = args[0] as AllTypes
             api.callFlutterEchoAllTypes(everythingArg) { result: Result<AllTypes> ->
@@ -1320,7 +1295,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aNullableBoolArg = args[0] as? Boolean
             val aNullableIntArg = args[1].let { if (it is Int) it.toLong() else it as? Long }
@@ -1343,7 +1317,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aBoolArg = args[0] as Boolean
             api.callFlutterEchoBool(aBoolArg) { result: Result<Boolean> ->
@@ -1364,7 +1337,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long }
             api.callFlutterEchoInt(anIntArg) { result: Result<Long> ->
@@ -1385,7 +1357,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aDoubleArg = args[0] as Double
             api.callFlutterEchoDouble(aDoubleArg) { result: Result<Double> ->
@@ -1406,7 +1377,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aStringArg = args[0] as String
             api.callFlutterEchoString(aStringArg) { result: Result<String> ->
@@ -1427,7 +1397,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aListArg = args[0] as ByteArray
             api.callFlutterEchoUint8List(aListArg) { result: Result<ByteArray> ->
@@ -1448,7 +1417,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aListArg = args[0] as List<Any?>
             api.callFlutterEchoList(aListArg) { result: Result<List<Any?>> ->
@@ -1469,7 +1437,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aMapArg = args[0] as Map<String?, Any?>
             api.callFlutterEchoMap(aMapArg) { result: Result<Map<String?, Any?>> ->
@@ -1490,7 +1457,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aBoolArg = args[0] as? Boolean
             api.callFlutterEchoNullableBool(aBoolArg) { result: Result<Boolean?> ->
@@ -1511,7 +1477,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val anIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long }
             api.callFlutterEchoNullableInt(anIntArg) { result: Result<Long?> ->
@@ -1532,7 +1497,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aDoubleArg = args[0] as? Double
             api.callFlutterEchoNullableDouble(aDoubleArg) { result: Result<Double?> ->
@@ -1553,7 +1517,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableString", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aStringArg = args[0] as? String
             api.callFlutterEchoNullableString(aStringArg) { result: Result<String?> ->
@@ -1574,7 +1537,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aListArg = args[0] as? ByteArray
             api.callFlutterEchoNullableUint8List(aListArg) { result: Result<ByteArray?> ->
@@ -1595,7 +1557,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aListArg = args[0] as? List<Any?>
             api.callFlutterEchoNullableList(aListArg) { result: Result<List<Any?>?> ->
@@ -1616,7 +1577,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aMapArg = args[0] as? Map<String?, Any?>
             api.callFlutterEchoNullableMap(aMapArg) { result: Result<Map<String?, Any?>?> ->
@@ -1714,7 +1674,7 @@
   fun throwError(callback: (Any?) -> Unit) {
     val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.throwError", codec)
     channel.send(null) {
-      val result = it as? Any?
+      val result = it
       callback(result)
     }
   }
@@ -1904,7 +1864,7 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostTrivialApi.noop", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
+            var wrapped: List<Any?>
             try {
               api.noop()
               wrapped = listOf<Any?>(null)
@@ -1941,7 +1901,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostSmallApi.echo", codec)
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val aStringArg = args[0] as String
             api.echo(aStringArg) { result: Result<String> ->
@@ -1962,7 +1921,6 @@
         val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostSmallApi.voidVoid", codec)
         if (api != null) {
           channel.setMessageHandler { _, reply ->
-            var wrapped = listOf<Any?>()
             api.voidVoid() { result: Result<Unit> ->
               val error = result.exceptionOrNull()
               if (error != null) {
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt
index 478102a..944e416 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt
@@ -39,7 +39,7 @@
     return everything
   }
 
-  override fun throwError(): Object? {
+  override fun throwError(): Any? {
     throw Exception("An error");
   }
 
@@ -173,7 +173,7 @@
   override fun echoAsyncMap(aMap: Map<String?, Any?>, callback: (Result<Map<String?, Any?>>) -> Unit) {
     callback(Result.success(aMap))
   }
-  
+
   override fun echoAsyncNullableInt(anInt: Long?, callback: (Result<Long?>) -> Unit) {
     callback(Result.success(anInt))
   }
@@ -209,7 +209,7 @@
   override fun callFlutterNoop(callback: (Result<Unit>) -> Unit) {
     flutterApi!!.noop() { callback(Result.success(Unit)) }
   }
-  
+
   override fun callFlutterThrowError(callback: (Result<Any?>) -> Unit) {
     // TODO: (tarrinneal) Once flutter api error handling is added, complete these tests.
     // See issue https://github.com/flutter/flutter/issues/118243
@@ -224,9 +224,9 @@
   }
 
   override fun callFlutterSendMultipleNullableTypes(
-    aNullableBool: Boolean?, 
-    aNullableInt: Long?, 
-    aNullableString: String?, 
+    aNullableBool: Boolean?,
+    aNullableInt: Long?,
+    aNullableString: String?,
     callback: (Result<AllNullableTypes>) -> Unit
   ) {
     flutterApi!!.sendMultipleNullableTypes(aNullableBool, aNullableInt, aNullableString) {
diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift
index 9e1fa4b..de3055b 100644
--- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift
+++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift
@@ -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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 import Foundation
diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift
index 9e1fa4b..de3055b 100644
--- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift
+++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift
@@ -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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 import Foundation
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp
index 2ca8f4d..d29eef0 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp
+++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp
@@ -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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 #undef _HAS_EXCEPTIONS
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h
index 42ac51a..ce395b4 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h
+++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h
@@ -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 (v9.0.2), do not edit directly.
+// Autogenerated from Pigeon (v9.0.3), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 #ifndef PIGEON_CORE_TESTS_GEN_H_
diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml
index 70f92c6..1a865d4 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: 9.0.2 # This must match the version in lib/generator_tools.dart
+version: 9.0.3 # This must match the version in lib/generator_tools.dart
 
 environment:
   sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/pigeon/test/kotlin_generator_test.dart b/packages/pigeon/test/kotlin_generator_test.dart
index 2aae102..18196cf 100644
--- a/packages/pigeon/test/kotlin_generator_test.dart
+++ b/packages/pigeon/test/kotlin_generator_test.dart
@@ -185,9 +185,9 @@
     expect(code, contains('''
         if (api != null) {
           channel.setMessageHandler { message, reply ->
-            var wrapped = listOf<Any?>()
             val args = message as List<Any?>
             val inputArg = args[0] as Input
+            var wrapped: List<Any?>
             try {
               wrapped = listOf<Any?>(api.doSomething(inputArg))
             } catch (exception: Error) {