[pigeon] Fix missed casting of not nullable Dart int to Kotlin long (#3004)

* [pigeon] Fix missed casting of not nullable Dart int to Kotlin long

* [pigeon] Consolidate simple datatypes header unit tests

* Release fixed integration tests of Android Kotlin implementation

* Add gen files

* Update formatting

By executing:
dart pub global run flutter_plugin_tools format --packages pigeon

* remove merge conflict code

Co-authored-by: Tarrin Neal <tarrinneal@gmail.com>
diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md
index 6c3bdf7..cb71b39 100644
--- a/packages/pigeon/CHANGELOG.md
+++ b/packages/pigeon/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 7.0.2
+
+* [kotlin] Fixes a missed casting of not nullable Dart 'int' to Kotlin 64bit long.
+
 ## 7.0.1
 
 * [generator_tools] adds `newln` method for adding empty lines and ending lines.
diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart
index 972cd34..89052b7 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 = '7.0.1';
+const String pigeonVersion = '7.0.2';
 
 /// Read all the content from [stdin] to a String.
 String readStdin() {
diff --git a/packages/pigeon/lib/kotlin_generator.dart b/packages/pigeon/lib/kotlin_generator.dart
index ab2cc2a..ec2f687 100644
--- a/packages/pigeon/lib/kotlin_generator.dart
+++ b/packages/pigeon/lib/kotlin_generator.dart
@@ -255,6 +255,10 @@
                 customEnumNames.contains(field.type.baseName)) {
               indent.writeln(
                   'val ${field.name} = $fieldType.ofRaw($listValue as Int)!!');
+            } else if (isInt) {
+              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} = $listValue as $fieldType');
             }
diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart
index d9010c1..b1179e6 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 582a60f..10ad4a2 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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/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 947ca16..01eb7c0 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 package com.example.alternate_language_test_plugin;
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 da0a19f..a6e6ad4 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 4936726..8641cf6 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 9ff225b..74db9f6 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 df1a5e9..ef9aac4 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 d74904e..802b7d9 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 218dcb4..ccaabda 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 040c5c4..6a64142 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 118d7fa..f66d1b4 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 96eddd1..ee45769 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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/integration_tests.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart
index 93fbc21..87bc718 100644
--- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart
+++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart
@@ -98,10 +98,7 @@
       expect(listEquals(echoObject.aList, genericAllTypes.aList), true);
       expect(mapEquals(echoObject.aMap, genericAllTypes.aMap), true);
       expect(echoObject.anEnum, genericAllTypes.anEnum);
-    },
-        // TODO(stuartmorgan): Fix and re-enable.
-        // See https://github.com/flutter/flutter/issues/118726
-        skip: targetGenerator == TargetGenerator.kotlin);
+    });
 
     testWidgets('all nullable datatypes serialize and deserialize correctly',
         (WidgetTester _) async {
@@ -531,11 +528,8 @@
       expect(echoObject.anEnum, genericAllTypes.anEnum);
     },
         // TODO(stuartmorgan): Fix and re-enable.
-        // See https://github.com/flutter/flutter/issues/118726
-        skip: targetGenerator == TargetGenerator.kotlin ||
-            // TODO(stuartmorgan): Fix and re-enable.
-            // See https://github.com/flutter/flutter/issues/118739
-            targetGenerator == TargetGenerator.cpp);
+        // See https://github.com/flutter/flutter/issues/118739
+        skip: targetGenerator == TargetGenerator.cpp);
 
     testWidgets(
         'Arguments of multiple types serialize and deserialize correctly',
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 9ff225b..74db9f6 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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/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 0c74d9f..4c7613f 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 package com.example.test_plugin
@@ -58,7 +58,7 @@
     @Suppress("UNCHECKED_CAST")
     fun fromList(list: List<Any?>): AllTypes {
       val aBool = list[0] as Boolean
-      val anInt = list[1] as Long
+      val anInt = list[1].let { if (it is Int) it.toLong() else it as Long }
       val aDouble = list[2] as Double
       val aByteArray = list[3] as ByteArray
       val a4ByteArray = list[4] as IntArray
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 a22d39e..e1e212a 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 a22d39e..e1e212a 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 2905839..2f818a4 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 c2e06eb..54633ca 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 (v7.0.1), do not edit directly.
+// Autogenerated from Pigeon (v7.0.2), 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 1c26d35..e633780 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: 7.0.1 # This must match the version in lib/generator_tools.dart
+version: 7.0.2 # 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 a725a1b..1887062 100644
--- a/packages/pigeon/test/kotlin_generator_test.dart
+++ b/packages/pigeon/test/kotlin_generator_test.dart
@@ -207,28 +207,28 @@
         NamedType(
           type: const TypeDeclaration(
             baseName: 'bool',
-            isNullable: true,
+            isNullable: false,
           ),
           name: 'aBool',
         ),
         NamedType(
           type: const TypeDeclaration(
             baseName: 'int',
-            isNullable: true,
+            isNullable: false,
           ),
           name: 'aInt',
         ),
         NamedType(
           type: const TypeDeclaration(
             baseName: 'double',
-            isNullable: true,
+            isNullable: false,
           ),
           name: 'aDouble',
         ),
         NamedType(
           type: const TypeDeclaration(
             baseName: 'String',
-            isNullable: true,
+            isNullable: false,
           ),
           name: 'aString',
         ),
@@ -242,24 +242,80 @@
         NamedType(
           type: const TypeDeclaration(
             baseName: 'Int32List',
-            isNullable: true,
+            isNullable: false,
           ),
           name: 'aInt32List',
         ),
         NamedType(
           type: const TypeDeclaration(
             baseName: 'Int64List',
-            isNullable: true,
+            isNullable: false,
           ),
           name: 'aInt64List',
         ),
         NamedType(
           type: const TypeDeclaration(
             baseName: 'Float64List',
-            isNullable: true,
+            isNullable: false,
           ),
           name: 'aFloat64List',
         ),
+        NamedType(
+          type: const TypeDeclaration(
+            baseName: 'bool',
+            isNullable: true,
+          ),
+          name: 'aNullableBool',
+        ),
+        NamedType(
+          type: const TypeDeclaration(
+            baseName: 'int',
+            isNullable: true,
+          ),
+          name: 'aNullableInt',
+        ),
+        NamedType(
+          type: const TypeDeclaration(
+            baseName: 'double',
+            isNullable: true,
+          ),
+          name: 'aNullableDouble',
+        ),
+        NamedType(
+          type: const TypeDeclaration(
+            baseName: 'String',
+            isNullable: true,
+          ),
+          name: 'aNullableString',
+        ),
+        NamedType(
+          type: const TypeDeclaration(
+            baseName: 'Uint8List',
+            isNullable: true,
+          ),
+          name: 'aNullableUint8List',
+        ),
+        NamedType(
+          type: const TypeDeclaration(
+            baseName: 'Int32List',
+            isNullable: true,
+          ),
+          name: 'aNullableInt32List',
+        ),
+        NamedType(
+          type: const TypeDeclaration(
+            baseName: 'Int64List',
+            isNullable: true,
+          ),
+          name: 'aNullableInt64List',
+        ),
+        NamedType(
+          type: const TypeDeclaration(
+            baseName: 'Float64List',
+            isNullable: true,
+          ),
+          name: 'aNullableFloat64List',
+        ),
       ]),
     ], enums: <Enum>[]);
 
@@ -269,14 +325,30 @@
     const KotlinGenerator generator = KotlinGenerator();
     generator.generate(kotlinOptions, root, sink);
     final String code = sink.toString();
-    expect(code, contains('val aBool: Boolean? = null'));
-    expect(code, contains('val aInt: Long? = null'));
-    expect(code, contains('val aDouble: Double? = null'));
-    expect(code, contains('val aString: String? = null'));
-    expect(code, contains('val aUint8List: ByteArray? = null'));
-    expect(code, contains('val aInt32List: IntArray? = null'));
-    expect(code, contains('val aInt64List: LongArray? = null'));
-    expect(code, contains('val aFloat64List: DoubleArray? = null'));
+    expect(code, contains('val aBool: Boolean'));
+    expect(code, contains('val aInt: Long'));
+    expect(code, contains('val aDouble: Double'));
+    expect(code, contains('val aString: String'));
+    expect(code, contains('val aUint8List: ByteArray'));
+    expect(code, contains('val aInt32List: IntArray'));
+    expect(code, contains('val aInt64List: LongArray'));
+    expect(code, contains('val aFloat64List: DoubleArray'));
+    expect(
+        code,
+        contains(
+            'val aInt = list[1].let { if (it is Int) it.toLong() else it as Long }'));
+    expect(code, contains('val aNullableBool: Boolean? = null'));
+    expect(code, contains('val aNullableInt: Long? = null'));
+    expect(code, contains('val aNullableDouble: Double? = null'));
+    expect(code, contains('val aNullableString: String? = null'));
+    expect(code, contains('val aNullableUint8List: ByteArray? = null'));
+    expect(code, contains('val aNullableInt32List: IntArray? = null'));
+    expect(code, contains('val aNullableInt64List: LongArray? = null'));
+    expect(code, contains('val aNullableFloat64List: DoubleArray? = null'));
+    expect(
+        code,
+        contains(
+            'val aNullableInt = list[9].let { if (it is Int) it.toLong() else it as? Long }'));
   });
 
   test('gen one flutter api', () {