enable lint unnecessary_const (#19342)

This commit is contained in:
Alexandre Ardhuin
2018-07-16 21:43:48 +02:00
committed by GitHub
parent d10e46ea65
commit cc1cf13eec
556 changed files with 40458 additions and 40457 deletions

View File

@@ -14,13 +14,13 @@ void main() {
));
expect(find.text('test'), findsOneWidget);
});
testWidgets('finds Text.rich widgets', (WidgetTester tester) async {
await tester.pumpWidget(_boilerplate(
const Text.rich(
TextSpan(text: 't', children: <TextSpan>[
const TextSpan(text: 'e'),
const TextSpan(text: 'st'),
TextSpan(text: 'e'),
TextSpan(text: 'st'),
]
),
)));

View File

@@ -12,7 +12,7 @@ import 'package:test/test.dart' hide test;
import 'package:flutter_test/flutter_test.dart' show goldenFileComparator, LocalFileComparator;
const List<int> _kExpectedBytes = const <int>[1, 2, 3];
const List<int> _kExpectedBytes = <int>[1, 2, 3];
void main() {
MemoryFileSystem fs;
@@ -171,14 +171,14 @@ void main() {
group('update', () {
test('updates existing file', () async {
fs.file(fix('/golden.png')).writeAsBytesSync(_kExpectedBytes);
const List<int> newBytes = const <int>[11, 12, 13];
const List<int> newBytes = <int>[11, 12, 13];
await comparator.update(fs.file('golden.png').uri, new Uint8List.fromList(newBytes));
expect(fs.file(fix('/golden.png')).readAsBytesSync(), newBytes);
});
test('creates non-existent file', () async {
expect(fs.file(fix('/foo.png')).existsSync(), isFalse);
const List<int> newBytes = const <int>[11, 12, 13];
const List<int> newBytes = <int>[11, 12, 13];
await comparator.update(fs.file('foo.png').uri, new Uint8List.fromList(newBytes));
expect(fs.file(fix('/foo.png')).existsSync(), isTrue);
expect(fs.file(fix('/foo.png')).readAsBytesSync(), newBytes);

View File

@@ -359,7 +359,7 @@ void main() {
testWidgets('if finder finds multiple widgets', (WidgetTester tester) async {
await tester.pumpWidget(boilerplate(new Column(
children: const <Widget>[const Text('hello'), const Text('world')],
children: const <Widget>[Text('hello'), Text('world')],
)));
final Finder finder = find.byType(Text);
try {
@@ -387,7 +387,7 @@ void main() {
group('matchesSemanticsData', () {
testWidgets('matches SemanticsData', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
const Key key = const Key('semantics');
const Key key = Key('semantics');
await tester.pumpWidget(new Semantics(
key: key,
namesRoute: true,

View File

@@ -12,7 +12,7 @@ void main() {
// Setup a widget that can receive focus so that we can open the keyboard.
final Widget widget = new MaterialApp(
home: const Material(
child: const TextField(),
child: TextField(),
),
);
await tester.pumpWidget(widget);

View File

@@ -13,9 +13,9 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:test/test.dart' as test_package;
import 'package:test/src/frontend/async_matcher.dart' show AsyncMatcher;
const List<Widget> fooBarTexts = const <Text>[
const Text('foo', textDirection: TextDirection.ltr),
const Text('bar', textDirection: TextDirection.ltr),
const List<Widget> fooBarTexts = <Text>[
Text('foo', textDirection: TextDirection.ltr),
Text('bar', textDirection: TextDirection.ltr),
];
void main() {
@@ -214,7 +214,7 @@ void main() {
await tester.pumpWidget(new Row(
textDirection: TextDirection.ltr,
children: <Widget>[
new Column(children: const <Text>[const Text('foo', textDirection: TextDirection.ltr)]),
new Column(children: const <Text>[Text('foo', textDirection: TextDirection.ltr)]),
const Text('bar', textDirection: TextDirection.ltr),
],
));
@@ -276,7 +276,7 @@ void main() {
await tester.pumpWidget(new Row(
textDirection: TextDirection.ltr,
children: <Widget>[
new Column(children: const <Text>[const Text('foo', textDirection: TextDirection.ltr)]),
new Column(children: const <Text>[Text('foo', textDirection: TextDirection.ltr)]),
const Text('bar', textDirection: TextDirection.ltr),
],
));
@@ -391,7 +391,7 @@ void main() {
builder: (BuildContext context) {
return new CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
middle: const Text('Page 2'),
middle: Text('Page 2'),
),
child: new Container(),
);
@@ -535,7 +535,7 @@ void main() {
await tester.pumpWidget(
new MaterialApp(
home: const Scaffold(
body: const Text('hello'),
body: Text('hello'),
),
),
);
@@ -552,8 +552,8 @@ void main() {
home: new Scaffold(
body: new Row(
children: const <Widget>[
const Text('hello'),
const Text('hello'),
Text('hello'),
Text('hello'),
],
),
),
@@ -590,7 +590,7 @@ void main() {
testWidgets('Returns merged SemanticsData', (WidgetTester tester) async {
final SemanticsHandle semanticsHandle = tester.ensureSemantics();
const Key key = const Key('test');
const Key key = Key('test');
await tester.pumpWidget(
new MaterialApp(
home: new Scaffold(