Skip to content

[pigeon] nonnull enums are broken #100594

@ajmalk

Description

@ajmalk

Nonnull enums are broken now even with a wrapper class. Switching the enum to a nullable in the class fixes it.

Steps to Reproduce

Interface:

enum MyState {
  Idle,
}

class MyWrapper {
  late MyState state;
}

@FlutterApi
abstract class MyApi {
  void setState(MyWrapper state);
}

Error:

30: pigeonMap['state'] = state == null ? null : state!.index; (warning) The '!' will have no effect because the receiver can't be null.
                                                              #unnecessary_non_null_assertion

39: state: pigeonMap['state'] != null                         The argument type 'MyState?' can't be assigned to the parameter type
                                                              'MyState'. #argument_type_not_assignable

Metadata

Metadata

Labels

P2Important issues not at the top of the work lista: null-safetySupport for Dart's null safety featurec: crashStack traces logged to the consolep: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions