Unnecessary new (#20138)

* enable lint unnecessary_new

* fix tests

* fix tests

* fix tests
This commit is contained in:
Alexandre Ardhuin
2018-09-12 08:29:29 +02:00
committed by GitHub
parent d7a0dcaa4a
commit d927c93310
1285 changed files with 26519 additions and 26519 deletions

View File

@@ -12,12 +12,12 @@ import 'src/test_step.dart';
void main() {
enableFlutterDriverExtension();
runApp(new TestApp());
runApp(TestApp());
}
class TestApp extends StatefulWidget {
@override
_TestAppState createState() => new _TestAppState();
_TestAppState createState() => _TestAppState();
}
class _TestAppState extends State<TestApp> {
@@ -37,7 +37,7 @@ class _TestAppState extends State<TestApp> {
if (_step < steps.length)
_result = steps[_step++]();
else
_result = new Future<TestStepResult>.value(TestStepResult.complete);
_result = Future<TestStepResult>.value(TestStepResult.complete);
});
}
@@ -45,25 +45,25 @@ class _TestAppState extends State<TestApp> {
BuildContext context,
AsyncSnapshot<TestStepResult> snapshot,
) {
return new TestStepResult.fromSnapshot(snapshot).asWidget(context);
return TestStepResult.fromSnapshot(snapshot).asWidget(context);
}
@override
Widget build(BuildContext context) {
return new MaterialApp(
return MaterialApp(
title: 'Platform Interaction Test',
home: new Scaffold(
appBar: new AppBar(
home: Scaffold(
appBar: AppBar(
title: const Text('Platform Interaction Test'),
),
body: new Padding(
body: Padding(
padding: const EdgeInsets.all(20.0),
child: new FutureBuilder<TestStepResult>(
child: FutureBuilder<TestStepResult>(
future: _result,
builder: _buildTestResultWidget,
),
),
floatingActionButton: new FloatingActionButton(
floatingActionButton: FloatingActionButton(
key: const ValueKey<String>('step'),
onPressed: _executeNextStep,
child: const Icon(Icons.navigate_next),

View File

@@ -12,7 +12,7 @@ Future<TestStepResult> systemNavigatorPop() {
StringCodec(),
);
final Completer<TestStepResult> completer = new Completer<TestStepResult>();
final Completer<TestStepResult> completer = Completer<TestStepResult>();
channel.setMessageHandler((String message) async {
completer.complete(

View File

@@ -46,15 +46,15 @@ class TestStepResult {
final TestStatus status;
Widget asWidget(BuildContext context) {
return new Column(
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text('Step: $name', style: bold),
new Text(description),
Text('Step: $name', style: bold),
Text(description),
const Text(' '),
new Text(
Text(
status.toString().substring('TestStatus.'.length),
key: new ValueKey<String>(
key: ValueKey<String>(
status == TestStatus.pending ? 'nostatus' : 'status'),
style: bold,
),