Skip to content

StandardMessageCodec produces Map<dynamic, dynamic> but users expect Map<String, dynamic> #14556

Closed
@mraleph

Description

@mraleph

Consider for example this code from semantics_service_test (/cc @amirh )

    SystemChannels.accessibility.setMockMessageHandler((Object mockMessage) async {
      final Map<String, dynamic> message = mockMessage;
      log.add(message);
    });

This triggers runtime check failure in Dart 2 mode because Map<dynamic, dynamic> is not a subtype of Map<String, dynamic>.

I have discussed this with @mravn-google and we decided to go by fixing the consumer side, especially because Dart lacks features needed to correctly preserve type arguments across channel boundaries for arbitrary types.

I am gonna handle updating tests in Flutter repo, while @mravn-google team is gonna take care of packages that contain similar issues, e.g. https://github.com/flutter/plugins/blob/master/packages/video_player/lib/video_player.dart#L162-L163

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions