i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Avoid implicit dynamic typing.

Open knaeckeKami opened this issue 4 years ago • 4 comments

When using this library in a project with stronger static type settings, like

strict-inference: true or

implicit:dynamic: false

the code generated by this library produces analysis errors.

Generated methods like this:

  static m5(howMany) => "${Intl.plural(howMany, one: '...', other: '${howMany} ...')}";

Cause the following analysis error:

argument_type_not_assignable: The argument type 'dynamic' cannot be assigned to the parameter type 'num'.

Also the line:

 final messages = _notInlinedMessages(_notInlinedMessages);

causes:

invalid_assignment: A value of type 'dynamic' cannot be assigned to a variable of type Map<String, dynamic>.

Since we cannot exclude the generated files in the analyzer: (https://github.com/dart-lang/sdk/issues/25551 ), this causes annoying error messages.

Either fixing the generated code to user stronger typing or adding

// ignore_for_file: invalid_assignment
// ignore_for_file: argument_type_not_assignable

Should make these errors go away.

knaeckeKami avatar Apr 09 '20 12:04 knaeckeKami