Repository navigation
[pigeon] Add support for collections of enums #133728
Copy link
Copy link
Closed
flutter/packages
#7476Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
Activity
- addedpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.p: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen tool
on Aug 31, 2023 - addedc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem team
on Sep 5, 2023 - addedP2Important issues not at the top of the work listImportant issues not at the top of the work listtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
on Sep 7, 2023 Hello,
Any news for this issue
I guess it's still not working.
However, I figured out the following workaround by wrapping enum to the class, so it's a bit better type-safety than
List<int?>(collection of ordinals) orList<String?>(collection of enum names):let's say we have following enum:
enum Pet{CAT, DOG, FISH; }
instead of
@FlutterApi() abstract class PetsApi { List<Pet?> getPets(); }
do the following:
class PetResponse{ Pet? pet; //Pet.CAT String? key; //"cat" }
The flutter api would look the following(you can map/filter nulls on native side)
@FlutterApi() abstract class PetsApi { List<PetResponse?> getPets(); }
Reacted by Kuba Domaszewicz and Mohamed CHOUCHANE- added a commit that references this issue
on Aug 30, 2024 This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Sep 13, 2024 - added a commit that references this issue
on Jun 10, 2026 - added a commit that references this issue
on Jun 19, 2026
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
As of flutter/packages#4580 pigeon supports enums as primitives across all platforms.
It still does not support collections of enums though.
List<Enum>is a fairly common type even in our own packages (ie. local_auth_ios), as such should be supported by pigeon.Map<Enum>would is also needed.