Fix new lints causing CI to fail (#513)
diff --git a/protobuf/benchmarks/common.dart b/protobuf/benchmarks/common.dart
index 9259375..05e6918 100644
--- a/protobuf/benchmarks/common.dart
+++ b/protobuf/benchmarks/common.dart
@@ -71,7 +71,7 @@
final FromJsonFactory fromJson;
static Factories forMessage(String name) =>
- _factories[name] ?? (throw 'Unsupported message: ${name}');
+ _factories[name] ?? (throw 'Unsupported message: $name');
/// Mapping between [BenchmarkProto.messageName] and corresponding
/// deserialization factories.
diff --git a/protobuf/lib/src/protobuf/extension_field_set.dart b/protobuf/lib/src/protobuf/extension_field_set.dart
index 8819750..8998042 100644
--- a/protobuf/lib/src/protobuf/extension_field_set.dart
+++ b/protobuf/lib/src/protobuf/extension_field_set.dart
@@ -160,7 +160,7 @@
if (value == null) continue;
if (extension.isRepeated) {
assert(value is PbListBase);
- _ensureRepeatedField(extension)..addAll(value);
+ _ensureRepeatedField(extension).addAll(value);
} else {
_setFieldUnchecked(extension, value);
}
diff --git a/protobuf/lib/src/protobuf/field_error.dart b/protobuf/lib/src/protobuf/field_error.dart
index fdbedb6..54e04be 100644
--- a/protobuf/lib/src/protobuf/field_error.dart
+++ b/protobuf/lib/src/protobuf/field_error.dart
@@ -68,7 +68,7 @@
// generated checkItem for message, group, enum calls this
void checkItemFailed(val, String className) {
- throw ArgumentError('Value ($val) is not an instance of ${className}');
+ throw ArgumentError('Value ($val) is not an instance of $className');
}
/// Returns a function for validating items in a repeated field.
@@ -107,7 +107,7 @@
case PbFieldType._FIXED32_BIT:
return _checkUnsigned32;
}
- throw ArgumentError('check function not implemented: ${fieldType}');
+ throw ArgumentError('check function not implemented: $fieldType');
}
// check functions for repeated fields
@@ -133,7 +133,7 @@
}
RangeError _createFieldRangeError(val, String wantedType) =>
- RangeError('Value ($val) is not ${wantedType}');
+ RangeError('Value ($val) is not $wantedType');
bool _isSigned32(int value) => (-2147483648 <= value) && (value <= 2147483647);
diff --git a/protobuf/lib/src/protobuf/generated_message.dart b/protobuf/lib/src/protobuf/generated_message.dart
index 8bbbf5a..0f1446a 100644
--- a/protobuf/lib/src/protobuf/generated_message.dart
+++ b/protobuf/lib/src/protobuf/generated_message.dart
@@ -296,7 +296,7 @@
throw ArgumentError(
'Cannot add to a non-repeated field (use setExtension())');
}
- _fieldSet._ensureExtensions().._ensureRepeatedField(extension).add(value);
+ _fieldSet._ensureExtensions()._ensureRepeatedField(extension).add(value);
}
/// Clears an extension field and also removes the extension.
diff --git a/protobuf/lib/src/protobuf/mixins/map_mixin.dart b/protobuf/lib/src/protobuf/mixins/map_mixin.dart
index 2608fb0..2c32c71 100644
--- a/protobuf/lib/src/protobuf/mixins/map_mixin.dart
+++ b/protobuf/lib/src/protobuf/mixins/map_mixin.dart
@@ -32,7 +32,7 @@
var tag = getTagNumber(key as String);
if (tag == null) {
throw ArgumentError(
- "field '${key}' not found in ${info_.qualifiedMessageName}");
+ "field '$key' not found in ${info_.qualifiedMessageName}");
}
setField(tag, val);
}
diff --git a/protobuf/lib/src/protobuf/mixins/well_known.dart b/protobuf/lib/src/protobuf/mixins/well_known.dart
index 73b4980..496823f 100644
--- a/protobuf/lib/src/protobuf/mixins/well_known.dart
+++ b/protobuf/lib/src/protobuf/mixins/well_known.dart
@@ -46,7 +46,7 @@
static void packIntoAny(AnyMixin target, GeneratedMessage message,
{String typeUrlPrefix = 'type.googleapis.com'}) {
target.value = message.writeToBuffer();
- target.typeUrl = '${typeUrlPrefix}/${message.info_.qualifiedMessageName}';
+ target.typeUrl = '$typeUrlPrefix/${message.info_.qualifiedMessageName}';
}
// From google/protobuf/any.proto:
@@ -110,7 +110,7 @@
var info = typeRegistry.lookup(_typeNameFromUrl(typeUrl));
if (info == null) {
throw context.parseException(
- 'Decoding Any of type ${typeUrl} not in TypeRegistry $typeRegistry',
+ 'Decoding Any of type $typeUrl not in TypeRegistry $typeRegistry',
json);
}
@@ -166,8 +166,8 @@
}
static String _twoDigits(int n) {
- if (n >= 10) return '${n}';
- return '0${n}';
+ if (n >= 10) return '$n';
+ return '0$n';
}
static final DateTime _minTimestamp = DateTime.utc(1);
@@ -488,8 +488,9 @@
// The empty string splits to a single value. So this is a special case.
return;
}
- (message as FieldMaskMixin).paths
- ..addAll(json.split(',').map(_fromCamelCase));
+ (message as FieldMaskMixin)
+ .paths
+ .addAll(json.split(',').map(_fromCamelCase));
} else {
throw context.parseException(
'Expected String formatted as FieldMask', json);
diff --git a/protobuf/lib/src/protobuf/unknown_field_set.dart b/protobuf/lib/src/protobuf/unknown_field_set.dart
index 92ffdf4..3ec54cb 100644
--- a/protobuf/lib/src/protobuf/unknown_field_set.dart
+++ b/protobuf/lib/src/protobuf/unknown_field_set.dart
@@ -158,15 +158,15 @@
for (var value in field.values) {
if (value is UnknownFieldSet) {
stringBuffer
- ..write('${indent}${tag}: {\n')
+ ..write('$indent$tag: {\n')
..write(value._toString('$indent '))
- ..write('${indent}}\n');
+ ..write('$indent}\n');
} else {
if (value is ByteData) {
// TODO(antonm): fix for longs.
value = value.getUint64(0, Endian.little);
}
- stringBuffer.write('${indent}${tag}: ${value}\n');
+ stringBuffer.write('$indent$tag: $value\n');
}
}
}
diff --git a/protobuf/test/map_mixin_test.dart b/protobuf/test/map_mixin_test.dart
index e37529d..2e40c5b 100644
--- a/protobuf/test/map_mixin_test.dart
+++ b/protobuf/test/map_mixin_test.dart
@@ -24,7 +24,7 @@
Rec createEmptyInstance() => Rec();
@override
- String toString() => 'Rec(${val}, "${str}")';
+ String toString() => 'Rec($val, "$str")';
}
void main() {