You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thee are multiple inconsistencies with the pedantic analysis options
The most critical one is implicit-dynamic: false, in the load method, because I have to disable it in order to be able to build with the generated translations.
Here key and value don't have types, they should be at least dynamic, but as the translations should be key/value pairs of strings for a valid json I think you should put types here and also avoid "as" syntax.
_translations = jsonMap
.map<String, String>((key, value) => MapEntry(key, value as String));
Next TranslationKeys
class TranslationKeys {
static final String pleaseAuthenticate = 'please_authenticate';
static final String viewReadme = 'view_readme';
}
The rule that I have is underlining those as
Prefer const over final for declarations.dart(prefer_const_declarations)
Next Usage of var
var jsonStr =
await rootBundle.loadString('i18n/${locale.languageCode}.json');
the rule I have here that is broken is
Prefer final for variable declarations if they are not reassigned.dart(prefer_final_locals)
Next Map jsonMap = json.decode(jsonStr);
Prefer final for variable declarations if they are not reassigned.dart(prefer_final_locals)
Next String get viewReadme => this.resolve(TranslationKeys.viewReadme);
Don't access members with this unless avoiding shadowing.dart(unnecessary_this)
Next const ['bg', 'en'].contains(locale.languageCode); and var translation = Translation();
Specify type annotations.dart(always_specify_types)
I'm sure if this is intended, f the generator actually can make those fixed at all. but generally those are good suggestions to fix, even if you are not using pedantic or w/e analysis options.
The text was updated successfully, but these errors were encountered:
Thee are multiple inconsistencies with the pedantic analysis options
The most critical one is implicit-dynamic: false, in the load method, because I have to disable it in order to be able to build with the generated translations.
Here key and value don't have types, they should be at least dynamic, but as the translations should be key/value pairs of strings for a valid json I think you should put types here and also avoid "as" syntax.
Next TranslationKeys
The rule that I have is underlining those as
Prefer const over final for declarations.dart(prefer_const_declarations)
Next Usage of var
the rule I have here that is broken is
Prefer final for variable declarations if they are not reassigned.dart(prefer_final_locals)
Next
Map jsonMap = json.decode(jsonStr);
Prefer final for variable declarations if they are not reassigned.dart(prefer_final_locals)
Next
String get viewReadme => this.resolve(TranslationKeys.viewReadme);
Don't access members with
this
unless avoiding shadowing.dart(unnecessary_this)Next
const ['bg', 'en'].contains(locale.languageCode);
andvar translation = Translation();
Specify type annotations.dart(always_specify_types)
I'm sure if this is intended, f the generator actually can make those fixed at all. but generally those are good suggestions to fix, even if you are not using pedantic or w/e analysis options.
The text was updated successfully, but these errors were encountered: