Skip to content

[Pigeon] Nullable return type doesn't support collections #101515

@ben-xD

Description

@ben-xD

If you define a method that returns a nullable Map:

@HostApi()
abstract class PushHostApi {
  Map<String?, Object?>? getNotification();
}

This generates some code, which has 1 invalid line:

return (replyMap['result'] as Map<Object?, Object?>?).cast<String?, Object?>();

error

There is a quick fix: add ? to the line, making it return (replyMap['result'] as Map<Object?, Object?>?)?.cast<String?, Object?>();

Looks like this was one edge case that was not supported as part of 2.0.0

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listp: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions