Skip to content

[pigeon] Support lists-and-maps of lists-and-maps#11400

Open
srawlins wants to merge 3 commits intoflutter:mainfrom
srawlins:list-of-list
Open

[pigeon] Support lists-and-maps of lists-and-maps#11400
srawlins wants to merge 3 commits intoflutter:mainfrom
srawlins:list-of-list

Conversation

@srawlins
Copy link
Copy Markdown
Contributor

@srawlins srawlins commented Mar 30, 2026

Fixes flutter/flutter#116117

This PR is massive because of the added test data. 😬 But the source changes, in lib/src/dart/dart_generator.dart, are pretty minimal.

Please let me know if I added too many new test data, or if I need more.

The strategy is summed up in the doc comment to the _castCall method:

  • Given a simple type, like List<int>, the returned code is a simple call to List.cast: cast<int>().
  • Given a deep List type, like List<List<int>>, the returned code uses List.map and List.cast: map((e) => (e! as List<Object?>).cast<int>()).toList().
  • Given a deep Map type, like Map<int, List<int>>, the returned code uses Map.map and Map.cast: map((k, v) => MapEntry(k! as int, (v! as List<Object?>).cast<int>())).

Pre-Review Checklist

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Pigeon Dart generator to support nested List and Map types by implementing a recursive casting mechanism. It adds nested collection fields such as boolListList, boolMapList, and boolListMap to the core test pigeons and introduces a new echoNonNullBoolListList method to the host integration API. The changes encompass updates to generated code across all supported platforms and the addition of integration tests. Feedback indicates that the objectVersion in the macOS Xcode project file was downgraded, which appears to be an unintentional change that should be reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pigeon] Nested list types aren't preserved

1 participant