enable unnecessary_late (#96417)

This commit is contained in:
Michael Goderbauer 2022-01-12 21:10:19 -08:00 committed by GitHub
parent 7aaa87b5b6
commit 40a2689b9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View file

@ -215,7 +215,7 @@ linter:
# - unnecessary_final # conflicts with prefer_final_locals
- unnecessary_getters_setters
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
# - unnecessary_late # not yet tested
- unnecessary_late
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_checks

View file

@ -387,7 +387,7 @@ class LogicalKeyData {
}
// Map Web key to the pair of key names
static late final Map<String, _ModifierPair> _chromeModifiers = () {
static final Map<String, _ModifierPair> _chromeModifiers = () {
final String rawJson = File(path.join(dataRoot, 'chromium_modifiers.json',)).readAsStringSync();
return (json.decode(rawJson) as Map<String, dynamic>).map((String key, dynamic value) {
final List<dynamic> pair = value as List<dynamic>;
@ -396,7 +396,7 @@ class LogicalKeyData {
}();
/// Returns the static map of printable representations.
static late final Map<String, String> printable = (() {
static final Map<String, String> printable = (() {
final String printableKeys = File(path.join(dataRoot, 'printable.json',)).readAsStringSync();
return (json.decode(printableKeys) as Map<String, dynamic>)
.cast<String, String>();
@ -407,7 +407,7 @@ class LogicalKeyData {
/// These include synonyms for keys which don't have printable
/// representations, and appear in more than one place on the keyboard (e.g.
/// SHIFT, ALT, etc.).
static late final Map<String, List<String>> synonyms = (() {
static final Map<String, List<String>> synonyms = (() {
final String synonymKeys = File(path.join(dataRoot, 'synonyms.json',)).readAsStringSync();
final Map<String, dynamic> dynamicSynonym = json.decode(synonymKeys) as Map<String, dynamic>;
return dynamicSynonym.map((String name, dynamic values) {

View file

@ -171,7 +171,7 @@ class MatrixUtils {
return Rect.fromLTRB(_minMax[0], _minMax[1], _minMax[2], _minMax[3]);
}
static late final Float64List _minMax = Float64List(4);
static final Float64List _minMax = Float64List(4);
static void _accumulate(Float64List m, double x, double y, bool first, bool isAffine) {
final double w = isAffine ? 1.0 : 1.0 / (m[3] * x + m[7] * y + m[15]);
final double tx = (m[0] * x + m[4] * y + m[12]) * w;

View file

@ -153,7 +153,7 @@ class TestRenderingFlutterBinding extends BindingBase with SchedulerBinding, Ser
}
}
late final TestRenderingFlutterBinding _renderer = TestRenderingFlutterBinding();
final TestRenderingFlutterBinding _renderer = TestRenderingFlutterBinding();
TestRenderingFlutterBinding get renderer => _renderer;

View file

@ -696,7 +696,7 @@ class KeyEventSimulator {
});
}
static late final Map<String, PhysicalKeyboardKey> _debugNameToPhysicalKey = (() {
static final Map<String, PhysicalKeyboardKey> _debugNameToPhysicalKey = (() {
final Map<String, PhysicalKeyboardKey> result = <String, PhysicalKeyboardKey>{};
for (final PhysicalKeyboardKey key in PhysicalKeyboardKey.knownPhysicalKeys) {
final String? debugName = key.debugName;