-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#4580Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
The AllNullableTypes nullable enum field, which is
AnEnum? aNullableEnum;
generates
@property(nonatomic, assign) AnEnum aNullableEnum;
That can't express a null value. Currently what happens is you get whatever 0 maps to in the enum, which is wrong.
IIRC @gaaclarke and I have discussed this in the past; using NSNumber like we do for other numeric types means clients have to cast, which isn't great. Options I can see include:
- Use a sentinel value corresponding to null, but we'd have to be careful about naming collisions. (I think this was suggested at the time, I forget whether there are other problems we discussed with that approach.)
- Generating a wrapper class in the case of a nullable enum, that would behave sort of like C++'s
std::optional.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team