Skip to content

The Flutter engine startup hooks need to pass the correct type of arguments #23246

@a-siva

Description

@a-siva

With change
dart/9f00eec55b [ VM / Mirrors ] Added type checking to enforce strong mode semantics when using dart:mirrors / Dart API
The Dart VM checks for strong mode semantics when the Dart API methods to invoke methods is used.

Currently the Flutter engine during initialization does not pass the correct type for List arguments in some cases, e.g:
void _updateLocales(List<String> locales) {
Has a signature that accepts List

But the call to it from the engine uses a List for the locales argument

  DartInvokeField(library_.value(), "_updateLocales",
                  {
                      tonic::ToDart<std::vector<std::string>>(locales),
                  });

This results in a runtime exception

[ +295 ms] Shell: [ERROR:flutter/shell/common/shell.cc(182)] Dart Error:
Unhandled exception:
[        ] Shell: type 'List<dynamic>' is not a subtype of type 'List<String>'
of 'locales'
[        ] Shell: #0      _TypeError._throwNew (dart:core/runtime/liberrors_patch.dart:89:75)

and the code in updateLocales is not executed at all.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions