enable lint unnecessary_const (#19342)
This commit is contained in:
committed by
GitHub
parent
d10e46ea65
commit
cc1cf13eec
@@ -43,36 +43,36 @@ class ExtendedStandardMessageCodec extends StandardMessageCodec {
|
||||
|
||||
Future<TestStepResult> basicBinaryHandshake(ByteData message) async {
|
||||
const BasicMessageChannel<ByteData> channel =
|
||||
const BasicMessageChannel<ByteData>(
|
||||
BasicMessageChannel<ByteData>(
|
||||
'binary-msg',
|
||||
const BinaryCodec(),
|
||||
BinaryCodec(),
|
||||
);
|
||||
return _basicMessageHandshake<ByteData>(
|
||||
'Binary >${toString(message)}<', channel, message);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicStringHandshake(String message) async {
|
||||
const BasicMessageChannel<String> channel = const BasicMessageChannel<String>(
|
||||
const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
|
||||
'string-msg',
|
||||
const StringCodec(),
|
||||
StringCodec(),
|
||||
);
|
||||
return _basicMessageHandshake<String>('String >$message<', channel, message);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicJsonHandshake(dynamic message) async {
|
||||
const BasicMessageChannel<dynamic> channel =
|
||||
const BasicMessageChannel<dynamic>(
|
||||
BasicMessageChannel<dynamic>(
|
||||
'json-msg',
|
||||
const JSONMessageCodec(),
|
||||
JSONMessageCodec(),
|
||||
);
|
||||
return _basicMessageHandshake<dynamic>('JSON >$message<', channel, message);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicStandardHandshake(dynamic message) async {
|
||||
const BasicMessageChannel<dynamic> channel =
|
||||
const BasicMessageChannel<dynamic>(
|
||||
BasicMessageChannel<dynamic>(
|
||||
'std-msg',
|
||||
const ExtendedStandardMessageCodec(),
|
||||
ExtendedStandardMessageCodec(),
|
||||
);
|
||||
return _basicMessageHandshake<dynamic>(
|
||||
'Standard >${toString(message)}<', channel, message);
|
||||
@@ -80,35 +80,35 @@ Future<TestStepResult> basicStandardHandshake(dynamic message) async {
|
||||
|
||||
Future<TestStepResult> basicBinaryMessageToUnknownChannel() async {
|
||||
const BasicMessageChannel<ByteData> channel =
|
||||
const BasicMessageChannel<ByteData>(
|
||||
BasicMessageChannel<ByteData>(
|
||||
'binary-unknown',
|
||||
const BinaryCodec(),
|
||||
BinaryCodec(),
|
||||
);
|
||||
return _basicMessageToUnknownChannel<ByteData>('Binary', channel);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicStringMessageToUnknownChannel() async {
|
||||
const BasicMessageChannel<String> channel = const BasicMessageChannel<String>(
|
||||
const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
|
||||
'string-unknown',
|
||||
const StringCodec(),
|
||||
StringCodec(),
|
||||
);
|
||||
return _basicMessageToUnknownChannel<String>('String', channel);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicJsonMessageToUnknownChannel() async {
|
||||
const BasicMessageChannel<dynamic> channel =
|
||||
const BasicMessageChannel<dynamic>(
|
||||
BasicMessageChannel<dynamic>(
|
||||
'json-unknown',
|
||||
const JSONMessageCodec(),
|
||||
JSONMessageCodec(),
|
||||
);
|
||||
return _basicMessageToUnknownChannel<dynamic>('JSON', channel);
|
||||
}
|
||||
|
||||
Future<TestStepResult> basicStandardMessageToUnknownChannel() async {
|
||||
const BasicMessageChannel<dynamic> channel =
|
||||
const BasicMessageChannel<dynamic>(
|
||||
BasicMessageChannel<dynamic>(
|
||||
'std-unknown',
|
||||
const ExtendedStandardMessageCodec(),
|
||||
ExtendedStandardMessageCodec(),
|
||||
);
|
||||
return _basicMessageToUnknownChannel<dynamic>('Standard', channel);
|
||||
}
|
||||
|
||||
@@ -9,46 +9,46 @@ import 'test_step.dart';
|
||||
|
||||
Future<TestStepResult> methodCallJsonSuccessHandshake(dynamic payload) async {
|
||||
const MethodChannel channel =
|
||||
const MethodChannel('json-method', const JSONMethodCodec());
|
||||
MethodChannel('json-method', JSONMethodCodec());
|
||||
return _methodCallSuccessHandshake(
|
||||
'JSON success($payload)', channel, payload);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallJsonErrorHandshake(dynamic payload) async {
|
||||
const MethodChannel channel =
|
||||
const MethodChannel('json-method', const JSONMethodCodec());
|
||||
MethodChannel('json-method', JSONMethodCodec());
|
||||
return _methodCallErrorHandshake('JSON error($payload)', channel, payload);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallJsonNotImplementedHandshake() async {
|
||||
const MethodChannel channel =
|
||||
const MethodChannel('json-method', const JSONMethodCodec());
|
||||
MethodChannel('json-method', JSONMethodCodec());
|
||||
return _methodCallNotImplementedHandshake('JSON notImplemented()', channel);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallStandardSuccessHandshake(
|
||||
dynamic payload) async {
|
||||
const MethodChannel channel = const MethodChannel(
|
||||
const MethodChannel channel = MethodChannel(
|
||||
'std-method',
|
||||
const StandardMethodCodec(const ExtendedStandardMessageCodec()),
|
||||
StandardMethodCodec(ExtendedStandardMessageCodec()),
|
||||
);
|
||||
return _methodCallSuccessHandshake(
|
||||
'Standard success($payload)', channel, payload);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallStandardErrorHandshake(dynamic payload) async {
|
||||
const MethodChannel channel = const MethodChannel(
|
||||
const MethodChannel channel = MethodChannel(
|
||||
'std-method',
|
||||
const StandardMethodCodec(const ExtendedStandardMessageCodec()),
|
||||
StandardMethodCodec(ExtendedStandardMessageCodec()),
|
||||
);
|
||||
return _methodCallErrorHandshake(
|
||||
'Standard error($payload)', channel, payload);
|
||||
}
|
||||
|
||||
Future<TestStepResult> methodCallStandardNotImplementedHandshake() async {
|
||||
const MethodChannel channel = const MethodChannel(
|
||||
const MethodChannel channel = MethodChannel(
|
||||
'std-method',
|
||||
const StandardMethodCodec(const ExtendedStandardMessageCodec()),
|
||||
StandardMethodCodec(ExtendedStandardMessageCodec()),
|
||||
);
|
||||
return _methodCallNotImplementedHandshake(
|
||||
'Standard notImplemented()', channel);
|
||||
|
||||
@@ -25,8 +25,8 @@ const String nothing = '-';
|
||||
/// - The Flutter app records the incoming reply echo.
|
||||
/// - The platform finally replies to the original message with another echo.
|
||||
class TestStepResult {
|
||||
static const TextStyle bold = const TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = const TestStepResult(
|
||||
static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = TestStepResult(
|
||||
'Test complete',
|
||||
nothing,
|
||||
TestStatus.complete,
|
||||
|
||||
@@ -25,7 +25,7 @@ void main() {
|
||||
if (status != 'complete') {
|
||||
fail('Failed at step $step with status $status');
|
||||
}
|
||||
}, timeout: const Timeout(const Duration(minutes: 1)));
|
||||
}, timeout: const Timeout(Duration(minutes: 1)));
|
||||
|
||||
tearDownAll(() async {
|
||||
driver?.close();
|
||||
|
||||
@@ -19,7 +19,7 @@ class MyApp extends StatefulWidget {
|
||||
State createState() => new MyAppState();
|
||||
}
|
||||
|
||||
const MethodChannel channel = const MethodChannel('texture');
|
||||
const MethodChannel channel = MethodChannel('texture');
|
||||
|
||||
enum FrameState { initial, slow, afterSlow, fast, afterFast }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:test/test.dart';
|
||||
|
||||
final RegExp calibrationRegExp = new RegExp('Flutter frame rate is (.*)fps');
|
||||
final RegExp statsRegExp = new RegExp('Produced: (.*)fps\nConsumed: (.*)fps\nWidget builds: (.*)');
|
||||
const Duration samplingTime = const Duration(seconds: 8);
|
||||
const Duration samplingTime = Duration(seconds: 8);
|
||||
|
||||
Future<Null> main() async {
|
||||
group('texture suite', () {
|
||||
@@ -58,7 +58,7 @@ Future<Null> main() async {
|
||||
expect(double.parse(matchFast.group(1)), closeTo(flutterFrameRate * 2.0, 5.0));
|
||||
expect(double.parse(matchFast.group(2)), closeTo(flutterFrameRate, 10.0));
|
||||
expect(int.parse(matchFast.group(3)), 1);
|
||||
}, timeout: const Timeout(const Duration(minutes: 1)));
|
||||
}, timeout: const Timeout(Duration(minutes: 1)));
|
||||
|
||||
tearDownAll(() async {
|
||||
driver?.close();
|
||||
|
||||
@@ -7,9 +7,9 @@ import 'package:flutter/services.dart';
|
||||
import 'test_step.dart';
|
||||
|
||||
Future<TestStepResult> systemNavigatorPop() {
|
||||
const BasicMessageChannel<String> channel = const BasicMessageChannel<String>(
|
||||
const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
|
||||
'navigation-test',
|
||||
const StringCodec(),
|
||||
StringCodec(),
|
||||
);
|
||||
|
||||
final Completer<TestStepResult> completer = new Completer<TestStepResult>();
|
||||
|
||||
@@ -13,8 +13,8 @@ typedef Future<TestStepResult> TestStep();
|
||||
const String nothing = '-';
|
||||
|
||||
class TestStepResult {
|
||||
static const TextStyle bold = const TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = const TestStepResult(
|
||||
static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = TestStepResult(
|
||||
'Test complete',
|
||||
nothing,
|
||||
TestStatus.complete,
|
||||
|
||||
@@ -40,7 +40,7 @@ class DriverTestAppState extends State<DriverTestApp> {
|
||||
new RaisedButton(
|
||||
child: const Text(
|
||||
'toggle',
|
||||
key: const ValueKey<String>('togglePresent'),
|
||||
key: ValueKey<String>('togglePresent'),
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
@@ -53,7 +53,7 @@ class DriverTestAppState extends State<DriverTestApp> {
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
const Expanded(
|
||||
child: const Text('hit testability'),
|
||||
child: Text('hit testability'),
|
||||
),
|
||||
new DropdownButton<Letter>(
|
||||
key: const ValueKey<String>('dropdown'),
|
||||
@@ -64,24 +64,24 @@ class DriverTestAppState extends State<DriverTestApp> {
|
||||
});
|
||||
},
|
||||
items: const <DropdownMenuItem<Letter>>[
|
||||
const DropdownMenuItem<Letter>(
|
||||
DropdownMenuItem<Letter>(
|
||||
value: Letter.a,
|
||||
child: const Text('Aaa', key: const ValueKey<String>('a')),
|
||||
child: Text('Aaa', key: ValueKey<String>('a')),
|
||||
),
|
||||
const DropdownMenuItem<Letter>(
|
||||
DropdownMenuItem<Letter>(
|
||||
value: Letter.b,
|
||||
child: const Text('Bbb', key: const ValueKey<String>('b')),
|
||||
child: Text('Bbb', key: ValueKey<String>('b')),
|
||||
),
|
||||
const DropdownMenuItem<Letter>(
|
||||
DropdownMenuItem<Letter>(
|
||||
value: Letter.c,
|
||||
child: const Text('Ccc', key: const ValueKey<String>('c')),
|
||||
child: Text('Ccc', key: ValueKey<String>('c')),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const TextField(
|
||||
key: const ValueKey<String>('enter-text-field'),
|
||||
key: ValueKey<String>('enter-text-field'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -60,7 +60,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
height: MediaQuery.of(context).size.height,
|
||||
),
|
||||
const TextField(
|
||||
key: const ValueKey<String>(keys.kDefaultTextField),
|
||||
key: ValueKey<String>(keys.kDefaultTextField),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() => runApp(const Center(child: const Text(
|
||||
void main() => runApp(const Center(child: Text(
|
||||
'flutter drive lib/xxx.dart',
|
||||
textDirection: TextDirection.ltr,
|
||||
)));
|
||||
|
||||
@@ -41,6 +41,6 @@ void main() {
|
||||
|
||||
imageBefore = imageAfter;
|
||||
}
|
||||
}, timeout: const Timeout(const Duration(minutes: 2)));
|
||||
}, timeout: const Timeout(Duration(minutes: 2)));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user