Prefer const declarations

Const declarations are more hot-reload friendly and allow to use
const constructors if an instantiation references this declaration.
pull/145/head
Till Friebe 4 years ago
parent bc494bc50f
commit 15a2f1d76f
  1. 1
      analysis_options.yaml
  2. 2
      lib/models/documents/style.dart
  3. 3
      lib/models/quill_delta.dart
  4. 2
      lib/widgets/default_styles.dart

@ -13,6 +13,7 @@ linter:
- omit_local_variable_types
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals

@ -95,7 +95,7 @@ class Style {
return false;
}
final typedOther = other;
final eq = const MapEquality<String, Attribute>();
const eq = MapEquality<String, Attribute>();
return eq.equals(_attributes, typedOther._attributes);
}

@ -293,8 +293,7 @@ class Delta {
if (identical(this, other)) return true;
if (other is! Delta) return false;
final typedOther = other;
final comparator =
const ListEquality<Operation>(DefaultEquality<Operation>());
const comparator = ListEquality<Operation>(DefaultEquality<Operation>());
return comparator.equals(_operations, typedOther._operations);
}

@ -90,7 +90,7 @@ class DefaultStyles {
fontSize: 16.0,
height: 1.3,
);
final baseSpacing = const Tuple2<double, double>(6.0, 0);
const baseSpacing = Tuple2<double, double>(6.0, 0);
String fontFamily;
switch (themeData.platform) {
case TargetPlatform.iOS:

Loading…
Cancel
Save