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

@@ -11,12 +11,12 @@ import 'package:flutter_driver/driver_extension.dart';
void main() {
enableFlutterDriverExtension();
debugPrint('Application starting...');
runApp(new MyApp());
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
State createState() => new MyAppState();
State createState() => MyAppState();
}
const MethodChannel channel = MethodChannel('texture');
@@ -92,7 +92,7 @@ Widget builds: $_widgetBuilds''';
/// Measures Flutter's frame rate.
Future<Null> _calibrate() async {
debugPrint('Awaiting calm (3 second pause)...');
await new Future<Null>.delayed(const Duration(milliseconds: 3000));
await Future<Null>.delayed(const Duration(milliseconds: 3000));
debugPrint('Calibrating...');
DateTime startTime;
int tickCount = 0;
@@ -100,7 +100,7 @@ Widget builds: $_widgetBuilds''';
ticker = createTicker((Duration time) {
tickCount += 1;
if (tickCount == calibrationTickCount) { // about 10 seconds
final Duration elapsed = new DateTime.now().difference(startTime);
final Duration elapsed = DateTime.now().difference(startTime);
ticker.stop();
ticker.dispose();
setState(() {
@@ -118,7 +118,7 @@ Press play to produce texture frames.''';
}
});
ticker.start();
startTime = new DateTime.now();
startTime = DateTime.now();
setState(() {
_summary = 'Calibrating...';
_icon = null;
@@ -128,23 +128,23 @@ Press play to produce texture frames.''';
@override
Widget build(BuildContext context) {
_widgetBuilds += 1;
return new MaterialApp(
home: new Scaffold(
body: new Center(
child: new Column(
return MaterialApp(
home: Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Container(
Container(
width: 300.0,
height: 200.0,
child: const Texture(textureId: 0),
),
new Container(
Container(
width: 300.0,
height: 60.0,
color: Colors.grey,
child: new Center(
child: new Text(
child: Center(
child: Text(
_summary,
key: const ValueKey<String>('summary'),
),
@@ -153,9 +153,9 @@ Press play to produce texture frames.''';
],
),
),
floatingActionButton: _icon == null ? null : new FloatingActionButton(
floatingActionButton: _icon == null ? null : FloatingActionButton(
key: const ValueKey<String>('fab'),
child: new Icon(_icon),
child: Icon(_icon),
onPressed: _nextState,
),
),

View File

@@ -7,8 +7,8 @@ import 'dart:async';
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
final RegExp calibrationRegExp = new RegExp('Flutter frame rate is (.*)fps');
final RegExp statsRegExp = new RegExp('Produced: (.*)fps\nConsumed: (.*)fps\nWidget builds: (.*)');
final RegExp calibrationRegExp = RegExp('Flutter frame rate is (.*)fps');
final RegExp statsRegExp = RegExp('Produced: (.*)fps\nConsumed: (.*)fps\nWidget builds: (.*)');
const Duration samplingTime = Duration(seconds: 8);
Future<Null> main() async {
@@ -38,7 +38,7 @@ Future<Null> main() async {
// Texture frame stats at 0.5x Flutter frame rate
await driver.tap(fab);
await new Future<Null>.delayed(samplingTime);
await Future<Null>.delayed(samplingTime);
await driver.tap(fab);
final String statsSlow = await driver.getText(summary);
@@ -50,7 +50,7 @@ Future<Null> main() async {
// Texture frame stats at 2.0x Flutter frame rate
await driver.tap(fab);
await new Future<Null>.delayed(samplingTime);
await Future<Null>.delayed(samplingTime);
await driver.tap(fab);
final String statsFast = await driver.getText(summary);