Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
?
  • Loading branch information
tarrinneal committed Feb 28, 2023
commit 307128f412c7af977cfeaddc83292ec33c897ed8
2 changes: 1 addition & 1 deletion packages/pigeon/lib/kotlin_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class KotlinGenerator extends StructuredGenerator<KotlinOptions> {
if (!hostDatatype.isBuiltin &&
customClassNames.contains(field.type.baseName)) {
indent.write('val ${field.name}: $fieldType? = ');
indent.add('($listValue as List<Any?>)?.let ');
indent.add('($listValue as List<Any?>?)?.let ');
indent.addScoped('{', '}', () {
indent.writeln('$fieldType.fromList(it)');
});
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/swift_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ import FlutterMacOS
if (!hostDatatype.isBuiltin &&
customClassNames.contains(field.type.baseName)) {
indent.writeln('var ${field.name}: $fieldType? = nil');
indent.write('if let ${field.name}List = $listValue as? [Any] ');
indent.write('if let ${field.name}List = $listValue as! [Any]? ');
indent.addScoped('{', '}', () {
indent.writeln(
'${field.name} = $fieldType.fromList(${field.name}List as [Any])');
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/test/kotlin_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void main() {
expect(code, contains('val nested: Nested? = null'));
expect(code, contains('fun fromList(list: List<Any?>): Outer'));
expect(
code, contains('val nested: Nested? = (list[0] as List<Any?>)?.let'));
code, contains('val nested: Nested? = (list[0] as List<Any?>?)?.let'));
expect(code, contains('Nested.fromList(it)'));
expect(code, contains('fun toList(): List<Any?>'));
});
Expand Down