Closed Dancovich closed 4 years ago
There is a lot more:
prefer_generic_function_type_aliases
: (12)
typedef void LocaleChangeCallback(Locale locale);
unnecessary_const
: (25 and 51)
static const GeneratedLocalizationsDelegate delegate =
const GeneratedLocalizationsDelegate();
return const <Locale>[
const Locale("pt", "BR")
];
unnecessary_this
: (57)
if (this.isSupported(locale)) {
avoid_renaming_method_parameters
: (66)
@override
Future<WidgetsLocalizations> load(Locale _locale) {
unnecessary_new
: (73, 76 and 79):
if ("pt_BR" == lang) {
return new SynchronousFuture<WidgetsLocalizations>(const _I18n_pt_BR());
}
else if ("pt" == languageCode) {
return new SynchronousFuture<WidgetsLocalizations>(const _I18n_pt_BR());
}
return new SynchronousFuture<WidgetsLocalizations>(const I18n());
}
Guess the only solution is to ignore the file: https://dart.dev/guides/language/analysis-options#excluding-files
fixed with version 0.27.0 thanks to @r1sim
Generated
i18n.dart
file doesn't follow some recommendations of dart code style, creating some warning when you runflutter analyze
or in VS Code Problems page.Some examples:
Use of unnecessary const.
const Locale("pt", "BR")
is inside a const context created byconst <Locale>[]
and it's unneeded.Use of unnecessary
new
. Thenew
key word is optional and can be omited.return new SynchronousFuture<WidgetsLocalizations>(const _I18n_pt_BR());
I can place some ignore statements to make the warnings go away but if I update the translations I need to place the statements again.