Prefer interpolation to compose strings

Using interpolation when composing strings and values is usually
easier to write and read than concatenation.
pull/145/head
Till Friebe 4 years ago
parent 5c18ca1dc3
commit 5bab918860
  1. 1
      analysis_options.yaml
  2. 2
      lib/models/documents/nodes/line.dart
  3. 2
      lib/utils/color.dart
  4. 6
      lib/utils/diff_delta.dart

@ -26,6 +26,7 @@ linter:
- prefer_final_locals
- prefer_initializing_formals
- prefer_int_literals
- prefer_interpolation_to_compose_strings
- prefer_relative_imports
- prefer_single_quotes
- unnecessary_parenthesis

@ -55,7 +55,7 @@ class Line extends Container<Leaf?> {
}
@override
String toPlainText() => super.toPlainText() + '\n';
String toPlainText() => '${super.toPlainText()}\n';
@override
String toString() {

@ -119,7 +119,7 @@ Color stringToColor(String? s) {
}
var hex = s.replaceFirst('#', '');
hex = hex.length == 6 ? 'ff' + hex : hex;
hex = hex.length == 6 ? 'ff$hex' : hex;
final val = int.parse(hex, radix: 16);
return Color(val);
}

@ -79,11 +79,7 @@ int getPositionDelta(Delta user, Delta actual) {
final userOperation = userItr.next(length as int);
final actualOperation = actualItr.next(length);
if (userOperation.length != actualOperation.length) {
throw 'userOp ' +
userOperation.length.toString() +
' does not match ' +
' actualOp ' +
actualOperation.length.toString();
throw 'userOp ${userOperation.length} does not match actualOp ${actualOperation.length}';
}
if (userOperation.key == actualOperation.key) {
continue;

Loading…
Cancel
Save