localizely / flutter-intl-vscode

This VS Code extension generates boilerplate code for localization of Flutter apps with official Dart Intl library
MIT License
87 stars 1 forks source link

generated code failed to type check #35

Open fotonmoton opened 4 years ago

fotonmoton commented 4 years ago

A value of type 'dynamic' can't be assigned to a variable of type 'Map<String, dynamic>'. Try changing the type of the variable, or casting the right-hand type to 'Map<String, dynamic>'. image If I add return type then typechecker doesn't complain: image

lzoran commented 4 years ago

Hi @fotonmoton,

Thanks for reporting this issue! Unfortunately, this problem is more related to the intl_translation package, which we are using for generating localization files.

A temporary solution for this would be to exclude the generated directory from the analysis (update analysis_options.yaml file).

...
analyzer:
  exclude:
    - "lib/generated/*"
...

Note, this solution may not work always (reported issue). Restarting your IDE and not opening excluded files should help you with the above-mentioned issue.