enable lint prefer_interpolation_to_compose_strings (#83407)

This commit is contained in:
Alexandre Ardhuin
2021-06-01 20:14:06 +02:00
committed by GitHub
parent 71e711547f
commit 34059eec2c
96 changed files with 367 additions and 345 deletions

View File

@@ -36,9 +36,9 @@ class FloatToken extends NumberToken {
static double _parse(String stringRep) {
String toParse = stringRep;
if (toParse.startsWith('.'))
toParse = '0' + toParse;
toParse = '0$toParse';
if (toParse.endsWith('.'))
toParse = toParse + '0';
toParse = '${toParse}0';
return double.parse(toParse);
}
}
@@ -189,7 +189,8 @@ class CalcExpression {
case ExpressionState.LeadingNeg:
case ExpressionState.Number:
final ExpressionToken last = outList.removeLast()!;
newToken = FloatToken(last.stringRep! + '.');
final String value = last.stringRep!;
newToken = FloatToken('$value.');
break;
case ExpressionState.Point:
case ExpressionState.NumberWithPoint:

View File

@@ -220,7 +220,8 @@ class _ChipDemoState extends State<ChipDemo> {
if (_selectedAction.isEmpty) {
return '';
}
return _capitalize(_results[_selectedAction]!) + '!';
final String value = _capitalize(_results[_selectedAction]!);
return '$value!';
}
@override

View File

@@ -317,17 +317,20 @@ class _UsNumberTextInputFormatter extends TextInputFormatter {
selectionIndex++;
}
if (newTextLength >= 4) {
newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') ');
final String value = newValue.text.substring(0, usedSubstringIndex = 3);
newText.write('$value) ');
if (newValue.selection.end >= 3)
selectionIndex += 2;
}
if (newTextLength >= 7) {
newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-');
final String value = newValue.text.substring(3, usedSubstringIndex = 6);
newText.write('$value-');
if (newValue.selection.end >= 6)
selectionIndex++;
}
if (newTextLength >= 11) {
newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' ');
final String value = newValue.text.substring(6, usedSubstringIndex = 10);
newText.write('$value ');
if (newValue.selection.end >= 10)
selectionIndex++;
}