prefer_const_declarations on local variables (#14358)
diff --git a/dev/devicelab/test/run_test.dart b/dev/devicelab/test/run_test.dart
index db11eb7..61ab776 100644
--- a/dev/devicelab/test/run_test.dart
+++ b/dev/devicelab/test/run_test.dart
@@ -10,7 +10,7 @@
import 'package:test/test.dart';
void main() {
- final ProcessManager processManager = const LocalProcessManager();
+ const ProcessManager processManager = const LocalProcessManager();
group('run.dart script', () {
Future<int> runScript(List<String> testNames) async {
diff --git a/dev/tools/dartdoc.dart b/dev/tools/dartdoc.dart
index fabc95b..3a5ddad 100644
--- a/dev/tools/dartdoc.dart
+++ b/dev/tools/dartdoc.dart
@@ -256,7 +256,7 @@
}
void putRedirectInOldIndexLocation() {
- final String metaTag = '<meta http-equiv="refresh" content="0;URL=../index.html">';
+ const String metaTag = '<meta http-equiv="refresh" content="0;URL=../index.html">';
new File('$kDocRoot/flutter/index.html').writeAsStringSync(metaTag);
}
diff --git a/dev/tools/gen_localizations.dart b/dev/tools/gen_localizations.dart
index 948d7b5..05fcc56 100644
--- a/dev/tools/gen_localizations.dart
+++ b/dev/tools/gen_localizations.dart
@@ -271,7 +271,7 @@
validateLocalizations(localeToResources, localeToResourceAttributes)
);
- final String regenerate = 'dart dev/tools/gen_localizations.dart --overwrite';
+ const String regenerate = 'dart dev/tools/gen_localizations.dart --overwrite';
final StringBuffer buffer = new StringBuffer();
buffer.writeln(outputHeader.replaceFirst('@(regenerate)', regenerate));
buffer.write(generateTranslationBundles());
diff --git a/dev/tools/vitool/test/vitool_test.dart b/dev/tools/vitool/test/vitool_test.dart
index b915ca9..73a89d0 100644
--- a/dev/tools/vitool/test/vitool_test.dart
+++ b/dev/tools/vitool/test/vitool_test.dart
@@ -210,7 +210,7 @@
group('create PathAnimation', () {
test('single path', () {
- final List<FrameData> frameData = const <FrameData>[
+ const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
@@ -240,7 +240,7 @@
});
test('multiple paths', () {
- final List<FrameData> frameData = const <FrameData>[
+ const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
@@ -283,7 +283,7 @@
});
test('multiple frames', () {
- final List<FrameData> frameData = const <FrameData>[
+ const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
@@ -326,7 +326,7 @@
group('create Animation', () {
test('multiple paths', () {
- final List<FrameData> frameData = const <FrameData>[
+ const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
@@ -374,7 +374,7 @@
group('toDart', () {
test('_PathMoveTo', () {
- final PathCommandAnimation command = const PathCommandAnimation(
+ const PathCommandAnimation command = const PathCommandAnimation(
'M',
const <List<Point<double>>>[
const <Point<double>>[
@@ -396,7 +396,7 @@
});
test('_PathLineTo', () {
- final PathCommandAnimation command = const PathCommandAnimation(
+ const PathCommandAnimation command = const PathCommandAnimation(
'L',
const <List<Point<double>>>[
const <Point<double>>[
@@ -418,7 +418,7 @@
});
test('_PathCubicTo', () {
- final PathCommandAnimation command = const PathCommandAnimation(
+ const PathCommandAnimation command = const PathCommandAnimation(
'C',
const <List<Point<double>>>[
const <Point<double>>[
@@ -456,7 +456,7 @@
});
test('_PathClose', () {
- final PathCommandAnimation command = const PathCommandAnimation(
+ const PathCommandAnimation command = const PathCommandAnimation(
'Z',
const <List<Point<double>>>[],
);
@@ -469,7 +469,7 @@
});
test('Unsupported path command', () {
- final PathCommandAnimation command = const PathCommandAnimation(
+ const PathCommandAnimation command = const PathCommandAnimation(
'h',
const <List<Point<double>>>[],
);
@@ -481,7 +481,7 @@
});
test('_PathFrames', () {
- final PathAnimation pathAnimation = const PathAnimation(
+ const PathAnimation pathAnimation = const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
@@ -524,7 +524,7 @@
});
test('Animation', () {
- final Animation animation = const Animation(
+ const Animation animation = const Animation(
const Point<double>(48.0, 48.0),
const <PathAnimation>[
const PathAnimation(
diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
index 9517a51..05a08e1 100644
--- a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
+++ b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
@@ -113,8 +113,8 @@
final double imageWidth = (landscape ? size.width / 2.0 : size.width) - margin * 2.0;
final BoxConstraints imageConstraints = new BoxConstraints(maxHeight: 224.0, maxWidth: imageWidth);
final Size imageSize = layoutChild(image, imageConstraints);
- final double imageY = 0.0;
- positionChild(image, new Offset(margin, imageY));
+ const double imageY = 0.0;
+ positionChild(image, const Offset(margin, imageY));
final double productWidth = landscape ? size.width / 2.0 : size.width - margin;
final BoxConstraints productConstraints = new BoxConstraints(maxWidth: productWidth);
diff --git a/examples/flutter_gallery/test/smoke_test.dart b/examples/flutter_gallery/test/smoke_test.dart
index 197885b..e06afbb 100644
--- a/examples/flutter_gallery/test/smoke_test.dart
+++ b/examples/flutter_gallery/test/smoke_test.dart
@@ -32,7 +32,7 @@
// If you're on line 12, then it has index 11.
// If you want 1 line before and 1 line after, then you want lines with index 10, 11, and 12.
// That's (lineNumber-1)-margin .. (lineNumber-1)+margin, or lineNumber-(margin+1) .. lineNumber+(margin-1)
- final int margin = 5;
+ const int margin = 5;
final int firstLine = math.max(0, lineNumber - margin);
final int lastLine = math.min(lines.length, lineNumber + margin);
print('$name : $route : line $lineNumber of ${lines.length} : $message; nearby lines were:\n ${lines.sublist(firstLine, lastLine).join("\n ")}');
diff --git a/examples/stocks/lib/stock_arrow.dart b/examples/stocks/lib/stock_arrow.dart
index bb6a5a4..27c9cdd 100644
--- a/examples/stocks/lib/stock_arrow.dart
+++ b/examples/stocks/lib/stock_arrow.dart
@@ -23,7 +23,7 @@
final double centerY = padding + r;
// Draw the arrow.
- final double w = 8.0;
+ const double w = 8.0;
double h = 5.0;
double arrowY;
if (percentChange < 0.0) {
@@ -58,7 +58,7 @@
final double percentChange;
int _colorIndexForPercentChange(double percentChange) {
- final double maxPercent = 10.0;
+ const double maxPercent = 10.0;
final double normalizedPercentChange = math.min(percentChange.abs(), maxPercent) / maxPercent;
return 100 + (normalizedPercentChange * 8.0).floor() * 100;
}
diff --git a/examples/stocks/lib/stock_data.dart b/examples/stocks/lib/stock_data.dart
index 57243b6..0c2d7ad 100644
--- a/examples/stocks/lib/stock_data.dart
+++ b/examples/stocks/lib/stock_data.dart
@@ -85,7 +85,7 @@
_end();
return;
}
- final JsonDecoder decoder = const JsonDecoder();
+ const JsonDecoder decoder = const JsonDecoder();
add(decoder.convert(json));
if (_nextChunk < _kChunkCount) {
_fetchNextChunk();
diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart
index 93b52e1..bb2f22d 100644
--- a/packages/flutter/lib/src/foundation/diagnostics.dart
+++ b/packages/flutter/lib/src/foundation/diagnostics.dart
@@ -918,7 +918,7 @@
if (i > 0)
builder.write(config.propertySeparator);
- final int kWrapWidth = 65;
+ const int kWrapWidth = 65;
if (property.style != DiagnosticsTreeStyle.singleLine) {
final TextTreeConfiguration propertyStyle = property.textTreeConfiguration;
builder.writeRaw(property.toStringDeep(
diff --git a/packages/flutter/lib/src/material/checkbox.dart b/packages/flutter/lib/src/material/checkbox.dart
index 5f65e0c..5865e50 100644
--- a/packages/flutter/lib/src/material/checkbox.dart
+++ b/packages/flutter/lib/src/material/checkbox.dart
@@ -210,9 +210,9 @@
..style = PaintingStyle.stroke
..strokeWidth = _kStrokeWidth;
final Path path = new Path();
- final Offset start = const Offset(_kEdgeSize * 0.15, _kEdgeSize * 0.45);
- final Offset mid = const Offset(_kEdgeSize * 0.4, _kEdgeSize * 0.7);
- final Offset end = const Offset(_kEdgeSize * 0.85, _kEdgeSize * 0.25);
+ const Offset start = const Offset(_kEdgeSize * 0.15, _kEdgeSize * 0.45);
+ const Offset mid = const Offset(_kEdgeSize * 0.4, _kEdgeSize * 0.7);
+ const Offset end = const Offset(_kEdgeSize * 0.85, _kEdgeSize * 0.25);
final Offset drawStart = Offset.lerp(start, mid, 1.0 - value);
final Offset drawEnd = Offset.lerp(mid, end, value);
path.moveTo(offsetX + drawStart.dx, offsetY + drawStart.dy);
diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart
index d9761d8..91a2394 100644
--- a/packages/flutter/lib/src/material/data_table.dart
+++ b/packages/flutter/lib/src/material/data_table.dart
@@ -401,7 +401,7 @@
down: sorted ? ascending : null,
duration: _kSortArrowAnimationDuration,
);
- final Widget arrowPadding = const SizedBox(width: _kSortArrowPadding);
+ const Widget arrowPadding = const SizedBox(width: _kSortArrowPadding);
label = new Row(
textDirection: numeric ? TextDirection.rtl : null,
children: <Widget>[ label, arrowPadding, arrow ],
@@ -453,7 +453,7 @@
}) {
final bool isLightTheme = Theme.of(context).brightness == Brightness.light;
if (showEditIcon) {
- final Widget icon = const Icon(Icons.edit, size: 18.0);
+ const Widget icon = const Icon(Icons.edit, size: 18.0);
label = new Expanded(child: label);
label = new Row(
textDirection: numeric ? TextDirection.rtl : null,
diff --git a/packages/flutter/lib/src/material/flexible_space_bar.dart b/packages/flutter/lib/src/material/flexible_space_bar.dart
index aa67b48..e375894 100644
--- a/packages/flutter/lib/src/material/flexible_space_bar.dart
+++ b/packages/flutter/lib/src/material/flexible_space_bar.dart
@@ -122,7 +122,7 @@
// background image
if (widget.background != null) {
final double fadeStart = math.max(0.0, 1.0 - kToolbarHeight / deltaExtent);
- final double fadeEnd = 1.0;
+ const double fadeEnd = 1.0;
assert(fadeStart <= fadeEnd);
final double opacity = 1.0 - new Interval(fadeStart, fadeEnd).transform(t);
final double parallax = new Tween<double>(begin: 0.0, end: deltaExtent / 4.0).lerp(t);
diff --git a/packages/flutter/lib/src/widgets/focus_manager.dart b/packages/flutter/lib/src/widgets/focus_manager.dart
index b1bd87f..04dd966 100644
--- a/packages/flutter/lib/src/widgets/focus_manager.dart
+++ b/packages/flutter/lib/src/widgets/focus_manager.dart
@@ -453,7 +453,7 @@
@override
String toString() {
final String status = _haveScheduledUpdate ? ' UPDATE SCHEDULED' : '';
- final String indent = ' ';
+ const String indent = ' ';
return '${describeIdentity(this)}$status\n'
'${indent}currentFocus: $_currentFocus\n'
'${rootScope.toStringDeep(prefixLineOne: indent, prefixOtherLines: indent)}';
diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart
index 771fcc7..2b13882 100644
--- a/packages/flutter/lib/src/widgets/widget_inspector.dart
+++ b/packages/flutter/lib/src/widgets/widget_inspector.dart
@@ -954,7 +954,7 @@
final Rect targetRect = MatrixUtils.transformRect(
state.selected.transform, state.selected.rect);
final Offset target = new Offset(targetRect.left, targetRect.center.dy);
- final double offsetFromWidget = 9.0;
+ const double offsetFromWidget = 9.0;
final double verticalOffset = (targetRect.height) / 2 + offsetFromWidget;
_paintDescription(canvas, state.tooltip, state.textDirection, target, verticalOffset, size, targetRect);
diff --git a/packages/flutter/test/animation/curves_test.dart b/packages/flutter/test/animation/curves_test.dart
index 6403fce..7af7305 100644
--- a/packages/flutter/test/animation/curves_test.dart
+++ b/packages/flutter/test/animation/curves_test.dart
@@ -26,7 +26,7 @@
});
test('Threshold has a threshold', () {
- final Curve step = const Threshold(0.25);
+ const Curve step = const Threshold(0.25);
expect(step.transform(0.0), 0.0);
expect(step.transform(0.24), 0.0);
expect(step.transform(0.25), 1.0);
diff --git a/packages/flutter/test/cupertino/button_test.dart b/packages/flutter/test/cupertino/button_test.dart
index 6f2e1f1..246d21e 100644
--- a/packages/flutter/test/cupertino/button_test.dart
+++ b/packages/flutter/test/cupertino/button_test.dart
@@ -33,9 +33,9 @@
});
testWidgets('Minimum size parameter', (WidgetTester tester) async {
- final double minSize = 60.0;
+ const double minSize = 60.0;
await tester.pumpWidget(
- boilerplate(child: new CupertinoButton(
+ boilerplate(child: const CupertinoButton(
child: const Text('X', style: testStyle),
onPressed: null,
minSize: minSize,
@@ -45,7 +45,7 @@
expect(
buttonBox.size,
// 1 10px character + 16px * 2 is smaller than defined 60.0px minimum
- new Size.square(minSize),
+ const Size.square(minSize),
);
});
@@ -150,7 +150,7 @@
});
testWidgets('pressedOpacity parameter', (WidgetTester tester) async {
- final double pressedOpacity = 0.5;
+ const double pressedOpacity = 0.5;
await tester.pumpWidget(boilerplate(child: new CupertinoButton(
pressedOpacity: pressedOpacity,
child: const Text('Tap me'),
diff --git a/packages/flutter/test/cupertino/scaffold_test.dart b/packages/flutter/test/cupertino/scaffold_test.dart
index 602f9ad..eceea19 100644
--- a/packages/flutter/test/cupertino/scaffold_test.dart
+++ b/packages/flutter/test/cupertino/scaffold_test.dart
@@ -34,7 +34,7 @@
});
testWidgets('Contents are between opaque bars', (WidgetTester tester) async {
- final Center page1Center = const Center();
+ const Center page1Center = const Center();
await tester.pumpWidget(
new WidgetsApp(
@@ -59,7 +59,7 @@
),
tabBuilder: (BuildContext context, int index) {
return index == 0
- ? new CupertinoPageScaffold(
+ ? const CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
backgroundColor: CupertinoColors.white,
middle: const Text('Title'),
diff --git a/packages/flutter/test/engine/color_test.dart b/packages/flutter/test/engine/color_test.dart
index 888cbd7..cb7c51e 100644
--- a/packages/flutter/test/engine/color_test.dart
+++ b/packages/flutter/test/engine/color_test.dart
@@ -8,7 +8,7 @@
void main() {
test('color accessors should work', () {
- final Color foo = const Color(0x12345678);
+ const Color foo = const Color(0x12345678);
expect(foo.alpha, equals(0x12));
expect(foo.red, equals(0x34));
expect(foo.green, equals(0x56));
@@ -16,7 +16,7 @@
});
test('paint set to black', () {
- final Color c = const Color(0x00000000);
+ const Color c = const Color(0x00000000);
final Paint p = new Paint();
p.color = c;
expect(c.toString(), equals('Color(0x00000000)'));
@@ -24,7 +24,7 @@
test('color created with out of bounds value', () {
try {
- final Color c = const Color(0x100 << 24);
+ const Color c = const Color(0x100 << 24);
final Paint p = new Paint();
p.color = c;
} catch (e) {
@@ -34,7 +34,7 @@
test('color created with wildly out of bounds value', () {
try {
- final Color c = const Color(1 << 1000000);
+ const Color c = const Color(1 << 1000000);
final Paint p = new Paint();
p.color = c;
} catch (e) {
diff --git a/packages/flutter/test/foundation/diagnostics_test.dart b/packages/flutter/test/foundation/diagnostics_test.dart
index cc015a0..794de1c 100644
--- a/packages/flutter/test/foundation/diagnostics_test.dart
+++ b/packages/flutter/test/foundation/diagnostics_test.dart
@@ -1332,7 +1332,7 @@
test('color property test', () {
// Add more tests if colorProperty becomes more than a wrapper around
// objectProperty.
- final Color color = const Color.fromARGB(255, 255, 255, 255);
+ const Color color = const Color.fromARGB(255, 255, 255, 255);
final DiagnosticsProperty<Color> simple = new DiagnosticsProperty<Color>(
'name',
color,
diff --git a/packages/flutter/test/gestures/debug_test.dart b/packages/flutter/test/gestures/debug_test.dart
index fdf6dcd..3c9ecf9 100644
--- a/packages/flutter/test/gestures/debug_test.dart
+++ b/packages/flutter/test/gestures/debug_test.dart
@@ -149,7 +149,7 @@
test('TapGestureRecognizer _sentTapDown toString', () {
final TapGestureRecognizer tap = new TapGestureRecognizer();
expect(tap.toString(), equalsIgnoringHashCodes('TapGestureRecognizer#00000(state: ready)'));
- final PointerEvent event = const PointerDownEvent(pointer: 1, position: const Offset(10.0, 10.0));
+ const PointerEvent event = const PointerDownEvent(pointer: 1, position: const Offset(10.0, 10.0));
tap.addPointer(event);
tap.didExceedDeadline();
expect(tap.toString(), equalsIgnoringHashCodes('TapGestureRecognizer#00000(state: possible, sent tap down)'));
diff --git a/packages/flutter/test/gestures/gesture_binding_test.dart b/packages/flutter/test/gestures/gesture_binding_test.dart
index 1c97204..8af8b29 100644
--- a/packages/flutter/test/gestures/gesture_binding_test.dart
+++ b/packages/flutter/test/gestures/gesture_binding_test.dart
@@ -32,7 +32,7 @@
setUp(ensureTestGestureBinding);
test('Pointer tap events', () {
- final ui.PointerDataPacket packet = const ui.PointerDataPacket(
+ const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.up),
@@ -49,7 +49,7 @@
});
test('Pointer move events', () {
- final ui.PointerDataPacket packet = const ui.PointerDataPacket(
+ const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.move),
@@ -95,7 +95,7 @@
});
test('Pointer cancel events', () {
- final ui.PointerDataPacket packet = const ui.PointerDataPacket(
+ const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.cancel),
@@ -112,7 +112,7 @@
});
test('Can cancel pointers', () {
- final ui.PointerDataPacket packet = const ui.PointerDataPacket(
+ const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.up),
@@ -133,7 +133,7 @@
});
test('Can expand add and hover pointers', () {
- final ui.PointerDataPacket packet = const ui.PointerDataPacket(
+ const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.add, device: 24),
const ui.PointerData(change: ui.PointerChange.hover, device: 24),
diff --git a/packages/flutter/test/gestures/team_test.dart b/packages/flutter/test/gestures/team_test.dart
index c6ad758..5fd7625 100644
--- a/packages/flutter/test/gestures/team_test.dart
+++ b/packages/flutter/test/gestures/team_test.dart
@@ -28,7 +28,7 @@
tap.onTap = () { log.add('tap'); };
void test(Offset delta) {
- final Offset origin = const Offset(10.0, 10.0);
+ const Offset origin = const Offset(10.0, 10.0);
final TestPointer pointer = new TestPointer(5);
final PointerDownEvent down = pointer.down(origin);
horizontalDrag.addPointer(down);
diff --git a/packages/flutter/test/gestures/velocity_tracker_test.dart b/packages/flutter/test/gestures/velocity_tracker_test.dart
index ecc5513..7a1fa91 100644
--- a/packages/flutter/test/gestures/velocity_tracker_test.dart
+++ b/packages/flutter/test/gestures/velocity_tracker_test.dart
@@ -19,7 +19,7 @@
}
void main() {
- final List<Offset> expected = const <Offset>[
+ const List<Offset> expected = const <Offset>[
const Offset(219.5762939453125, 1304.6705322265625),
const Offset(355.6900939941406, 967.1700439453125),
const Offset(12.651158332824707, -36.9227180480957),
@@ -49,8 +49,8 @@
});
test('Velocity control test', () {
- final Velocity velocity1 = const Velocity(pixelsPerSecond: const Offset(7.0, 0.0));
- final Velocity velocity2 = const Velocity(pixelsPerSecond: const Offset(12.0, 0.0));
+ const Velocity velocity1 = const Velocity(pixelsPerSecond: const Offset(7.0, 0.0));
+ const Velocity velocity2 = const Velocity(pixelsPerSecond: const Offset(12.0, 0.0));
expect(velocity1, equals(const Velocity(pixelsPerSecond: const Offset(7.0, 0.0))));
expect(velocity1, isNot(equals(velocity2)));
expect(velocity2 - velocity1, equals(const Velocity(pixelsPerSecond: const Offset(5.0, 0.0))));
diff --git a/packages/flutter/test/material/animated_icons_private_test.dart b/packages/flutter/test/material/animated_icons_private_test.dart
index 5e5a24e..d92284c 100644
--- a/packages/flutter/test/material/animated_icons_private_test.dart
+++ b/packages/flutter/test/material/animated_icons_private_test.dart
@@ -46,7 +46,7 @@
void main () {
group('Interpolate points', () {
test('- single point', () {
- final List<Offset> points = const <Offset>[
+ const List<Offset> points = const <Offset>[
const Offset(25.0, 1.0),
];
expect(_interpolate(points, 0.0, Offset.lerp), const Offset(25.0, 1.0));
@@ -55,7 +55,7 @@
});
test('- two points', () {
- final List<Offset> points = const <Offset>[
+ const List<Offset> points = const <Offset>[
const Offset(25.0, 1.0),
const Offset(12.0, 12.0),
];
@@ -65,7 +65,7 @@
});
test('- three points', () {
- final List<Offset> points = const <Offset>[
+ const List<Offset> points = const <Offset>[
const Offset(25.0, 1.0),
const Offset(12.0, 12.0),
const Offset(23.0, 9.0),
@@ -79,7 +79,7 @@
});
group('_AnimatedIconPainter', () {
- final Size size = const Size(48.0, 48.0);
+ const Size size = const Size(48.0, 48.0);
final MockCanvas mockCanvas = new MockCanvas();
List<MockPath> generatedPaths;
final _UiPathFactory pathFactory = () {
diff --git a/packages/flutter/test/material/app_bar_test.dart b/packages/flutter/test/material/app_bar_test.dart
index c25777c..0b7e60e 100644
--- a/packages/flutter/test/material/app_bar_test.dart
+++ b/packages/flutter/test/material/app_bar_test.dart
@@ -627,7 +627,7 @@
expect(appBarIsVisible(tester), true);
expect(appBarHeight(tester), 128.0);
- final double initialAppBarHeight = 128.0;
+ const double initialAppBarHeight = 128.0;
final double initialTabBarHeight = tabBarHeight(tester);
// Scroll the not-pinned appbar, collapsing the expanded height. At this
@@ -660,7 +660,7 @@
expect(appBarIsVisible(tester), true);
expect(appBarHeight(tester), 128.0);
- final double initialAppBarHeight = 128.0;
+ const double initialAppBarHeight = 128.0;
final double initialTabBarHeight = tabBarHeight(tester);
// Scroll the floating-pinned appbar, collapsing the expanded height. At this
diff --git a/packages/flutter/test/material/arc_test.dart b/packages/flutter/test/material/arc_test.dart
index 51f98a4..3515416 100644
--- a/packages/flutter/test/material/arc_test.dart
+++ b/packages/flutter/test/material/arc_test.dart
@@ -68,8 +68,8 @@
});
test('MaterialPointArcTween', () {
- final Offset begin = const Offset(180.0, 110.0);
- final Offset end = const Offset(37.0, 250.0);
+ const Offset begin = const Offset(180.0, 110.0);
+ const Offset end = const Offset(37.0, 250.0);
MaterialPointArcTween tween = new MaterialPointArcTween(begin: begin, end: end);
expect(tween.lerp(0.0), begin);
diff --git a/packages/flutter/test/material/buttons_test.dart b/packages/flutter/test/material/buttons_test.dart
index 1e15978..e80977c 100644
--- a/packages/flutter/test/material/buttons_test.dart
+++ b/packages/flutter/test/material/buttons_test.dart
@@ -172,8 +172,8 @@
// This test is very similar to the '...explicit splashColor and highlightColor' test
// in icon_button_test.dart. If you change this one, you may want to also change that one.
testWidgets('MaterialButton with explicit splashColor and highlightColor', (WidgetTester tester) async {
- final Color directSplashColor = const Color(0xFF000011);
- final Color directHighlightColor = const Color(0xFF000011);
+ const Color directSplashColor = const Color(0xFF000011);
+ const Color directHighlightColor = const Color(0xFF000011);
Widget buttonWidget = new Material(
child: new Center(
@@ -207,8 +207,8 @@
..rrect(color: directHighlightColor)
);
- final Color themeSplashColor1 = const Color(0xFF001100);
- final Color themeHighlightColor1 = const Color(0xFF001100);
+ const Color themeSplashColor1 = const Color(0xFF001100);
+ const Color themeHighlightColor1 = const Color(0xFF001100);
buttonWidget = new Material(
child: new Center(
@@ -238,8 +238,8 @@
..rrect(color: themeHighlightColor1)
);
- final Color themeSplashColor2 = const Color(0xFF002200);
- final Color themeHighlightColor2 = const Color(0xFF002200);
+ const Color themeSplashColor2 = const Color(0xFF002200);
+ const Color themeHighlightColor2 = const Color(0xFF002200);
await tester.pumpWidget(
new Directionality(
diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart
index c05eb8a..c10e4d2 100644
--- a/packages/flutter/test/material/chip_test.dart
+++ b/packages/flutter/test/material/chip_test.dart
@@ -178,13 +178,13 @@
});
testWidgets('Chip in row works ok', (WidgetTester tester) async {
- final TextStyle style = const TextStyle(fontFamily: 'Ahem', fontSize: 10.0);
+ const TextStyle style = const TextStyle(fontFamily: 'Ahem', fontSize: 10.0);
await tester.pumpWidget(
new MaterialApp(
home: new Material(
child: new Row(
- children: <Widget>[
- new Chip(label: const Text('Test'), labelStyle: style),
+ children: const <Widget>[
+ const Chip(label: const Text('Test'), labelStyle: style),
],
),
),
@@ -196,8 +196,8 @@
new MaterialApp(
home: new Material(
child: new Row(
- children: <Widget>[
- new Flexible(child: new Chip(label: const Text('Test'), labelStyle: style)),
+ children: const <Widget>[
+ const Flexible(child: const Chip(label: const Text('Test'), labelStyle: style)),
],
),
),
@@ -209,8 +209,8 @@
new MaterialApp(
home: new Material(
child: new Row(
- children: <Widget>[
- new Expanded(child: new Chip(label: const Text('Test'), labelStyle: style)),
+ children: const <Widget>[
+ const Expanded(child: const Chip(label: const Text('Test'), labelStyle: style)),
],
),
),
diff --git a/packages/flutter/test/material/colors_test.dart b/packages/flutter/test/material/colors_test.dart
index 0d26b1c..e9ccadf 100644
--- a/packages/flutter/test/material/colors_test.dart
+++ b/packages/flutter/test/material/colors_test.dart
@@ -11,7 +11,7 @@
void main() {
test('MaterialColor basic functionality', () {
- final MaterialColor color = const MaterialColor(
+ const MaterialColor color = const MaterialColor(
500,
const <int, Color>{
50: const Color(50),
diff --git a/packages/flutter/test/material/drawer_test.dart b/packages/flutter/test/material/drawer_test.dart
index 50d483a..6efdfbd 100644
--- a/packages/flutter/test/material/drawer_test.dart
+++ b/packages/flutter/test/material/drawer_test.dart
@@ -7,7 +7,7 @@
void main() {
testWidgets('Drawer control test', (WidgetTester tester) async {
- final Key containerKey = const Key('container');
+ const Key containerKey = const Key('container');
await tester.pumpWidget(
new MaterialApp(
diff --git a/packages/flutter/test/material/dropdown_test.dart b/packages/flutter/test/material/dropdown_test.dart
index 3cf5692..c00a95b 100644
--- a/packages/flutter/test/material/dropdown_test.dart
+++ b/packages/flutter/test/material/dropdown_test.dart
@@ -207,7 +207,7 @@
// Regression test for https://github.com/flutter/flutter/issues/12053
// Positions a DropdownButton at the left and right edges of the screen,
// forcing it to be sized down to the viewport width
- final String value = 'foo';
+ const String value = 'foo';
final UniqueKey itemKey = new UniqueKey();
await tester.pumpWidget(
new MaterialApp(
@@ -220,7 +220,7 @@
new DropdownMenuItem<String>(
key: itemKey,
value: value,
- child: new Text(value),
+ child: const Text(value),
),
],
onChanged: (_) {},
@@ -293,7 +293,7 @@
for (TextDirection textDirection in TextDirection.values) {
testWidgets('Dropdown button aligns selected menu item ($textDirection)', (WidgetTester tester) async {
final Key buttonKey = new UniqueKey();
- final String value = 'two';
+ const String value = 'two';
Widget build() => buildFrame(buttonKey: buttonKey, value: value, textDirection: textDirection);
@@ -339,7 +339,7 @@
testWidgets('Dropdown button with isDense:true aligns selected menu item', (WidgetTester tester) async {
final Key buttonKey = new UniqueKey();
- final String value = 'two';
+ const String value = 'two';
Widget build() => buildFrame(buttonKey: buttonKey, value: value, isDense: true);
diff --git a/packages/flutter/test/material/expansion_tile_test.dart b/packages/flutter/test/material/expansion_tile_test.dart
index 77d4c6d..d35992f 100644
--- a/packages/flutter/test/material/expansion_tile_test.dart
+++ b/packages/flutter/test/material/expansion_tile_test.dart
@@ -7,13 +7,13 @@
import 'package:flutter/material.dart';
void main() {
- final Color _dividerColor = const Color(0x1f333333);
+ const Color _dividerColor = const Color(0x1f333333);
testWidgets('ExpansionTile initial state', (WidgetTester tester) async {
final Key topKey = new UniqueKey();
- final Key expandedKey = const PageStorageKey<String>('expanded');
- final Key collapsedKey = const PageStorageKey<String>('collapsed');
- final Key defaultKey = const PageStorageKey<String>('default');
+ const Key expandedKey = const PageStorageKey<String>('expanded');
+ const Key collapsedKey = const PageStorageKey<String>('collapsed');
+ const Key defaultKey = const PageStorageKey<String>('default');
final Key tileKey = new UniqueKey();
@@ -50,7 +50,7 @@
)
]
),
- new ExpansionTile(
+ const ExpansionTile(
key: defaultKey,
title: const Text('Default'),
children: const <Widget>[
diff --git a/packages/flutter/test/material/icon_button_test.dart b/packages/flutter/test/material/icon_button_test.dart
index 53c75e5..80181c0 100644
--- a/packages/flutter/test/material/icon_button_test.dart
+++ b/packages/flutter/test/material/icon_button_test.dart
@@ -194,8 +194,8 @@
// This test is very similar to the '...explicit splashColor and highlightColor' test
// in buttons_test.dart. If you change this one, you may want to also change that one.
testWidgets('IconButton with explicit splashColor and highlightColor', (WidgetTester tester) async {
- final Color directSplashColor = const Color(0xFF00000F);
- final Color directHighlightColor = const Color(0xFF0000F0);
+ const Color directSplashColor = const Color(0xFF00000F);
+ const Color directHighlightColor = const Color(0xFF0000F0);
Widget buttonWidget = wrap(
child: new IconButton(
@@ -225,8 +225,8 @@
..circle(color: directHighlightColor)
);
- final Color themeSplashColor1 = const Color(0xFF000F00);
- final Color themeHighlightColor1 = const Color(0xFF00FF00);
+ const Color themeSplashColor1 = const Color(0xFF000F00);
+ const Color themeHighlightColor1 = const Color(0xFF00FF00);
buttonWidget = wrap(
child: new IconButton(
@@ -252,8 +252,8 @@
..circle(color: themeHighlightColor1)
);
- final Color themeSplashColor2 = const Color(0xFF002200);
- final Color themeHighlightColor2 = const Color(0xFF001100);
+ const Color themeSplashColor2 = const Color(0xFF002200);
+ const Color themeHighlightColor2 = const Color(0xFF001100);
await tester.pumpWidget(
new Theme(
diff --git a/packages/flutter/test/material/ink_paint_test.dart b/packages/flutter/test/material/ink_paint_test.dart
index 789b784..5bec978 100644
--- a/packages/flutter/test/material/ink_paint_test.dart
+++ b/packages/flutter/test/material/ink_paint_test.dart
@@ -10,8 +10,8 @@
void main() {
testWidgets('The InkWell widget renders an ink splash', (WidgetTester tester) async {
- final Color highlightColor = const Color(0xAAFF0000);
- final Color splashColor = const Color(0xAA0000FF);
+ const Color highlightColor = const Color(0xAAFF0000);
+ const Color splashColor = const Color(0xAA0000FF);
final BorderRadius borderRadius = new BorderRadius.circular(6.0);
await tester.pumpWidget(
@@ -52,8 +52,8 @@
});
testWidgets('The InkWell widget renders an ink ripple', (WidgetTester tester) async {
- final Color highlightColor = const Color(0xAAFF0000);
- final Color splashColor = const Color(0xB40000FF);
+ const Color highlightColor = const Color(0xAAFF0000);
+ const Color splashColor = const Color(0xB40000FF);
final BorderRadius borderRadius = new BorderRadius.circular(6.0);
await tester.pumpWidget(
@@ -111,7 +111,7 @@
final double radius = arguments[1];
final Paint paint = arguments[2];
final Offset expectedCenter = tapDownOffset + const Offset(17.0, 17.0);
- final double expectedRadius = 56.0;
+ const double expectedRadius = 56.0;
if (offsetsAreClose(center, expectedCenter) && radiiAreClose(radius, expectedRadius) && paint.color.alpha == 120)
return true;
throw '''
@@ -129,7 +129,7 @@
final double radius = arguments[1];
final Paint paint = arguments[2];
final Offset expectedCenter = tapDownOffset + const Offset(29.0, 29.0);
- final double expectedRadius = 73.0;
+ const double expectedRadius = 73.0;
if (offsetsAreClose(center, expectedCenter) && radiiAreClose(radius, expectedRadius) && paint.color.alpha == 180)
return true;
throw '''
@@ -149,7 +149,7 @@
final double radius = arguments[1];
final Paint paint = arguments[2];
final Offset expectedCenter = inkWellCenter;
- final double expectedRadius = 105.0;
+ const double expectedRadius = 105.0;
if (offsetsAreClose(center, expectedCenter) && radiiAreClose(radius, expectedRadius) && paint.color.alpha == 180)
return true;
throw '''
@@ -166,7 +166,7 @@
final double radius = arguments[1];
final Paint paint = arguments[2];
final Offset expectedCenter = inkWellCenter;
- final double expectedRadius = 105.0;
+ const double expectedRadius = 105.0;
if (offsetsAreClose(center, expectedCenter) && radiiAreClose(radius, expectedRadius) && paint.color.alpha == 0)
return true;
throw '''
diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart
index 3a5e423..74eaff8 100644
--- a/packages/flutter/test/material/input_decorator_test.dart
+++ b/packages/flutter/test/material/input_decorator_test.dart
@@ -1034,7 +1034,7 @@
});
testWidgets('InputDecorator.toString()', (WidgetTester tester) async {
- final Widget child = const InputDecorator(
+ const Widget child = const InputDecorator(
key: const Key('key'),
decoration: const InputDecoration(),
baseStyle: const TextStyle(),
diff --git a/packages/flutter/test/material/localizations_test.dart b/packages/flutter/test/material/localizations_test.dart
index e68e79c..9b09bb8 100644
--- a/packages/flutter/test/material/localizations_test.dart
+++ b/packages/flutter/test/material/localizations_test.dart
@@ -7,7 +7,7 @@
void main() {
testWidgets('English translations exist for all MaterialLocalizations properties', (WidgetTester tester) async {
- final MaterialLocalizations localizations = const DefaultMaterialLocalizations();
+ const MaterialLocalizations localizations = const DefaultMaterialLocalizations();
expect(localizations.openAppDrawerTooltip, isNotNull);
expect(localizations.backButtonTooltip, isNotNull);
diff --git a/packages/flutter/test/material/mergeable_material_test.dart b/packages/flutter/test/material/mergeable_material_test.dart
index 1ceb9cd..5449008 100644
--- a/packages/flutter/test/material/mergeable_material_test.dart
+++ b/packages/flutter/test/material/mergeable_material_test.dart
@@ -1044,7 +1044,7 @@
bool isDivider(Widget widget, bool top, bool bottom) {
final DecoratedBox box = widget;
- final BorderSide side = const BorderSide(color: const Color(0x1F000000), width: 0.5);
+ const BorderSide side = const BorderSide(color: const Color(0x1F000000), width: 0.5);
return box.decoration == new BoxDecoration(
border: new Border(
diff --git a/packages/flutter/test/material/slider_test.dart b/packages/flutter/test/material/slider_test.dart
index 16506ac..6d2fb5b 100644
--- a/packages/flutter/test/material/slider_test.dart
+++ b/packages/flutter/test/material/slider_test.dart
@@ -188,7 +188,7 @@
testWidgets('Slider has a customizable active color',
(WidgetTester tester) async {
- final Color customColor = const Color(0xFF4CD964);
+ const Color customColor = const Color(0xFF4CD964);
final ThemeData theme = new ThemeData(platform: TargetPlatform.android);
Widget buildApp(Color activeColor) {
return new Directionality(
@@ -226,7 +226,7 @@
testWidgets('Slider has a customizable inactive color',
(WidgetTester tester) async {
- final Color customColor = const Color(0xFF4CD964);
+ const Color customColor = const Color(0xFF4CD964);
final ThemeData theme = new ThemeData(platform: TargetPlatform.android);
Widget buildApp(Color inactiveColor) {
return new Directionality(
diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart
index a05542d..a8529c0 100644
--- a/packages/flutter/test/material/snack_bar_test.dart
+++ b/packages/flutter/test/material/snack_bar_test.dart
@@ -7,16 +7,16 @@
void main() {
testWidgets('SnackBar control test', (WidgetTester tester) async {
- final String helloSnackBar = 'Hello SnackBar';
- final Key tapTarget = const Key('tap-target');
+ const String helloSnackBar = 'Hello SnackBar';
+ const Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp(
home: new Scaffold(
body: new Builder(
builder: (BuildContext context) {
return new GestureDetector(
onTap: () {
- Scaffold.of(context).showSnackBar(new SnackBar(
- content: new Text(helloSnackBar),
+ Scaffold.of(context).showSnackBar(const SnackBar(
+ content: const Text(helloSnackBar),
duration: const Duration(seconds: 2)
));
},
@@ -53,7 +53,7 @@
testWidgets('SnackBar twice test', (WidgetTester tester) async {
int snackBarCount = 0;
- final Key tapTarget = const Key('tap-target');
+ const Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp(
home: new Scaffold(
body: new Builder(
@@ -128,7 +128,7 @@
testWidgets('SnackBar cancel test', (WidgetTester tester) async {
int snackBarCount = 0;
- final Key tapTarget = const Key('tap-target');
+ const Key tapTarget = const Key('tap-target');
int time;
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> lastController;
await tester.pumpWidget(new MaterialApp(
@@ -214,7 +214,7 @@
testWidgets('SnackBar dismiss test', (WidgetTester tester) async {
int snackBarCount = 0;
- final Key tapTarget = const Key('tap-target');
+ const Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp(
home: new Scaffold(
body: new Builder(
diff --git a/packages/flutter/test/material/tabs_test.dart b/packages/flutter/test/material/tabs_test.dart
index ed7cc6b..06de02a 100644
--- a/packages/flutter/test/material/tabs_test.dart
+++ b/packages/flutter/test/material/tabs_test.dart
@@ -231,7 +231,7 @@
testWidgets('Scrollable TabBar tap centers selected tab', (WidgetTester tester) async {
final List<String> tabs = <String>['AAAAAA', 'BBBBBB', 'CCCCCC', 'DDDDDD', 'EEEEEE', 'FFFFFF', 'GGGGGG', 'HHHHHH', 'IIIIII', 'JJJJJJ', 'KKKKKK', 'LLLLLL'];
- final Key tabBarKey = const Key('TabBar');
+ const Key tabBarKey = const Key('TabBar');
await tester.pumpWidget(buildFrame(tabs: tabs, value: 'AAAAAA', isScrollable: true, tabBarKey: tabBarKey));
final TabController controller = DefaultTabController.of(tester.element(find.text('AAAAAA')));
expect(controller, isNotNull);
@@ -251,7 +251,7 @@
testWidgets('TabBar can be scrolled independent of the selection', (WidgetTester tester) async {
final List<String> tabs = <String>['AAAA', 'BBBB', 'CCCC', 'DDDD', 'EEEE', 'FFFF', 'GGGG', 'HHHH', 'IIII', 'JJJJ', 'KKKK', 'LLLL'];
- final Key tabBarKey = const Key('TabBar');
+ const Key tabBarKey = const Key('TabBar');
await tester.pumpWidget(buildFrame(tabs: tabs, value: 'AAAA', isScrollable: true, tabBarKey: tabBarKey));
final TabController controller = DefaultTabController.of(tester.element(find.text('AAAA')));
expect(controller, isNotNull);
diff --git a/packages/flutter/test/material/text_field_test.dart b/packages/flutter/test/material/text_field_test.dart
index 3b1103c..745564d 100644
--- a/packages/flutter/test/material/text_field_test.dart
+++ b/packages/flutter/test/material/text_field_test.dart
@@ -303,7 +303,7 @@
expect(controller.selection.baseOffset, -1);
expect(controller.selection.extentOffset, -1);
- final String testValue = 'abc def ghi';
+ const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
@@ -328,7 +328,7 @@
)
);
- final String testValue = 'abc def ghi';
+ const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
expect(controller.value.text, testValue);
await skipPastScrollingAnimation(tester);
@@ -358,7 +358,7 @@
),
);
- final String testValue = 'abc def ghi';
+ const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
@@ -419,7 +419,7 @@
),
);
- final String testValue = 'abc def ghi';
+ const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
@@ -477,7 +477,7 @@
),
);
- final String testValue = 'abc def ghi';
+ const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
@@ -587,7 +587,7 @@
);
final String testValue = kThreeLines;
- final String cutValue = 'First line of stuff ';
+ const String cutValue = 'First line of stuff ';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
@@ -1603,11 +1603,11 @@
testWidgets('maxLength shows warning when maxLengthEnforced is false.', (WidgetTester tester) async {
final TextEditingController textController = new TextEditingController();
- final TextStyle testStyle = const TextStyle(color: Colors.deepPurpleAccent);
+ const TextStyle testStyle = const TextStyle(color: Colors.deepPurpleAccent);
await tester.pumpWidget(boilerplate(
child: new TextField(
- decoration: new InputDecoration(errorStyle: testStyle),
+ decoration: const InputDecoration(errorStyle: testStyle),
controller: textController,
maxLength: 10,
maxLengthEnforced: false,
@@ -1686,7 +1686,7 @@
)
);
- final String testValue = 'x';
+ const String testValue = 'x';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
expect(controller.selection.baseOffset, -1);
diff --git a/packages/flutter/test/material/user_accounts_drawer_header_test.dart b/packages/flutter/test/material/user_accounts_drawer_header_test.dart
index 0a29e42..1bf1c75 100644
--- a/packages/flutter/test/material/user_accounts_drawer_header_test.dart
+++ b/packages/flutter/test/material/user_accounts_drawer_header_test.dart
@@ -199,9 +199,9 @@
));
expect(find.text('A'), findsOneWidget);
- final Key avatarA = const Key('A');
+ const Key avatarA = const Key('A');
await tester.pumpWidget(buildFrame(
- currentAccountPicture: new CircleAvatar(key: avatarA, child: const Text('A')),
+ currentAccountPicture: const CircleAvatar(key: avatarA, child: const Text('A')),
accountName: const Text('accountName'),
));
expect(
@@ -310,9 +310,9 @@
));
expect(find.text('A'), findsOneWidget);
- final Key avatarA = const Key('A');
+ const Key avatarA = const Key('A');
await tester.pumpWidget(buildFrame(
- currentAccountPicture: new CircleAvatar(key: avatarA, child: const Text('A')),
+ currentAccountPicture: const CircleAvatar(key: avatarA, child: const Text('A')),
accountName: const Text('accountName'),
));
expect(
diff --git a/packages/flutter/test/painting/alignment_test.dart b/packages/flutter/test/painting/alignment_test.dart
index b4a0f18..31d03d4 100644
--- a/packages/flutter/test/painting/alignment_test.dart
+++ b/packages/flutter/test/painting/alignment_test.dart
@@ -179,8 +179,8 @@
});
test('AlignmentGeometry add/subtract', () {
- final AlignmentGeometry directional = const AlignmentDirectional(1.0, 2.0);
- final AlignmentGeometry normal = const Alignment(3.0, 5.0);
+ const AlignmentGeometry directional = const AlignmentDirectional(1.0, 2.0);
+ const AlignmentGeometry normal = const Alignment(3.0, 5.0);
expect(directional.add(normal).resolve(TextDirection.ltr), const Alignment(4.0, 7.0));
expect(directional.add(normal).resolve(TextDirection.rtl), const Alignment(2.0, 7.0));
expect(normal.add(normal), normal * 2.0);
diff --git a/packages/flutter/test/painting/border_radius_test.dart b/packages/flutter/test/painting/border_radius_test.dart
index ac45a11..b49bebd 100644
--- a/packages/flutter/test/painting/border_radius_test.dart
+++ b/packages/flutter/test/painting/border_radius_test.dart
@@ -142,17 +142,17 @@
});
test('BorderRadius.lerp() crazy', () {
- final BorderRadius a = const BorderRadius.only(
+ const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
- final BorderRadius b = const BorderRadius.only(
+ const BorderRadius b = const BorderRadius.only(
topRight: const Radius.elliptical(100.0, 110.0),
bottomLeft: const Radius.elliptical(120.0, 130.0),
bottomRight: const Radius.elliptical(140.0, 150.0),
);
- final BorderRadius c = const BorderRadius.only(
+ const BorderRadius c = const BorderRadius.only(
topLeft: const Radius.elliptical(5.0, 10.0), // 10,20 -> 0
topRight: const Radius.elliptical(65.0, 75.0), // 30,40 -> 100,110
bottomLeft: const Radius.elliptical(85.0, 95.0), // 50,60 -> 120,130
@@ -321,17 +321,17 @@
});
test('BorderRadiusDirectional.lerp() crazy', () {
- final BorderRadiusDirectional a = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional a = const BorderRadiusDirectional.only(
topStart: const Radius.elliptical(10.0, 20.0),
topEnd: const Radius.elliptical(30.0, 40.0),
bottomStart: const Radius.elliptical(50.0, 60.0),
);
- final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
);
- final BorderRadiusDirectional c = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional c = const BorderRadiusDirectional.only(
topStart: const Radius.elliptical(5.0, 10.0), // 10,20 -> 0
topEnd: const Radius.elliptical(65.0, 75.0), // 30,40 -> 100,110
bottomStart: const Radius.elliptical(85.0, 95.0), // 50,60 -> 120,130
@@ -341,23 +341,23 @@
});
test('BorderRadiusGeometry.lerp()', () {
- final BorderRadius a = const BorderRadius.only(
+ const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
- final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
);
- final BorderRadius ltr = const BorderRadius.only(
+ const BorderRadius ltr = const BorderRadius.only(
topLeft: const Radius.elliptical(5.0, 10.0), // 10,20 -> 0
topRight: const Radius.elliptical(65.0, 75.0), // 30,40 -> 100,110
bottomLeft: const Radius.elliptical(85.0, 95.0), // 50,60 -> 120,130
bottomRight: const Radius.elliptical(70.0, 75.0), // 0,0 -> 140,150
);
- final BorderRadius rtl = const BorderRadius.only(
+ const BorderRadius rtl = const BorderRadius.only(
topLeft: const Radius.elliptical(55.0, 65.0), // 10,20 -> 100,110
topRight: const Radius.elliptical(15.0, 20.0), // 30,40 -> 0,0
bottomLeft: const Radius.elliptical(95.0, 105.0), // 50,60 -> 140,150
@@ -370,12 +370,12 @@
});
test('BorderRadiusGeometry subtract', () {
- final BorderRadius a = const BorderRadius.only(
+ const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
- final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
@@ -395,12 +395,12 @@
});
test('BorderRadiusGeometry add', () {
- final BorderRadius a = const BorderRadius.only(
+ const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
- final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
@@ -420,12 +420,12 @@
});
test('BorderRadiusGeometry add and multiply', () {
- final BorderRadius a = const BorderRadius.only(
+ const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
- final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
@@ -445,23 +445,23 @@
});
test('BorderRadiusGeometry add and subtract', () {
- final BorderRadius a = const BorderRadius.only(
+ const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(300.0, 500.0),
);
- final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(30.0, 50.0),
);
- final BorderRadius c = const BorderRadius.only(
+ const BorderRadius c = const BorderRadius.only(
bottomLeft: const Radius.elliptical(3.0, 5.0),
);
- final BorderRadius ltr = const BorderRadius.only(
+ const BorderRadius ltr = const BorderRadius.only(
topLeft: const Radius.elliptical(300.0, 500.0), // tL + 0 - 0
topRight: const Radius.elliptical(30.0, 50.0), // 0 + tE - 0
bottomLeft: const Radius.elliptical(-3.0, -5.0), // 0 + 0 - bL
bottomRight: Radius.zero, // 0 + 0 - 0
);
- final BorderRadius rtl = const BorderRadius.only(
+ const BorderRadius rtl = const BorderRadius.only(
topLeft: const Radius.elliptical(330.0, 550.0), // tL + tE - 0
topRight: Radius.zero, // 0 + 0 - 0
bottomLeft: const Radius.elliptical(-3.0, -5.0), // 0 + 0 - bL
@@ -472,32 +472,32 @@
});
test('BorderRadiusGeometry add and subtract, more', () {
- final BorderRadius a = const BorderRadius.only(
+ const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(300.0, 300.0),
topRight: const Radius.elliptical(500.0, 500.0),
bottomLeft: const Radius.elliptical(700.0, 700.0),
bottomRight: const Radius.elliptical(900.0, 900.0),
);
- final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topStart: const Radius.elliptical(30.0, 30.0),
topEnd: const Radius.elliptical(50.0, 50.0),
bottomStart: const Radius.elliptical(70.0, 70.0),
bottomEnd: const Radius.elliptical(90.0, 90.0),
);
- final BorderRadius c = const BorderRadius.only(
+ const BorderRadius c = const BorderRadius.only(
topLeft: const Radius.elliptical(3.0, 3.0),
topRight: const Radius.elliptical(5.0, 5.0),
bottomLeft: const Radius.elliptical(7.0, 7.0),
bottomRight: const Radius.elliptical(9.0, 9.0),
);
- final BorderRadius ltr = const BorderRadius.only(
+ const BorderRadius ltr = const BorderRadius.only(
topLeft: const Radius.elliptical(327.0, 327.0), // tL + tS - tL
topRight: const Radius.elliptical(545.0, 545.0), // tR + tE - tR
bottomLeft: const Radius.elliptical(763.0, 763.0), // bL + bS - bL
bottomRight: const Radius.elliptical(981.0, 981.0), // bR + bE - bR
);
- final BorderRadius rtl = const BorderRadius.only(
+ const BorderRadius rtl = const BorderRadius.only(
topLeft: const Radius.elliptical(347.0, 347.0), // tL + tE - tL
topRight: const Radius.elliptical(525.0, 525.0), // tR + TS - tR
bottomLeft: const Radius.elliptical(783.0, 783.0), // bL + bE + bL
@@ -508,24 +508,24 @@
});
test('BorderRadiusGeometry operators', () {
- final BorderRadius a = const BorderRadius.only(
+ const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
- final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
+ const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
);
- final BorderRadius ltr = const BorderRadius.only(
+ const BorderRadius ltr = const BorderRadius.only(
topLeft: const Radius.elliptical(5.0, 10.0), // 10,20 -> 0
topRight: const Radius.elliptical(65.0, 75.0), // 30,40 -> 100,110
bottomLeft: const Radius.elliptical(85.0, 95.0), // 50,60 -> 120,130
bottomRight: const Radius.elliptical(70.0, 75.0), // 0,0 -> 140,150
);
- final BorderRadius rtl = const BorderRadius.only(
+ const BorderRadius rtl = const BorderRadius.only(
topLeft: const Radius.elliptical(55.0, 65.0), // 10,20 -> 100,110
topRight: const Radius.elliptical(15.0, 20.0), // 30,40 -> 0,0
bottomLeft: const Radius.elliptical(95.0, 105.0), // 50,60 -> 140,150
diff --git a/packages/flutter/test/painting/border_rtl_test.dart b/packages/flutter/test/painting/border_rtl_test.dart
index d29b650..300d3fa 100644
--- a/packages/flutter/test/painting/border_rtl_test.dart
+++ b/packages/flutter/test/painting/border_rtl_test.dart
@@ -15,32 +15,32 @@
void main() {
test('BoxBorder.lerp', () {
// names of the form fooAtX are foo, lerped X% of the way to null
- final BoxBorder directionalWithMagentaTop5 = const BorderDirectional(top: const BorderSide(color: const Color(0xFFFF00FF), width: 5.0));
- final BoxBorder directionalWithMagentaTop5At25 = const BorderDirectional(top: const BorderSide(color: const Color(0x3F3F003F), width: 1.25));
- final BoxBorder directionalWithMagentaTop5At75 = const BorderDirectional(top: const BorderSide(color: const Color(0xBFBF00BF), width: 3.75));
- final BoxBorder directionalWithSides10 = const BorderDirectional(start: const BorderSide(width: 10.0), end: const BorderSide(width: 20.0));
- final BoxBorder directionalWithSides10At25 = const BorderDirectional(start: const BorderSide(width: 2.5, color: const Color(0x3F000000)), end: const BorderSide(width: 5.0, color: const Color(0x3F000000)));
- final BoxBorder directionalWithSides10At50 = const BorderDirectional(start: const BorderSide(width: 5.0, color: const Color(0x7F000000)), end: const BorderSide(width: 10.0, color: const Color(0x7F000000)));
- final BoxBorder directionalWithSides10At75 = const BorderDirectional(start: const BorderSide(width: 7.5, color: const Color(0xBF000000)), end: const BorderSide(width: 15.0, color: const Color(0xBF000000)));
- final BoxBorder directionalWithSides20 = const BorderDirectional(start: const BorderSide(width: 20.0), end: const BorderSide(width: 40.0));
- final BoxBorder directionalWithSides30 = const BorderDirectional(start: const BorderSide(width: 30.0), end: const BorderSide(width: 60.0));
- final BoxBorder directionalWithTop10 = const BorderDirectional(top: const BorderSide(width: 10.0));
- final BoxBorder directionalWithYellowTop10 = const BorderDirectional(top: const BorderSide(color: const Color(0xFFFFFF00), width: 10.0));
- final BoxBorder directionalWithYellowTop5 = const BorderDirectional(top: const BorderSide(color: const Color(0xFFFFFF00), width: 5.0));
- final BoxBorder visualWithMagentaTop10 = const Border(top: const BorderSide(color: const Color(0xFFFF00FF), width: 10.0));
- final BoxBorder visualWithMagentaTop5 = const Border(top: const BorderSide(color: const Color(0xFFFF00FF), width: 5.0));
- final BoxBorder visualWithSides10 = const Border(left: const BorderSide(width: 10.0), right: const BorderSide(width: 20.0));
- final BoxBorder visualWithSides10At25 = const Border(left: const BorderSide(width: 2.5, color: const Color(0x3F000000)), right: const BorderSide(width: 5.0, color: const Color(0x3F000000)));
- final BoxBorder visualWithSides10At50 = const Border(left: const BorderSide(width: 5.0, color: const Color(0x7F000000)), right: const BorderSide(width: 10.0, color: const Color(0x7F000000)));
- final BoxBorder visualWithSides10At75 = const Border(left: const BorderSide(width: 7.5, color: const Color(0xBF000000)), right: const BorderSide(width: 15.0, color: const Color(0xBF000000)));
- final BoxBorder visualWithSides20 = const Border(left: const BorderSide(width: 20.0), right: const BorderSide(width: 40.0));
- final BoxBorder visualWithSides30 = const Border(left: const BorderSide(width: 30.0), right: const BorderSide(width: 60.0));
- final BoxBorder visualWithTop10 = const Border(top: const BorderSide(width: 10.0));
- final BoxBorder visualWithTop100 = const Border(top: const BorderSide(width: 100.0));
- final BoxBorder visualWithTop190 = const Border(top: const BorderSide(width: 190.0));
- final BoxBorder visualWithYellowTop5 = const Border(top: const BorderSide(color: const Color(0xFFFFFF00), width: 5.0));
- final BoxBorder visualWithYellowTop5At25 = const Border(top: const BorderSide(color: const Color(0x3F3F3F00), width: 1.25));
- final BoxBorder visualWithYellowTop5At75 = const Border(top: const BorderSide(color: const Color(0xBFBFBF00), width: 3.75));
+ const BoxBorder directionalWithMagentaTop5 = const BorderDirectional(top: const BorderSide(color: const Color(0xFFFF00FF), width: 5.0));
+ const BoxBorder directionalWithMagentaTop5At25 = const BorderDirectional(top: const BorderSide(color: const Color(0x3F3F003F), width: 1.25));
+ const BoxBorder directionalWithMagentaTop5At75 = const BorderDirectional(top: const BorderSide(color: const Color(0xBFBF00BF), width: 3.75));
+ const BoxBorder directionalWithSides10 = const BorderDirectional(start: const BorderSide(width: 10.0), end: const BorderSide(width: 20.0));
+ const BoxBorder directionalWithSides10At25 = const BorderDirectional(start: const BorderSide(width: 2.5, color: const Color(0x3F000000)), end: const BorderSide(width: 5.0, color: const Color(0x3F000000)));
+ const BoxBorder directionalWithSides10At50 = const BorderDirectional(start: const BorderSide(width: 5.0, color: const Color(0x7F000000)), end: const BorderSide(width: 10.0, color: const Color(0x7F000000)));
+ const BoxBorder directionalWithSides10At75 = const BorderDirectional(start: const BorderSide(width: 7.5, color: const Color(0xBF000000)), end: const BorderSide(width: 15.0, color: const Color(0xBF000000)));
+ const BoxBorder directionalWithSides20 = const BorderDirectional(start: const BorderSide(width: 20.0), end: const BorderSide(width: 40.0));
+ const BoxBorder directionalWithSides30 = const BorderDirectional(start: const BorderSide(width: 30.0), end: const BorderSide(width: 60.0));
+ const BoxBorder directionalWithTop10 = const BorderDirectional(top: const BorderSide(width: 10.0));
+ const BoxBorder directionalWithYellowTop10 = const BorderDirectional(top: const BorderSide(color: const Color(0xFFFFFF00), width: 10.0));
+ const BoxBorder directionalWithYellowTop5 = const BorderDirectional(top: const BorderSide(color: const Color(0xFFFFFF00), width: 5.0));
+ const BoxBorder visualWithMagentaTop10 = const Border(top: const BorderSide(color: const Color(0xFFFF00FF), width: 10.0));
+ const BoxBorder visualWithMagentaTop5 = const Border(top: const BorderSide(color: const Color(0xFFFF00FF), width: 5.0));
+ const BoxBorder visualWithSides10 = const Border(left: const BorderSide(width: 10.0), right: const BorderSide(width: 20.0));
+ const BoxBorder visualWithSides10At25 = const Border(left: const BorderSide(width: 2.5, color: const Color(0x3F000000)), right: const BorderSide(width: 5.0, color: const Color(0x3F000000)));
+ const BoxBorder visualWithSides10At50 = const Border(left: const BorderSide(width: 5.0, color: const Color(0x7F000000)), right: const BorderSide(width: 10.0, color: const Color(0x7F000000)));
+ const BoxBorder visualWithSides10At75 = const Border(left: const BorderSide(width: 7.5, color: const Color(0xBF000000)), right: const BorderSide(width: 15.0, color: const Color(0xBF000000)));
+ const BoxBorder visualWithSides20 = const Border(left: const BorderSide(width: 20.0), right: const BorderSide(width: 40.0));
+ const BoxBorder visualWithSides30 = const Border(left: const BorderSide(width: 30.0), right: const BorderSide(width: 60.0));
+ const BoxBorder visualWithTop10 = const Border(top: const BorderSide(width: 10.0));
+ const BoxBorder visualWithTop100 = const Border(top: const BorderSide(width: 100.0));
+ const BoxBorder visualWithTop190 = const Border(top: const BorderSide(width: 190.0));
+ const BoxBorder visualWithYellowTop5 = const Border(top: const BorderSide(color: const Color(0xFFFFFF00), width: 5.0));
+ const BoxBorder visualWithYellowTop5At25 = const Border(top: const BorderSide(color: const Color(0x3F3F3F00), width: 1.25));
+ const BoxBorder visualWithYellowTop5At75 = const Border(top: const BorderSide(color: const Color(0xBFBFBF00), width: 3.75));
expect(BoxBorder.lerp(null, null, -1.0), null);
expect(BoxBorder.lerp(new Border.all(width: 10.0), null, -1.0), new Border.all(width: 20.0));
@@ -117,8 +117,8 @@
test('BoxBorder.getInnerPath / BoxBorder.getOuterPath', () {
// for Border, BorderDirectional
- final Border border = const Border(top: const BorderSide(width: 10.0), right: const BorderSide(width: 20.0));
- final BorderDirectional borderDirectional = const BorderDirectional(top: const BorderSide(width: 10.0), end: const BorderSide(width: 20.0));
+ const Border border = const Border(top: const BorderSide(width: 10.0), right: const BorderSide(width: 20.0));
+ const BorderDirectional borderDirectional = const BorderDirectional(top: const BorderSide(width: 10.0), end: const BorderSide(width: 20.0));
expect(
border.getOuterPath(new Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.rtl),
isPathThat(
@@ -325,30 +325,30 @@
});
test('BorderDirectional.merge', () {
- final BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
- final BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
- final BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
- final BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
+ const BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
+ const BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
+ const BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
+ const BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
expect(
BorderDirectional.merge(
- new BorderDirectional(top: yellow2),
- new BorderDirectional(end: magenta3),
+ const BorderDirectional(top: yellow2),
+ const BorderDirectional(end: magenta3),
),
- new BorderDirectional(top: yellow2, end: magenta3),
+ const BorderDirectional(top: yellow2, end: magenta3),
);
expect(
BorderDirectional.merge(
- new BorderDirectional(bottom: magenta3),
- new BorderDirectional(bottom: magenta3),
+ const BorderDirectional(bottom: magenta3),
+ const BorderDirectional(bottom: magenta3),
),
- new BorderDirectional(bottom: magenta6),
+ const BorderDirectional(bottom: magenta6),
);
expect(
BorderDirectional.merge(
- new BorderDirectional(start: magenta3, end: yellowNone0),
- new BorderDirectional(end: yellow2),
+ const BorderDirectional(start: magenta3, end: yellowNone0),
+ const BorderDirectional(end: yellow2),
),
- new BorderDirectional(start: magenta3, end: yellow2),
+ const BorderDirectional(start: magenta3, end: yellow2),
);
expect(
BorderDirectional.merge(const BorderDirectional(), const BorderDirectional()),
@@ -356,8 +356,8 @@
);
expect(
() => BorderDirectional.merge(
- new BorderDirectional(start: magenta3),
- new BorderDirectional(start: yellow2),
+ const BorderDirectional(start: magenta3),
+ const BorderDirectional(start: yellow2),
),
throwsAssertionError,
);
@@ -446,35 +446,35 @@
});
test('BorderDirectional.add - all directional', () {
- final BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
- final BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
- final BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
- final BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
+ const BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
+ const BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
+ const BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
+ const BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
expect(
- new BorderDirectional(top: yellow2) + new BorderDirectional(end: magenta3),
- new BorderDirectional(top: yellow2, end: magenta3),
+ const BorderDirectional(top: yellow2) + const BorderDirectional(end: magenta3),
+ const BorderDirectional(top: yellow2, end: magenta3),
);
expect(
- new BorderDirectional(bottom: magenta3) + new BorderDirectional(bottom: magenta3),
- new BorderDirectional(bottom: magenta6),
+ const BorderDirectional(bottom: magenta3) + const BorderDirectional(bottom: magenta3),
+ const BorderDirectional(bottom: magenta6),
);
expect(
- new BorderDirectional(start: magenta3, end: yellowNone0) + new BorderDirectional(end: yellow2),
- new BorderDirectional(start: magenta3, end: yellow2),
+ const BorderDirectional(start: magenta3, end: yellowNone0) + const BorderDirectional(end: yellow2),
+ const BorderDirectional(start: magenta3, end: yellow2),
);
expect(
const BorderDirectional() + const BorderDirectional(),
const BorderDirectional(),
);
expect(
- new BorderDirectional(start: magenta3) + new BorderDirectional(start: yellow2),
+ const BorderDirectional(start: magenta3) + const BorderDirectional(start: yellow2),
isNot(const isInstanceOf<BorderDirectional>()), // see shape_border_test.dart for better tests of this case
);
- final BorderDirectional b3 = new BorderDirectional(top: magenta3);
- final BorderDirectional b6 = new BorderDirectional(top: magenta6);
+ const BorderDirectional b3 = const BorderDirectional(top: magenta3);
+ const BorderDirectional b6 = const BorderDirectional(top: magenta6);
expect(b3 + b3, b6);
- final BorderDirectional b0 = new BorderDirectional(top: yellowNone0);
- final BorderDirectional bZ = const BorderDirectional();
+ const BorderDirectional b0 = const BorderDirectional(top: yellowNone0);
+ const BorderDirectional bZ = const BorderDirectional();
expect(b0 + b0, bZ);
expect(bZ + bZ, bZ);
expect(b0 + bZ, bZ);
@@ -534,27 +534,27 @@
});
test('BorderDirectional.scale', () {
- final BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
- final BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
- final BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
- final BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
- final BorderDirectional b3 = new BorderDirectional(start: magenta3);
- final BorderDirectional b6 = new BorderDirectional(start: magenta6);
+ const BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
+ const BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
+ const BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
+ const BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
+ const BorderDirectional b3 = const BorderDirectional(start: magenta3);
+ const BorderDirectional b6 = const BorderDirectional(start: magenta6);
expect(b3.scale(2.0), b6);
- final BorderDirectional bY0 = new BorderDirectional(top: yellowNone0);
+ const BorderDirectional bY0 = const BorderDirectional(top: yellowNone0);
expect(bY0.scale(3.0), bY0);
- final BorderDirectional bY2 = new BorderDirectional(top: yellow2);
+ const BorderDirectional bY2 = const BorderDirectional(top: yellow2);
expect(bY2.scale(0.0), bY0);
});
test('BorderDirectional.lerp', () {
- final BorderDirectional directionalWithTop10 = const BorderDirectional(top: const BorderSide(width: 10.0));
- final BorderDirectional atMinus100 = const BorderDirectional(start: const BorderSide(width: 0.0), end: const BorderSide(width: 300.0));
- final BorderDirectional at0 = const BorderDirectional(start: const BorderSide(width: 100.0), end: const BorderSide(width: 200.0));
- final BorderDirectional at25 = const BorderDirectional(start: const BorderSide(width: 125.0), end: const BorderSide(width: 175.0));
- final BorderDirectional at75 = const BorderDirectional(start: const BorderSide(width: 175.0), end: const BorderSide(width: 125.0));
- final BorderDirectional at100 = const BorderDirectional(start: const BorderSide(width: 200.0), end: const BorderSide(width: 100.0));
- final BorderDirectional at200 = const BorderDirectional(start: const BorderSide(width: 300.0), end: const BorderSide(width: 0.0));
+ const BorderDirectional directionalWithTop10 = const BorderDirectional(top: const BorderSide(width: 10.0));
+ const BorderDirectional atMinus100 = const BorderDirectional(start: const BorderSide(width: 0.0), end: const BorderSide(width: 300.0));
+ const BorderDirectional at0 = const BorderDirectional(start: const BorderSide(width: 100.0), end: const BorderSide(width: 200.0));
+ const BorderDirectional at25 = const BorderDirectional(start: const BorderSide(width: 125.0), end: const BorderSide(width: 175.0));
+ const BorderDirectional at75 = const BorderDirectional(start: const BorderSide(width: 175.0), end: const BorderSide(width: 125.0));
+ const BorderDirectional at100 = const BorderDirectional(start: const BorderSide(width: 200.0), end: const BorderSide(width: 100.0));
+ const BorderDirectional at200 = const BorderDirectional(start: const BorderSide(width: 300.0), end: const BorderSide(width: 0.0));
expect(BorderDirectional.lerp(null, null, -1.0), null);
expect(BorderDirectional.lerp(directionalWithTop10, null, -1.0), const BorderDirectional(top: const BorderSide(width: 20.0)));
diff --git a/packages/flutter/test/painting/border_side_test.dart b/packages/flutter/test/painting/border_side_test.dart
index 44cf9cc..d5b403f 100644
--- a/packages/flutter/test/painting/border_side_test.dart
+++ b/packages/flutter/test/painting/border_side_test.dart
@@ -32,20 +32,20 @@
);
});
test('BorderSide - merging', () {
- final BorderSide blue = const BorderSide(color: const Color(0xFF0000FF));
- final BorderSide blue2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0);
- final BorderSide green = const BorderSide(color: const Color(0xFF00FF00));
- final BorderSide green2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0);
- final BorderSide green3 = const BorderSide(color: const Color(0xFF00FF00), width: 3.0);
- final BorderSide green5 = const BorderSide(color: const Color(0xFF00FF00), width: 5.0);
- final BorderSide none = const BorderSide(style: BorderStyle.none);
- final BorderSide none2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0, style: BorderStyle.none);
- final BorderSide none3 = const BorderSide(style: BorderStyle.none, width: 3.0);
- final BorderSide side2 = const BorderSide(width: 2.0);
- final BorderSide side3 = const BorderSide(width: 3.0);
- final BorderSide side5 = const BorderSide(width: 5.0);
- final BorderSide solid = const BorderSide(style: BorderStyle.solid);
- final BorderSide yellowNone = const BorderSide(style: BorderStyle.none, color: const Color(0xFFFFFF00), width: 0.0);
+ const BorderSide blue = const BorderSide(color: const Color(0xFF0000FF));
+ const BorderSide blue2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0);
+ const BorderSide green = const BorderSide(color: const Color(0xFF00FF00));
+ const BorderSide green2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0);
+ const BorderSide green3 = const BorderSide(color: const Color(0xFF00FF00), width: 3.0);
+ const BorderSide green5 = const BorderSide(color: const Color(0xFF00FF00), width: 5.0);
+ const BorderSide none = const BorderSide(style: BorderStyle.none);
+ const BorderSide none2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0, style: BorderStyle.none);
+ const BorderSide none3 = const BorderSide(style: BorderStyle.none, width: 3.0);
+ const BorderSide side2 = const BorderSide(width: 2.0);
+ const BorderSide side3 = const BorderSide(width: 3.0);
+ const BorderSide side5 = const BorderSide(width: 5.0);
+ const BorderSide solid = const BorderSide(style: BorderStyle.solid);
+ const BorderSide yellowNone = const BorderSide(style: BorderStyle.none, color: const Color(0xFFFFFF00), width: 0.0);
// canMerge
expect( BorderSide.canMerge(BorderSide.none, BorderSide.none), isTrue);
expect( BorderSide.canMerge(BorderSide.none, side2), isTrue);
@@ -92,20 +92,20 @@
expect( BorderSide.merge(yellowNone, yellowNone), BorderSide.none);
});
test('BorderSide - asserts when copied incorrectly', () {
- final BorderSide green2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0);
- final BorderSide blue3 = const BorderSide(color: const Color(0xFF0000FF), width: 3.0);
- final BorderSide blue2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0);
- final BorderSide green3 = const BorderSide(color: const Color(0xFF00FF00), width: 3.0);
- final BorderSide none2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0, style: BorderStyle.none);
+ const BorderSide green2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0);
+ const BorderSide blue3 = const BorderSide(color: const Color(0xFF0000FF), width: 3.0);
+ const BorderSide blue2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0);
+ const BorderSide green3 = const BorderSide(color: const Color(0xFF00FF00), width: 3.0);
+ const BorderSide none2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0, style: BorderStyle.none);
expect(green2.copyWith(color: const Color(0xFF0000FF), width: 3.0), blue3);
expect(green2.copyWith(width: 3.0), green3);
expect(green2.copyWith(color: const Color(0xFF0000FF)), blue2);
expect(green2.copyWith(style: BorderStyle.none), none2);
});
test('BorderSide - scale', () {
- final BorderSide side3 = const BorderSide(width: 3.0, color: const Color(0xFF0000FF));
- final BorderSide side6 = const BorderSide(width: 6.0, color: const Color(0xFF0000FF));
- final BorderSide none = const BorderSide(style: BorderStyle.none, width: 0.0, color: const Color(0xFF0000FF));
+ const BorderSide side3 = const BorderSide(width: 3.0, color: const Color(0xFF0000FF));
+ const BorderSide side6 = const BorderSide(width: 6.0, color: const Color(0xFF0000FF));
+ const BorderSide none = const BorderSide(style: BorderStyle.none, width: 0.0, color: const Color(0xFF0000FF));
expect(side3.scale(2.0), side6);
expect(side6.scale(0.5), side3);
expect(side6.scale(0.0), none);
@@ -125,9 +125,9 @@
expect(paint2.blendMode, BlendMode.srcOver);
});
test('BorderSide - won\'t lerp into negative widths', () {
- final BorderSide side0 = const BorderSide(width: 0.0);
- final BorderSide side1 = const BorderSide(width: 1.0);
- final BorderSide side2 = const BorderSide(width: 2.0);
+ const BorderSide side0 = const BorderSide(width: 0.0);
+ const BorderSide side1 = const BorderSide(width: 1.0);
+ const BorderSide side2 = const BorderSide(width: 2.0);
expect(BorderSide.lerp(side2, side1, 10.0), BorderSide.none);
expect(BorderSide.lerp(side1, side2, -10.0), BorderSide.none);
expect(BorderSide.lerp(side0, side1, 2.0), side2);
diff --git a/packages/flutter/test/painting/border_test.dart b/packages/flutter/test/painting/border_test.dart
index 3d8f95c..bd28a44 100644
--- a/packages/flutter/test/painting/border_test.dart
+++ b/packages/flutter/test/painting/border_test.dart
@@ -15,30 +15,30 @@
});
test('Border.merge', () {
- final BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
- final BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
- final BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
- final BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
+ const BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
+ const BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
+ const BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
+ const BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
expect(
Border.merge(
- new Border(top: yellow2),
- new Border(right: magenta3),
+ const Border(top: yellow2),
+ const Border(right: magenta3),
),
- new Border(top: yellow2, right: magenta3),
+ const Border(top: yellow2, right: magenta3),
);
expect(
Border.merge(
- new Border(bottom: magenta3),
- new Border(bottom: magenta3),
+ const Border(bottom: magenta3),
+ const Border(bottom: magenta3),
),
- new Border(bottom: magenta6),
+ const Border(bottom: magenta6),
);
expect(
Border.merge(
- new Border(left: magenta3, right: yellowNone0),
- new Border(right: yellow2),
+ const Border(left: magenta3, right: yellowNone0),
+ const Border(right: yellow2),
),
- new Border(left: magenta3, right: yellow2),
+ const Border(left: magenta3, right: yellow2),
);
expect(
Border.merge(const Border(), const Border()),
@@ -46,43 +46,43 @@
);
expect(
() => Border.merge(
- new Border(left: magenta3),
- new Border(left: yellow2),
+ const Border(left: magenta3),
+ const Border(left: yellow2),
),
throwsAssertionError,
);
});
test('Border.add', () {
- final BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
- final BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
- final BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
- final BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
+ const BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
+ const BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
+ const BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
+ const BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
expect(
- new Border(top: yellow2) + new Border(right: magenta3),
- new Border(top: yellow2, right: magenta3),
+ const Border(top: yellow2) + const Border(right: magenta3),
+ const Border(top: yellow2, right: magenta3),
);
expect(
- new Border(bottom: magenta3) + new Border(bottom: magenta3),
- new Border(bottom: magenta6),
+ const Border(bottom: magenta3) + const Border(bottom: magenta3),
+ const Border(bottom: magenta6),
);
expect(
- new Border(left: magenta3, right: yellowNone0) + new Border(right: yellow2),
- new Border(left: magenta3, right: yellow2),
+ const Border(left: magenta3, right: yellowNone0) + const Border(right: yellow2),
+ const Border(left: magenta3, right: yellow2),
);
expect(
const Border() + const Border(),
const Border(),
);
expect(
- new Border(left: magenta3) + new Border(left: yellow2),
+ const Border(left: magenta3) + const Border(left: yellow2),
isNot(const isInstanceOf<Border>()), // see shape_border_test.dart for better tests of this case
);
- final Border b3 = new Border(top: magenta3);
- final Border b6 = new Border(top: magenta6);
+ const Border b3 = const Border(top: magenta3);
+ const Border b6 = const Border(top: magenta6);
expect(b3 + b3, b6);
- final Border b0 = new Border(top: yellowNone0);
- final Border bZ = const Border();
+ const Border b0 = const Border(top: yellowNone0);
+ const Border bZ = const Border();
expect(b0 + b0, bZ);
expect(bZ + bZ, bZ);
expect(b0 + bZ, bZ);
@@ -90,16 +90,16 @@
});
test('Border.scale', () {
- final BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
- final BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
- final BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
- final BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
- final Border b3 = new Border(left: magenta3);
- final Border b6 = new Border(left: magenta6);
+ const BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
+ const BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
+ const BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
+ const BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
+ const Border b3 = const Border(left: magenta3);
+ const Border b6 = const Border(left: magenta6);
expect(b3.scale(2.0), b6);
- final Border bY0 = new Border(top: yellowNone0);
+ const Border bY0 = const Border(top: yellowNone0);
expect(bY0.scale(3.0), bY0);
- final Border bY2 = new Border(top: yellow2);
+ const Border bY2 = const Border(top: yellow2);
expect(bY2.scale(0.0), bY0);
});
@@ -195,13 +195,13 @@
});
test('Border.lerp', () {
- final Border visualWithTop10 = const Border(top: const BorderSide(width: 10.0));
- final Border atMinus100 = const Border(left: const BorderSide(width: 0.0), right: const BorderSide(width: 300.0));
- final Border at0 = const Border(left: const BorderSide(width: 100.0), right: const BorderSide(width: 200.0));
- final Border at25 = const Border(left: const BorderSide(width: 125.0), right: const BorderSide(width: 175.0));
- final Border at75 = const Border(left: const BorderSide(width: 175.0), right: const BorderSide(width: 125.0));
- final Border at100 = const Border(left: const BorderSide(width: 200.0), right: const BorderSide(width: 100.0));
- final Border at200 = const Border(left: const BorderSide(width: 300.0), right: const BorderSide(width: 0.0));
+ const Border visualWithTop10 = const Border(top: const BorderSide(width: 10.0));
+ const Border atMinus100 = const Border(left: const BorderSide(width: 0.0), right: const BorderSide(width: 300.0));
+ const Border at0 = const Border(left: const BorderSide(width: 100.0), right: const BorderSide(width: 200.0));
+ const Border at25 = const Border(left: const BorderSide(width: 125.0), right: const BorderSide(width: 175.0));
+ const Border at75 = const Border(left: const BorderSide(width: 175.0), right: const BorderSide(width: 125.0));
+ const Border at100 = const Border(left: const BorderSide(width: 200.0), right: const BorderSide(width: 100.0));
+ const Border at200 = const Border(left: const BorderSide(width: 300.0), right: const BorderSide(width: 0.0));
expect(Border.lerp(null, null, -1.0), null);
expect(Border.lerp(visualWithTop10, null, -1.0), const Border(top: const BorderSide(width: 20.0)));
diff --git a/packages/flutter/test/painting/box_decoration_test.dart b/packages/flutter/test/painting/box_decoration_test.dart
index f3e273c..4d051ca 100644
--- a/packages/flutter/test/painting/box_decoration_test.dart
+++ b/packages/flutter/test/painting/box_decoration_test.dart
@@ -9,7 +9,7 @@
void main() {
test('BoxDecoration with BorderRadiusDirectional', () {
- final BoxDecoration decoration = const BoxDecoration(
+ const BoxDecoration decoration = const BoxDecoration(
color: const Color(0xFF000000),
borderRadius: const BorderRadiusDirectional.only(topStart: const Radius.circular(100.0)),
);
diff --git a/packages/flutter/test/painting/box_painter_test.dart b/packages/flutter/test/painting/box_painter_test.dart
index 364b768..947feb1 100644
--- a/packages/flutter/test/painting/box_painter_test.dart
+++ b/packages/flutter/test/painting/box_painter_test.dart
@@ -7,7 +7,7 @@
void main() {
test('BorderSide control test', () {
- final BorderSide side1 = const BorderSide();
+ const BorderSide side1 = const BorderSide();
final BorderSide side2 = side1.copyWith(
color: const Color(0xFF00FFFF),
width: 2.0,
@@ -40,7 +40,7 @@
});
test('BorderSide toString test', () {
- final BorderSide side1 = const BorderSide();
+ const BorderSide side1 = const BorderSide();
final BorderSide side2 = side1.copyWith(
color: const Color(0xFF00FFFF),
width: 2.0,
@@ -87,7 +87,7 @@
});
test('BoxShadow control test', () {
- final BoxShadow shadow1 = const BoxShadow(blurRadius: 4.0);
+ const BoxShadow shadow1 = const BoxShadow(blurRadius: 4.0);
final BoxShadow shadow2 = BoxShadow.lerp(null, shadow1, 0.25);
final BoxShadow shadow3 = BoxShadow.lerp(shadow1, null, 0.25);
diff --git a/packages/flutter/test/painting/circle_border_test.dart b/packages/flutter/test/painting/circle_border_test.dart
index 8f302e0..29c3078 100644
--- a/packages/flutter/test/painting/circle_border_test.dart
+++ b/packages/flutter/test/painting/circle_border_test.dart
@@ -10,9 +10,9 @@
void main() {
test('CircleBorder', () {
- final CircleBorder c10 = const CircleBorder(side: const BorderSide(width: 10.0));
- final CircleBorder c15 = const CircleBorder(side: const BorderSide(width: 15.0));
- final CircleBorder c20 = const CircleBorder(side: const BorderSide(width: 20.0));
+ const CircleBorder c10 = const CircleBorder(side: const BorderSide(width: 10.0));
+ const CircleBorder c15 = const CircleBorder(side: const BorderSide(width: 15.0));
+ const CircleBorder c20 = const CircleBorder(side: const BorderSide(width: 20.0));
expect(c10.dimensions, const EdgeInsets.all(10.0));
expect(c10.scale(2.0), c20);
expect(c20.scale(0.5), c10);
diff --git a/packages/flutter/test/painting/decoration_test.dart b/packages/flutter/test/painting/decoration_test.dart
index c4d2314..438f250 100644
--- a/packages/flutter/test/painting/decoration_test.dart
+++ b/packages/flutter/test/painting/decoration_test.dart
@@ -93,8 +93,8 @@
new TestRenderingFlutterBinding(); // initializes the imageCache
test('Decoration.lerp()', () {
- final BoxDecoration a = const BoxDecoration(color: const Color(0xFFFFFFFF));
- final BoxDecoration b = const BoxDecoration(color: const Color(0x00000000));
+ const BoxDecoration a = const BoxDecoration(color: const Color(0xFFFFFFFF));
+ const BoxDecoration b = const BoxDecoration(color: const Color(0x00000000));
BoxDecoration c = Decoration.lerp(a, b, 0.0);
expect(c.color, equals(a.color));
@@ -117,7 +117,7 @@
});
final TestCanvas canvas = new TestCanvas();
- final ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
+ const ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
boxPainter.paint(canvas, Offset.zero, imageConfiguration);
// The onChanged callback should not be invoked during the call to boxPainter.paint
@@ -136,7 +136,7 @@
});
final TestCanvas canvas = new TestCanvas();
- final ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
+ const ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
boxPainter.paint(canvas, Offset.zero, imageConfiguration);
// The onChanged callback should be invoked asynchronously.
@@ -163,7 +163,7 @@
final List<Invocation> invocations = <Invocation>[];
final TestCanvas canvas = new TestCanvas(invocations);
- final ImageConfiguration imageConfiguration = const ImageConfiguration(
+ const ImageConfiguration imageConfiguration = const ImageConfiguration(
size: const Size(100.0, 100.0)
);
bool onChangedCalled = false;
@@ -203,7 +203,7 @@
});
test('DecorationImage test', () {
- final ColorFilter colorFilter = const ui.ColorFilter.mode(const Color(0xFF00FF00), BlendMode.src);
+ const ColorFilter colorFilter = const ui.ColorFilter.mode(const Color(0xFF00FF00), BlendMode.src);
final DecorationImage backgroundImage = new DecorationImage(
image: new SynchronousTestImageProvider(),
colorFilter: colorFilter,
@@ -284,11 +284,11 @@
});
test('BoxDecoration.lerp - gradients', () {
- final Gradient gradient = const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0xFFFFFFFF) ]);
+ const Gradient gradient = const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0xFFFFFFFF) ]);
expect(
BoxDecoration.lerp(
const BoxDecoration(),
- new BoxDecoration(gradient: gradient),
+ const BoxDecoration(gradient: gradient),
-1.0,
),
const BoxDecoration(gradient: const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0x00FFFFFF) ]))
@@ -296,7 +296,7 @@
expect(
BoxDecoration.lerp(
const BoxDecoration(),
- new BoxDecoration(gradient: gradient),
+ const BoxDecoration(gradient: gradient),
0.0,
),
const BoxDecoration()
@@ -304,7 +304,7 @@
expect(
BoxDecoration.lerp(
const BoxDecoration(),
- new BoxDecoration(gradient: gradient),
+ const BoxDecoration(gradient: gradient),
0.25,
),
const BoxDecoration(gradient: const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0x40FFFFFF) ]))
@@ -312,7 +312,7 @@
expect(
BoxDecoration.lerp(
const BoxDecoration(),
- new BoxDecoration(gradient: gradient),
+ const BoxDecoration(gradient: gradient),
0.75,
),
const BoxDecoration(gradient: const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0xBFFFFFFF) ]))
@@ -320,18 +320,18 @@
expect(
BoxDecoration.lerp(
const BoxDecoration(),
- new BoxDecoration(gradient: gradient),
+ const BoxDecoration(gradient: gradient),
1.0,
),
- new BoxDecoration(gradient: gradient)
+ const BoxDecoration(gradient: gradient)
);
expect(
BoxDecoration.lerp(
const BoxDecoration(),
- new BoxDecoration(gradient: gradient),
+ const BoxDecoration(gradient: gradient),
2.0,
),
- new BoxDecoration(gradient: gradient)
+ const BoxDecoration(gradient: gradient)
);
});
diff --git a/packages/flutter/test/painting/edge_insets_test.dart b/packages/flutter/test/painting/edge_insets_test.dart
index 5239074..813d617a3 100644
--- a/packages/flutter/test/painting/edge_insets_test.dart
+++ b/packages/flutter/test/painting/edge_insets_test.dart
@@ -39,8 +39,8 @@
});
test('EdgeInsets.lerp()', () {
- final EdgeInsets a = const EdgeInsets.all(10.0);
- final EdgeInsets b = const EdgeInsets.all(20.0);
+ const EdgeInsets a = const EdgeInsets.all(10.0);
+ const EdgeInsets b = const EdgeInsets.all(20.0);
expect(EdgeInsets.lerp(a, b, 0.25), equals(a * 1.25));
expect(EdgeInsets.lerp(a, b, 0.25), equals(b * 0.625));
expect(EdgeInsets.lerp(a, b, 0.25), equals(a + const EdgeInsets.all(2.5)));
@@ -95,7 +95,7 @@
});
test('EdgeInsets copyWith', () {
- final EdgeInsets sourceEdgeInsets = const EdgeInsets.only(left: 1.0, top: 2.0, bottom: 3.0, right: 4.0);
+ const EdgeInsets sourceEdgeInsets = const EdgeInsets.only(left: 1.0, top: 2.0, bottom: 3.0, right: 4.0);
final EdgeInsets copy = sourceEdgeInsets.copyWith(left: 5.0, top: 6.0);
expect(copy, const EdgeInsets.only(left: 5.0, top: 6.0, bottom: 3.0, right: 4.0));
});
@@ -113,8 +113,8 @@
});
test('EdgeInsetsGeometry.lerp(normal, ...)', () {
- final EdgeInsets a = const EdgeInsets.all(10.0);
- final EdgeInsets b = const EdgeInsets.all(20.0);
+ const EdgeInsets a = const EdgeInsets.all(10.0);
+ const EdgeInsets b = const EdgeInsets.all(20.0);
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(a * 1.25));
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(b * 0.625));
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(a + const EdgeInsets.all(2.5)));
@@ -126,8 +126,8 @@
});
test('EdgeInsetsGeometry.lerp(directional, ...)', () {
- final EdgeInsetsDirectional a = const EdgeInsetsDirectional.only(start: 10.0, end: 10.0);
- final EdgeInsetsDirectional b = const EdgeInsetsDirectional.only(start: 20.0, end: 20.0);
+ const EdgeInsetsDirectional a = const EdgeInsetsDirectional.only(start: 10.0, end: 10.0);
+ const EdgeInsetsDirectional b = const EdgeInsetsDirectional.only(start: 20.0, end: 20.0);
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(a * 1.25));
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(b * 0.625));
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(a + const EdgeInsetsDirectional.only(start: 2.5, end: 2.5)));
diff --git a/packages/flutter/test/painting/gradient_test.dart b/packages/flutter/test/painting/gradient_test.dart
index 8b54ef3..b35c974 100644
--- a/packages/flutter/test/painting/gradient_test.dart
+++ b/packages/flutter/test/painting/gradient_test.dart
@@ -7,7 +7,7 @@
void main() {
test('LinearGradient scale test', () {
- final LinearGradient testGradient = const LinearGradient(
+ const LinearGradient testGradient = const LinearGradient(
begin: Alignment.bottomRight,
end: const Alignment(0.7, 1.0),
colors: const <Color>[
@@ -30,7 +30,7 @@
});
test('LinearGradient lerp test', () {
- final LinearGradient testGradient1 = const LinearGradient(
+ const LinearGradient testGradient1 = const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomLeft,
colors: const <Color>[
@@ -38,7 +38,7 @@
const Color(0x66666666),
],
);
- final LinearGradient testGradient2 = const LinearGradient(
+ const LinearGradient testGradient2 = const LinearGradient(
begin: Alignment.topRight,
end: Alignment.topLeft,
colors: const <Color>[
@@ -153,7 +153,7 @@
});
test('RadialGradient lerp test', () {
- final RadialGradient testGradient1 = const RadialGradient(
+ const RadialGradient testGradient1 = const RadialGradient(
center: Alignment.topLeft,
radius: 20.0,
colors: const <Color>[
@@ -161,7 +161,7 @@
const Color(0x66666666),
],
);
- final RadialGradient testGradient2 = const RadialGradient(
+ const RadialGradient testGradient2 = const RadialGradient(
center: Alignment.topRight,
radius: 10.0,
colors: const <Color>[
@@ -182,7 +182,7 @@
});
test('Gradient lerp test (with RadialGradient)', () {
- final RadialGradient testGradient1 = const RadialGradient(
+ const RadialGradient testGradient1 = const RadialGradient(
center: Alignment.topLeft,
radius: 20.0,
colors: const <Color>[
@@ -190,7 +190,7 @@
const Color(0x66666666),
],
);
- final RadialGradient testGradient2 = const RadialGradient(
+ const RadialGradient testGradient2 = const RadialGradient(
center: const Alignment(0.0, -1.0),
radius: 15.0,
colors: const <Color>[
@@ -198,7 +198,7 @@
const Color(0x77777777),
],
);
- final RadialGradient testGradient3 = const RadialGradient(
+ const RadialGradient testGradient3 = const RadialGradient(
center: Alignment.topRight,
radius: 10.0,
colors: const <Color>[
@@ -216,7 +216,7 @@
});
test('Gradient lerp test (LinearGradient to RadialGradient)', () {
- final LinearGradient testGradient1 = const LinearGradient(
+ const LinearGradient testGradient1 = const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: const <Color>[
@@ -224,7 +224,7 @@
const Color(0x66666666),
],
);
- final RadialGradient testGradient2 = const RadialGradient(
+ const RadialGradient testGradient2 = const RadialGradient(
center: Alignment.center,
radius: 20.0,
colors: const <Color>[
@@ -239,21 +239,21 @@
});
test('Gradients can handle missing stops and report mismatched stops', () {
- final LinearGradient test1a = const LinearGradient(
+ const LinearGradient test1a = const LinearGradient(
colors: const <Color>[
const Color(0x11111111),
const Color(0x22222222),
const Color(0x33333333),
],
);
- final RadialGradient test1b = const RadialGradient(
+ const RadialGradient test1b = const RadialGradient(
colors: const <Color>[
const Color(0x11111111),
const Color(0x22222222),
const Color(0x33333333),
],
);
- final LinearGradient test2a = const LinearGradient(
+ const LinearGradient test2a = const LinearGradient(
colors: const <Color>[
const Color(0x11111111),
const Color(0x22222222),
@@ -261,7 +261,7 @@
],
stops: const <double>[0.0, 1.0],
);
- final RadialGradient test2b = const RadialGradient(
+ const RadialGradient test2b = const RadialGradient(
colors: const <Color>[
const Color(0x11111111),
const Color(0x22222222),
diff --git a/packages/flutter/test/painting/rounded_rectangle_border_test.dart b/packages/flutter/test/painting/rounded_rectangle_border_test.dart
index 76d0a9c..a874f42 100644
--- a/packages/flutter/test/painting/rounded_rectangle_border_test.dart
+++ b/packages/flutter/test/painting/rounded_rectangle_border_test.dart
@@ -38,7 +38,7 @@
test('RoundedRectangleBorder and CircleBorder', () {
final RoundedRectangleBorder r = new RoundedRectangleBorder(side: BorderSide.none, borderRadius: new BorderRadius.circular(10.0));
- final CircleBorder c = const CircleBorder(side: BorderSide.none);
+ const CircleBorder c = const CircleBorder(side: BorderSide.none);
final Rect rect = new Rect.fromLTWH(0.0, 0.0, 100.0, 20.0); // center is x=40..60 y=10
final Matcher looksLikeR = isPathThat(
includes: const <Offset>[ const Offset(30.0, 10.0), const Offset(50.0, 10.0), ],
diff --git a/packages/flutter/test/painting/shape_border_test.dart b/packages/flutter/test/painting/shape_border_test.dart
index 1e05595..d268a6e 100644
--- a/packages/flutter/test/painting/shape_border_test.dart
+++ b/packages/flutter/test/painting/shape_border_test.dart
@@ -72,10 +72,10 @@
});
test('Compound borders', () {
- final BorderSide side1 = const BorderSide(color: const Color(0xFF00FF00));
- final BorderSide side2 = const BorderSide(color: const Color(0xFF0000FF));
- final BorderDirectional b1 = new BorderDirectional(top: side1, start: side1, end: side1, bottom: side1);
- final BorderDirectional b2 = new BorderDirectional(top: side2, start: side2, end: side2, bottom: side2);
+ const BorderSide side1 = const BorderSide(color: const Color(0xFF00FF00));
+ const BorderSide side2 = const BorderSide(color: const Color(0xFF0000FF));
+ const BorderDirectional b1 = const BorderDirectional(top: side1, start: side1, end: side1, bottom: side1);
+ const BorderDirectional b2 = const BorderDirectional(top: side2, start: side2, end: side2, bottom: side2);
expect(
(b1 + b2).toString(),
'BorderDirectional(top: BorderSide(Color(0xff00ff00), 1.0, BorderStyle.solid), start: BorderSide(Color(0xff00ff00), 1.0, BorderStyle.solid), end: BorderSide(Color(0xff00ff00), 1.0, BorderStyle.solid), bottom: BorderSide(Color(0xff00ff00), 1.0, BorderStyle.solid)) + '
diff --git a/packages/flutter/test/painting/shape_decoration_test.dart b/packages/flutter/test/painting/shape_decoration_test.dart
index bcc8ae5..2a5d5ab 100644
--- a/packages/flutter/test/painting/shape_decoration_test.dart
+++ b/packages/flutter/test/painting/shape_decoration_test.dart
@@ -15,12 +15,12 @@
new TestRenderingFlutterBinding(); // initializes the imageCache
test('ShapeDecoration constructor', () {
- final Color colorR = const Color(0xffff0000);
- final Color colorG = const Color(0xff00ff00);
+ const Color colorR = const Color(0xffff0000);
+ const Color colorG = const Color(0xff00ff00);
final Gradient gradient = new LinearGradient(colors: <Color>[colorR, colorG]);
expect(const ShapeDecoration(shape: const Border()), const ShapeDecoration(shape: const Border()));
expect(() => new ShapeDecoration(color: colorR, gradient: gradient, shape: const Border()), throwsAssertionError);
- expect(() => new ShapeDecoration(color: colorR, shape: null), throwsAssertionError);
+ expect(() => new ShapeDecoration(gradient: gradient, shape: null), throwsAssertionError);
expect(
new ShapeDecoration.fromBoxDecoration(const BoxDecoration(shape: BoxShape.circle)),
const ShapeDecoration(shape: const CircleBorder(side: BorderSide.none)),
@@ -31,7 +31,7 @@
);
expect(
new ShapeDecoration.fromBoxDecoration(new BoxDecoration(shape: BoxShape.circle, border: new Border.all(color: colorG))),
- new ShapeDecoration(shape: new CircleBorder(side: new BorderSide(color: colorG))),
+ const ShapeDecoration(shape: const CircleBorder(side: const BorderSide(color: colorG))),
);
expect(
new ShapeDecoration.fromBoxDecoration(new BoxDecoration(shape: BoxShape.rectangle, border: new Border.all(color: colorR))),
@@ -44,8 +44,8 @@
});
test('ShapeDecoration.lerp and hit test', () {
- final Decoration a = const ShapeDecoration(shape: const CircleBorder());
- final Decoration b = const ShapeDecoration(shape: const RoundedRectangleBorder());
+ const Decoration a = const ShapeDecoration(shape: const CircleBorder());
+ const Decoration b = const ShapeDecoration(shape: const RoundedRectangleBorder());
expect(Decoration.lerp(a, b, 0.0), a);
expect(Decoration.lerp(a, b, 1.0), b);
const Size size = const Size(200.0, 100.0); // at t=0.5, width will be 150 (x=25 to x=175).
diff --git a/packages/flutter/test/painting/stadium_border_test.dart b/packages/flutter/test/painting/stadium_border_test.dart
index a4613c8..a491c10 100644
--- a/packages/flutter/test/painting/stadium_border_test.dart
+++ b/packages/flutter/test/painting/stadium_border_test.dart
@@ -10,9 +10,9 @@
void main() {
test('StadiumBorder', () {
- final StadiumBorder c10 = const StadiumBorder(side: const BorderSide(width: 10.0));
- final StadiumBorder c15 = const StadiumBorder(side: const BorderSide(width: 15.0));
- final StadiumBorder c20 = const StadiumBorder(side: const BorderSide(width: 20.0));
+ const StadiumBorder c10 = const StadiumBorder(side: const BorderSide(width: 10.0));
+ const StadiumBorder c15 = const StadiumBorder(side: const BorderSide(width: 15.0));
+ const StadiumBorder c20 = const StadiumBorder(side: const BorderSide(width: 20.0));
expect(c10.dimensions, const EdgeInsets.all(10.0));
expect(c10.scale(2.0), c20);
expect(c20.scale(0.5), c10);
@@ -20,9 +20,9 @@
expect(ShapeBorder.lerp(c10, c20, 0.5), c15);
expect(ShapeBorder.lerp(c10, c20, 1.0), c20);
- final StadiumBorder c1 = const StadiumBorder(side: const BorderSide(width: 1.0));
+ const StadiumBorder c1 = const StadiumBorder(side: const BorderSide(width: 1.0));
expect(c1.getOuterPath(new Rect.fromCircle(center: Offset.zero, radius: 1.0)), isUnitCircle);
- final StadiumBorder c2 = const StadiumBorder(side: const BorderSide(width: 1.0));
+ const StadiumBorder c2 = const StadiumBorder(side: const BorderSide(width: 1.0));
expect(c2.getInnerPath(new Rect.fromCircle(center: Offset.zero, radius: 2.0)), isUnitCircle);
final Rect rect = new Rect.fromLTRB(10.0, 20.0, 100.0, 200.0);
expect(
@@ -36,8 +36,8 @@
});
test('StadiumBorder and CircleBorder', () {
- final StadiumBorder stadium = const StadiumBorder(side: BorderSide.none);
- final CircleBorder circle = const CircleBorder(side: BorderSide.none);
+ const StadiumBorder stadium = const StadiumBorder(side: BorderSide.none);
+ const CircleBorder circle = const CircleBorder(side: BorderSide.none);
final Rect rect = new Rect.fromLTWH(0.0, 0.0, 100.0, 20.0);
final Matcher looksLikeS = isPathThat(
includes: const <Offset>[ const Offset(30.0, 10.0), const Offset(50.0, 10.0), ],
@@ -87,8 +87,8 @@
});
test('StadiumBorder and RoundedRectBorder', () {
- final StadiumBorder stadium = const StadiumBorder(side: BorderSide.none);
- final RoundedRectangleBorder rrect = const RoundedRectangleBorder(side: BorderSide.none);
+ const StadiumBorder stadium = const StadiumBorder(side: BorderSide.none);
+ const RoundedRectangleBorder rrect = const RoundedRectangleBorder(side: BorderSide.none);
final Rect rect = new Rect.fromLTWH(0.0, 0.0, 100.0, 50.0);
final Matcher looksLikeS = isPathThat(
includes: const <Offset>[
diff --git a/packages/flutter/test/painting/text_span_test.dart b/packages/flutter/test/painting/text_span_test.dart
index 0012192..75ec26e 100644
--- a/packages/flutter/test/painting/text_span_test.dart
+++ b/packages/flutter/test/painting/text_span_test.dart
@@ -13,7 +13,7 @@
final TextSpan a2 = new TextSpan(text: text);
final TextSpan b1 = new TextSpan(children: <TextSpan>[ a1 ]);
final TextSpan b2 = new TextSpan(children: <TextSpan>[ a2 ]);
- String nullText; // we want these instances to be separate instances so that we're not just checking with a single object
+ final String nullText = null; // we want these instances to be separate instances so that we're not just checking with a single object
final TextSpan c1 = new TextSpan(text: nullText);
final TextSpan c2 = new TextSpan(text: nullText);
@@ -31,7 +31,7 @@
});
test('TextSpan toStringDeep', () {
- final TextSpan test = const TextSpan(
+ const TextSpan test = const TextSpan(
text: 'a',
style: const TextStyle(
fontSize: 10.0,
diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart
index f6c1ff9..98a9781 100644
--- a/packages/flutter/test/painting/text_style_test.dart
+++ b/packages/flutter/test/painting/text_style_test.dart
@@ -18,7 +18,7 @@
equals('TextStyle(<all styles inherited>)'),
);
- final TextStyle s1 = const TextStyle(
+ const TextStyle s1 = const TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.w800,
height: 123.0,
@@ -134,11 +134,11 @@
});
test('TextStyle using package font', () {
- final TextStyle s6 = const TextStyle(fontFamily: 'test');
+ const TextStyle s6 = const TextStyle(fontFamily: 'test');
expect(s6.fontFamily, 'test');
expect(s6.getTextStyle().toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: unspecified, fontStyle: unspecified, textBaseline: unspecified, fontFamily: test, fontSize: unspecified, letterSpacing: unspecified, wordSpacing: unspecified, height: unspecified)');
- final TextStyle s7 = const TextStyle(fontFamily: 'test', package: 'p');
+ const TextStyle s7 = const TextStyle(fontFamily: 'test', package: 'p');
expect(s7.fontFamily, 'packages/p/test');
expect(s7.getTextStyle().toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: unspecified, fontStyle: unspecified, textBaseline: unspecified, fontFamily: packages/p/test, fontSize: unspecified, letterSpacing: unspecified, wordSpacing: unspecified, height: unspecified)');
});
diff --git a/packages/flutter/test/physics/newton_test.dart b/packages/flutter/test/physics/newton_test.dart
index 724353c..4eed86d 100644
--- a/packages/flutter/test/physics/newton_test.dart
+++ b/packages/flutter/test/physics/newton_test.dart
@@ -48,7 +48,7 @@
expect(friction.x(0.0), 10.0);
expect(friction.dx(0.0), 600.0);
- final double epsilon = 1e-4;
+ const double epsilon = 1e-4;
expect(friction.isDone(1.0 + epsilon), true);
expect(friction.x(1.0), closeTo(endPosition, epsilon));
expect(friction.dx(1.0), closeTo(endVelocity, epsilon));
diff --git a/packages/flutter/test/rendering/box_constraints_test.dart b/packages/flutter/test/rendering/box_constraints_test.dart
index a65cef8..aaa8073 100644
--- a/packages/flutter/test/rendering/box_constraints_test.dart
+++ b/packages/flutter/test/rendering/box_constraints_test.dart
@@ -13,7 +13,7 @@
});
test('BoxConstraints copyWith', () {
- final BoxConstraints constraints = const BoxConstraints(
+ const BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0,
maxWidth: 7.0,
minHeight: 11.0,
@@ -36,7 +36,7 @@
});
test('BoxConstraints operators', () {
- final BoxConstraints constraints = const BoxConstraints(
+ const BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0,
maxWidth: 7.0,
minHeight: 11.0,
@@ -62,7 +62,7 @@
test('BoxConstraints lerp', () {
expect(BoxConstraints.lerp(null, null, 0.5), isNull);
- final BoxConstraints constraints = const BoxConstraints(
+ const BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0,
maxWidth: 7.0,
minHeight: 11.0,
@@ -91,19 +91,19 @@
});
test('BoxConstraints lerp with unbounded width', () {
- final BoxConstraints constraints1 = const BoxConstraints(
+ const BoxConstraints constraints1 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: 10.0,
maxHeight: 20.0,
);
- final BoxConstraints constraints2 = const BoxConstraints(
+ const BoxConstraints constraints2 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: 20.0,
maxHeight: 30.0,
);
- final BoxConstraints constraints3 = const BoxConstraints(
+ const BoxConstraints constraints3 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: 15.0,
@@ -113,19 +113,19 @@
});
test('BoxConstraints lerp with unbounded height', () {
- final BoxConstraints constraints1 = const BoxConstraints(
+ const BoxConstraints constraints1 = const BoxConstraints(
minWidth: 10.0,
maxWidth: 20.0,
minHeight: double.INFINITY,
maxHeight: double.INFINITY,
);
- final BoxConstraints constraints2 = const BoxConstraints(
+ const BoxConstraints constraints2 = const BoxConstraints(
minWidth: 20.0,
maxWidth: 30.0,
minHeight: double.INFINITY,
maxHeight: double.INFINITY,
);
- final BoxConstraints constraints3 = const BoxConstraints(
+ const BoxConstraints constraints3 = const BoxConstraints(
minWidth: 15.0,
maxWidth: 25.0,
minHeight: double.INFINITY,
@@ -135,19 +135,19 @@
});
test('BoxConstraints lerp from bounded to unbounded', () {
- final BoxConstraints constraints1 = const BoxConstraints(
+ const BoxConstraints constraints1 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: double.INFINITY,
maxHeight: double.INFINITY,
);
- final BoxConstraints constraints2 = const BoxConstraints(
+ const BoxConstraints constraints2 = const BoxConstraints(
minWidth: 20.0,
maxWidth: 30.0,
minHeight: double.INFINITY,
maxHeight: double.INFINITY,
);
- final BoxConstraints constraints3 = const BoxConstraints(
+ const BoxConstraints constraints3 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: 20.0,
@@ -159,7 +159,7 @@
});
test('BoxConstraints normalize', () {
- final BoxConstraints constraints = const BoxConstraints(
+ const BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0,
maxWidth: 2.0,
minHeight: 11.0,
diff --git a/packages/flutter/test/rendering/box_test.dart b/packages/flutter/test/rendering/box_test.dart
index d8a7b32..2a2a6bc 100644
--- a/packages/flutter/test/rendering/box_test.dart
+++ b/packages/flutter/test/rendering/box_test.dart
@@ -163,7 +163,7 @@
),
alignment: Alignment.center,
);
- final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
+ const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(unconstrained, constraints: viewport);
expect(unconstrained.getMinIntrinsicHeight(100.0), equals(200.0));
expect(unconstrained.getMaxIntrinsicHeight(100.0), equals(200.0));
@@ -179,7 +179,7 @@
),
alignment: Alignment.center,
);
- final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
+ const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(unconstrained, constraints: viewport);
expect(unconstrained.getMinIntrinsicHeight(100.0), equals(0.0));
expect(unconstrained.getMaxIntrinsicHeight(100.0), equals(0.0));
@@ -224,7 +224,7 @@
flexParentData.flex = 1;
flexParentData.fit = FlexFit.tight;
- final BoxConstraints viewport = const BoxConstraints(maxWidth: 100.0);
+ const BoxConstraints viewport = const BoxConstraints(maxWidth: 100.0);
layout(unconstrained, constraints: viewport);
expect(unconstrained.size.width, equals(100.0), reason: 'constrained width');
@@ -248,7 +248,7 @@
flexParentData.flex = 1;
flexParentData.fit = FlexFit.tight;
- final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0);
+ const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0);
layout(unconstrained, constraints: viewport);
expect(unconstrained.size.width, equals(200.0), reason: 'unconstrained width');
diff --git a/packages/flutter/test/rendering/constraints_test.dart b/packages/flutter/test/rendering/constraints_test.dart
index a373dfd..f355125 100644
--- a/packages/flutter/test/rendering/constraints_test.dart
+++ b/packages/flutter/test/rendering/constraints_test.dart
@@ -36,7 +36,7 @@
result = 'no exception';
try {
- final BoxConstraints constraints = const BoxConstraints(minWidth: double.NAN, maxWidth: double.NAN, minHeight: 2.0, maxHeight: double.NAN);
+ const BoxConstraints constraints = const BoxConstraints(minWidth: double.NAN, maxWidth: double.NAN, minHeight: 2.0, maxHeight: double.NAN);
assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) {
result = '$e';
@@ -49,7 +49,7 @@
result = 'no exception';
try {
- final BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN);
+ const BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN);
assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) {
result = '$e';
@@ -62,7 +62,7 @@
result = 'no exception';
try {
- final BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN, maxWidth: 0.0/0.0);
+ const BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN, maxWidth: 0.0/0.0);
assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) {
result = '$e';
diff --git a/packages/flutter/test/rendering/debug_overflow_indicator_test.dart b/packages/flutter/test/rendering/debug_overflow_indicator_test.dart
index e092ea0..f25ed1a 100644
--- a/packages/flutter/test/rendering/debug_overflow_indicator_test.dart
+++ b/packages/flutter/test/rendering/debug_overflow_indicator_test.dart
@@ -21,12 +21,12 @@
});
testWidgets('overflow indicator is shown when overflowing', (WidgetTester tester) async {
- final UnconstrainedBox box = const UnconstrainedBox(
+ const UnconstrainedBox box = const UnconstrainedBox(
child: const SizedBox(width: 200.0, height: 200.0),
);
await tester.pumpWidget(
- new Center(
- child: new SizedBox(
+ const Center(
+ child: const SizedBox(
height: 100.0,
child: box,
),
@@ -37,8 +37,8 @@
expect(find.byType(UnconstrainedBox), paints..rect());
await tester.pumpWidget(
- new Center(
- child: new SizedBox(
+ const Center(
+ child: const SizedBox(
height: 100.0,
child: box,
),
diff --git a/packages/flutter/test/rendering/error_test.dart b/packages/flutter/test/rendering/error_test.dart
index 7c1e79d..20b1d76 100644
--- a/packages/flutter/test/rendering/error_test.dart
+++ b/packages/flutter/test/rendering/error_test.dart
@@ -10,7 +10,7 @@
/// Unit tests error.dart's usage via ErrorWidget.
void main() {
- final String errorMessage = 'Some error message';
+ const String errorMessage = 'Some error message';
testWidgets('test draw error paragraph', (WidgetTester tester) async {
await tester.pumpWidget(new ErrorWidget(new Exception(errorMessage)));
diff --git a/packages/flutter/test/rendering/flex_test.dart b/packages/flutter/test/rendering/flex_test.dart
index 2633f4f..fd5ad3e 100644
--- a/packages/flutter/test/rendering/flex_test.dart
+++ b/packages/flutter/test/rendering/flex_test.dart
@@ -34,7 +34,7 @@
);
final FlexParentData flexParentData = flexible.parentData;
flexParentData.flex = 1;
- final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
+ const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(flex, constraints: viewport);
expect(flexible.size.height, equals(0.0));
expect(flex.getMinIntrinsicHeight(100.0), equals(200.0));
@@ -57,7 +57,7 @@
);
final FlexParentData flexParentData = flexible.parentData;
flexParentData.flex = 1;
- final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
+ const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(flex, constraints: viewport);
expect(flexible.size.width, equals(0.0));
expect(flex.getMinIntrinsicHeight(100.0), equals(0.0));
@@ -74,7 +74,7 @@
new RenderAspectRatio(aspectRatio: 1.0),
]
);
- final BoxConstraints viewport = const BoxConstraints(maxHeight: 200.0, maxWidth: 1000.0);
+ const BoxConstraints viewport = const BoxConstraints(maxHeight: 200.0, maxWidth: 1000.0);
layout(flex, constraints: viewport);
expect(flex.getMaxIntrinsicWidth(200.0), equals(0.0));
});
@@ -292,7 +292,7 @@
test('MainAxisSize.min inside unconstrained', () {
FlutterError.onError = (FlutterErrorDetails details) => throw details.exception;
- final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
+ const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
@@ -337,7 +337,7 @@
FlutterError.onError = (FlutterErrorDetails details) {
exceptions.add(details.exception);
};
- final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
+ const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
@@ -366,7 +366,7 @@
FlutterError.onError = (FlutterErrorDetails details) {
exceptions.add(details.exception);
};
- final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
+ const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
@@ -392,7 +392,7 @@
});
test('MainAxisSize.min inside tightly constrained', () {
- final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
+ const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
@@ -412,7 +412,7 @@
});
test('Flex RTL', () {
- final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
+ const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
diff --git a/packages/flutter/test/rendering/independent_layout_test.dart b/packages/flutter/test/rendering/independent_layout_test.dart
index e333ecd..c3b9eb1 100644
--- a/packages/flutter/test/rendering/independent_layout_test.dart
+++ b/packages/flutter/test/rendering/independent_layout_test.dart
@@ -31,7 +31,7 @@
}
void main() {
- final ViewConfiguration testConfiguration = const ViewConfiguration(
+ const ViewConfiguration testConfiguration = const ViewConfiguration(
size: const Size(800.0, 600.0),
devicePixelRatio: 1.0
);
diff --git a/packages/flutter/test/rendering/paragraph_test.dart b/packages/flutter/test/rendering/paragraph_test.dart
index 92a7b77..46a9863 100644
--- a/packages/flutter/test/rendering/paragraph_test.dart
+++ b/packages/flutter/test/rendering/paragraph_test.dart
@@ -225,7 +225,7 @@
});
test('nested TextSpans in paragraph handle textScaleFactor correctly.', () {
- final TextSpan testSpan = const TextSpan(
+ const TextSpan testSpan = const TextSpan(
text: 'a',
style: const TextStyle(
fontSize: 10.0,
diff --git a/packages/flutter/test/rendering/relative_rect_test.dart b/packages/flutter/test/rendering/relative_rect_test.dart
index ae0146f..7a27a0d 100644
--- a/packages/flutter/test/rendering/relative_rect_test.dart
+++ b/packages/flutter/test/rendering/relative_rect_test.dart
@@ -7,45 +7,45 @@
void main() {
test('RelativeRect.==', () {
- final RelativeRect r = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
+ const RelativeRect r = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
expect(r, new RelativeRect.fromSize(new Rect.fromLTWH(10.0, 20.0, 0.0, 0.0), const Size(40.0, 60.0)));
});
test('RelativeRect.shift', () {
- final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
+ const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final RelativeRect r2 = r1.shift(const Offset(5.0, 50.0));
expect(r2, const RelativeRect.fromLTRB(15.0, 70.0, 25.0, -10.0));
});
test('RelativeRect.inflate', () {
- final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
+ const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final RelativeRect r2 = r1.inflate(5.0);
expect(r2, const RelativeRect.fromLTRB(5.0, 15.0, 25.0, 35.0));
});
test('RelativeRect.deflate', () {
- final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
+ const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final RelativeRect r2 = r1.deflate(5.0);
expect(r2, const RelativeRect.fromLTRB(15.0, 25.0, 35.0, 45.0));
});
test('RelativeRect.intersect', () {
- final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
- final RelativeRect r2 = const RelativeRect.fromLTRB(0.0, 30.0, 60.0, 0.0);
+ const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
+ const RelativeRect r2 = const RelativeRect.fromLTRB(0.0, 30.0, 60.0, 0.0);
final RelativeRect r3 = r1.intersect(r2);
final RelativeRect r4 = r2.intersect(r1);
expect(r3, r4);
expect(r3, const RelativeRect.fromLTRB(10.0, 30.0, 60.0, 40.0));
});
test('RelativeRect.toRect', () {
- final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
+ const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final Rect r2 = r1.toRect(new Rect.fromLTRB(10.0, 20.0, 90.0, 180.0));
expect(r2, new Rect.fromLTRB(10.0, 20.0, 50.0, 120.0));
});
test('RelativeRect.toSize', () {
- final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
+ const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final Size r2 = r1.toSize(const Size(80.0, 160.0));
expect(r2, const Size(40.0, 100.0));
});
test('RelativeRect.lerp', () {
final RelativeRect r1 = RelativeRect.fill;
- final RelativeRect r2 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
+ const RelativeRect r2 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final RelativeRect r3 = RelativeRect.lerp(r1, r2, 0.5);
expect(r3, const RelativeRect.fromLTRB(5.0, 10.0, 15.0, 20.0));
});
diff --git a/packages/flutter/test/rendering/slivers_helpers_test.dart b/packages/flutter/test/rendering/slivers_helpers_test.dart
index 2725ccc..230e24c 100644
--- a/packages/flutter/test/rendering/slivers_helpers_test.dart
+++ b/packages/flutter/test/rendering/slivers_helpers_test.dart
@@ -17,7 +17,7 @@
});
test('SliverConstraints', () {
- final SliverConstraints a = const SliverConstraints(
+ const SliverConstraints a = const SliverConstraints(
axisDirection: AxisDirection.down,
growthDirection: GrowthDirection.forward,
userScrollDirection: ScrollDirection.idle,
@@ -45,7 +45,7 @@
crossAxisExtent: 40.0,
viewportMainAxisExtent: 30.0,
);
- final SliverConstraints d = const SliverConstraints(
+ const SliverConstraints d = const SliverConstraints(
axisDirection: AxisDirection.up,
growthDirection: GrowthDirection.reverse,
userScrollDirection: ScrollDirection.forward,
diff --git a/packages/flutter/test/rendering/table_border_test.dart b/packages/flutter/test/rendering/table_border_test.dart
index 4357c12..50d4ce7 100644
--- a/packages/flutter/test/rendering/table_border_test.dart
+++ b/packages/flutter/test/rendering/table_border_test.dart
@@ -7,7 +7,7 @@
void main() {
test('TableBorder constructor', () {
- final TableBorder border1 = const TableBorder(
+ const TableBorder border1 = const TableBorder(
left: const BorderSide(width: 1.0),
right: const BorderSide(color: const Color(0xFF00FF00)),
verticalInside: const BorderSide(),
@@ -69,7 +69,7 @@
const BorderSide side4 = const BorderSide(width: 4.0, color: const Color(4));
const BorderSide side5 = const BorderSide(width: 5.0, color: const Color(5));
const BorderSide side6 = const BorderSide(width: 6.0, color: const Color(6));
- final TableBorder tableA = const TableBorder(
+ const TableBorder tableA = const TableBorder(
top: side1,
right: side2,
bottom: side3,
diff --git a/packages/flutter/test/rendering/transform_test.dart b/packages/flutter/test/rendering/transform_test.dart
index cad402a..9d34601 100644
--- a/packages/flutter/test/rendering/transform_test.dart
+++ b/packages/flutter/test/rendering/transform_test.dart
@@ -167,9 +167,9 @@
Matrix4 rotateAroundXAxis(double a) {
// 3D rotation transform with alpha=a
- final double x = 1.0;
- final double y = 0.0;
- final double z = 0.0;
+ const double x = 1.0;
+ const double y = 0.0;
+ const double z = 0.0;
final double sc = math.sin(a / 2.0) * math.cos(a / 2.0);
final double sq = math.sin(a / 2.0) * math.sin(a / 2.0);
return new Matrix4.fromList(<double>[
diff --git a/packages/flutter/test/services/text_input_test.dart b/packages/flutter/test/services/text_input_test.dart
index 838475d..6c7730c 100644
--- a/packages/flutter/test/services/text_input_test.dart
+++ b/packages/flutter/test/services/text_input_test.dart
@@ -8,7 +8,7 @@
void main() {
group('TextInputConfiguration', () {
test('sets expected defaults', () {
- final TextInputConfiguration configuration = const TextInputConfiguration();
+ const TextInputConfiguration configuration = const TextInputConfiguration();
expect(configuration.inputType, TextInputType.text);
expect(configuration.obscureText, false);
expect(configuration.autocorrect, true);
@@ -16,7 +16,7 @@
});
test('serializes to JSON', () async {
- final TextInputConfiguration configuration = const TextInputConfiguration(
+ const TextInputConfiguration configuration = const TextInputConfiguration(
inputType: TextInputType.number,
obscureText: true,
autocorrect: false,
diff --git a/packages/flutter/test/widgets/animated_align_test.dart b/packages/flutter/test/widgets/animated_align_test.dart
index 74f43e4..fb86ccc 100644
--- a/packages/flutter/test/widgets/animated_align_test.dart
+++ b/packages/flutter/test/widgets/animated_align_test.dart
@@ -8,7 +8,7 @@
void main() {
testWidgets('AnimatedAlign.debugFillProperties', (WidgetTester tester) async {
- final AnimatedAlign box = const AnimatedAlign(
+ const AnimatedAlign box = const AnimatedAlign(
alignment: Alignment.topCenter,
curve: Curves.ease,
duration: const Duration(milliseconds: 200),
diff --git a/packages/flutter/test/widgets/animated_container_test.dart b/packages/flutter/test/widgets/animated_container_test.dart
index b218480..97434d3 100644
--- a/packages/flutter/test/widgets/animated_container_test.dart
+++ b/packages/flutter/test/widgets/animated_container_test.dart
@@ -27,11 +27,11 @@
testWidgets('AnimatedContainer control test', (WidgetTester tester) async {
final GlobalKey key = new GlobalKey();
- final BoxDecoration decorationA = const BoxDecoration(
+ const BoxDecoration decorationA = const BoxDecoration(
color: const Color(0xFF00FF00),
);
- final BoxDecoration decorationB = const BoxDecoration(
+ const BoxDecoration decorationB = const BoxDecoration(
color: const Color(0xFF0000FF),
);
diff --git a/packages/flutter/test/widgets/binding_test.dart b/packages/flutter/test/widgets/binding_test.dart
index 52ccb89..907be29 100644
--- a/packages/flutter/test/widgets/binding_test.dart
+++ b/packages/flutter/test/widgets/binding_test.dart
@@ -76,9 +76,9 @@
final PushRouteObserver observer = new PushRouteObserver();
WidgetsBinding.instance.addObserver(observer);
- final String testRouteName = 'testRouteName';
+ const String testRouteName = 'testRouteName';
final ByteData message = const JSONMethodCodec().encodeMethodCall(
- new MethodCall('pushRoute', testRouteName));
+ const MethodCall('pushRoute', testRouteName));
await BinaryMessages.handlePlatformMessage('flutter/navigation', message, (_) {});
expect(observer.pushedRoute, testRouteName);
diff --git a/packages/flutter/test/widgets/box_decoration_test.dart b/packages/flutter/test/widgets/box_decoration_test.dart
index 8c48b0b..be4d43d 100644
--- a/packages/flutter/test/widgets/box_decoration_test.dart
+++ b/packages/flutter/test/widgets/box_decoration_test.dart
@@ -104,7 +104,7 @@
});
testWidgets('Bordered Container insets its child', (WidgetTester tester) async {
- final Key key = const Key('outerContainer');
+ const Key key = const Key('outerContainer');
await tester.pumpWidget(
new Center(
child: new Container(
@@ -123,7 +123,7 @@
testWidgets('BoxDecoration paints its border correctly', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/7672
- final Key key = const Key('Container with BoxDecoration');
+ const Key key = const Key('Container with BoxDecoration');
Widget buildFrame(Border border) {
return new Center(
child: new Container(
@@ -135,7 +135,7 @@
);
}
- final Color black = const Color(0xFF000000);
+ const Color black = const Color(0xFF000000);
await tester.pumpWidget(buildFrame(new Border.all()));
expect(find.byKey(key), paints
@@ -145,25 +145,25 @@
expect(find.byKey(key), paints
..rect(color: black, style: PaintingStyle.stroke, strokeWidth: 0.0));
- final Color green = const Color(0xFF00FF00);
- final BorderSide greenSide = new BorderSide(color: green, width: 10.0);
+ const Color green = const Color(0xFF00FF00);
+ const BorderSide greenSide = const BorderSide(color: green, width: 10.0);
- await tester.pumpWidget(buildFrame(new Border(top: greenSide)));
+ await tester.pumpWidget(buildFrame(const Border(top: greenSide)));
expect(find.byKey(key), paints..path(color: green, style: PaintingStyle.fill));
- await tester.pumpWidget(buildFrame(new Border(left: greenSide)));
+ await tester.pumpWidget(buildFrame(const Border(left: greenSide)));
expect(find.byKey(key), paints..path(color: green, style: PaintingStyle.fill));
- await tester.pumpWidget(buildFrame(new Border(right: greenSide)));
+ await tester.pumpWidget(buildFrame(const Border(right: greenSide)));
expect(find.byKey(key), paints..path(color: green, style: PaintingStyle.fill));
- await tester.pumpWidget(buildFrame(new Border(bottom: greenSide)));
+ await tester.pumpWidget(buildFrame(const Border(bottom: greenSide)));
expect(find.byKey(key), paints..path(color: green, style: PaintingStyle.fill));
- final Color blue = const Color(0xFF0000FF);
- final BorderSide blueSide = new BorderSide(color: blue, width: 0.0);
+ const Color blue = const Color(0xFF0000FF);
+ const BorderSide blueSide = const BorderSide(color: blue, width: 0.0);
- await tester.pumpWidget(buildFrame(new Border(top: blueSide, right: greenSide, bottom: greenSide)));
+ await tester.pumpWidget(buildFrame(const Border(top: blueSide, right: greenSide, bottom: greenSide)));
expect(find.byKey(key), paints
..path() // There's not much point checking the arguments to these calls because paintBorder
..path() // reuses the same Paint object each time, configured differently, and so they will
@@ -268,7 +268,7 @@
List<int> itemsTapped;
- final Key key = const Key('Container with BoxDecoration');
+ const Key key = const Key('Container with BoxDecoration');
Widget buildFrame(Border border) {
itemsTapped = <int>[];
return new Center(
@@ -305,7 +305,7 @@
List<int> itemsTapped;
- final Key key = const Key('Container with BoxDecoration');
+ const Key key = const Key('Container with BoxDecoration');
Widget buildFrame(Border border) {
itemsTapped = <int>[];
return new Center(
diff --git a/packages/flutter/test/widgets/column_test.dart b/packages/flutter/test/widgets/column_test.dart
index bfe832b..a10bcf3 100644
--- a/packages/flutter/test/widgets/column_test.dart
+++ b/packages/flutter/test/widgets/column_test.dart
@@ -10,10 +10,10 @@
// DOWN (default)
testWidgets('Column with one flexible child', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
@@ -56,10 +56,10 @@
});
testWidgets('Column with default main axis parameters', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
@@ -102,9 +102,9 @@
});
testWidgets('Column with MainAxisAlignment.center', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 200, 300
@@ -140,10 +140,10 @@
});
testWidgets('Column with MainAxisAlignment.end', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 300, 400, 500.
@@ -186,10 +186,10 @@
});
testWidgets('Column with MainAxisAlignment.spaceBetween', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 0, 250, 500
@@ -232,11 +232,11 @@
});
testWidgets('Column with MainAxisAlignment.spaceAround', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
- final Key child3Key = const Key('child3');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
+ const Key child3Key = const Key('child3');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 25, 175, 325, 475
@@ -286,10 +286,10 @@
});
testWidgets('Column with MainAxisAlignment.spaceEvenly', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x20 children's top edges should be at 135, 290, 445
@@ -332,7 +332,7 @@
});
testWidgets('Column and MainAxisSize.min', (WidgetTester tester) async {
- final Key flexKey = const Key('flexKey');
+ const Key flexKey = const Key('flexKey');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
await tester.pumpWidget(new Center(
@@ -365,7 +365,7 @@
});
testWidgets('Column MainAxisSize.min layout at zero size', (WidgetTester tester) async {
- final Key childKey = const Key('childKey');
+ const Key childKey = const Key('childKey');
await tester.pumpWidget(new Center(
child: new Container(
@@ -393,10 +393,10 @@
// UP
testWidgets('Column with one flexible child', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
@@ -440,10 +440,10 @@
});
testWidgets('Column with default main axis parameters', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
@@ -487,9 +487,9 @@
});
testWidgets('Column with MainAxisAlignment.center', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's bottom edges should be at 200, 300 from bottom
@@ -526,10 +526,10 @@
});
testWidgets('Column with MainAxisAlignment.end', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's bottom edges should be at 300, 400, 500 from bottom.
@@ -573,10 +573,10 @@
});
testWidgets('Column with MainAxisAlignment.spaceBetween', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's bottom edges should be at 0, 250, 500 from bottom
@@ -620,11 +620,11 @@
});
testWidgets('Column with MainAxisAlignment.spaceAround', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
- final Key child3Key = const Key('child3');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
+ const Key child3Key = const Key('child3');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's bottom edges should be at 25, 175, 325, 475 from bottom
@@ -675,10 +675,10 @@
});
testWidgets('Column with MainAxisAlignment.spaceEvenly', (WidgetTester tester) async {
- final Key columnKey = const Key('column');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key columnKey = const Key('column');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x20 children's bottom edges should be at 135, 290, 445 from bottom
@@ -722,7 +722,7 @@
});
testWidgets('Column and MainAxisSize.min', (WidgetTester tester) async {
- final Key flexKey = const Key('flexKey');
+ const Key flexKey = const Key('flexKey');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
await tester.pumpWidget(new Center(
@@ -757,7 +757,7 @@
});
testWidgets('Column MainAxisSize.min layout at zero size', (WidgetTester tester) async {
- final Key childKey = const Key('childKey');
+ const Key childKey = const Key('childKey');
await tester.pumpWidget(new Center(
child: new Container(
diff --git a/packages/flutter/test/widgets/dismissible_test.dart b/packages/flutter/test/widgets/dismissible_test.dart
index beb5c29..eb8070e 100644
--- a/packages/flutter/test/widgets/dismissible_test.dart
+++ b/packages/flutter/test/widgets/dismissible_test.dart
@@ -539,7 +539,7 @@
await tester.pumpWidget(buildTest());
final Offset location = tester.getTopLeft(find.text('0'));
- final Offset offset = const Offset(0.0, 5.0);
+ const Offset offset = const Offset(0.0, 5.0);
final TestGesture gesture = await tester.startGesture(location, pointer: 5);
await gesture.moveBy(offset);
await tester.pumpWidget(buildTest());
diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart
index e20fd28..8d3f977 100644
--- a/packages/flutter/test/widgets/editable_text_test.dart
+++ b/packages/flutter/test/widgets/editable_text_test.dart
@@ -17,8 +17,8 @@
final TextEditingController controller = new TextEditingController();
final FocusNode focusNode = new FocusNode();
final FocusScopeNode focusScopeNode = new FocusScopeNode();
- final TextStyle textStyle = const TextStyle();
- final Color cursorColor = const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00);
+ const TextStyle textStyle = const TextStyle();
+ const Color cursorColor = const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00);
setUp(() {
debugResetSemanticsIdCounter();
diff --git a/packages/flutter/test/widgets/form_test.dart b/packages/flutter/test/widgets/form_test.dart
index d5827e2..d757cf3 100644
--- a/packages/flutter/test/widgets/form_test.dart
+++ b/packages/flutter/test/widgets/form_test.dart
@@ -166,7 +166,7 @@
});
testWidgets('Provide initial value to input when no controller is specified', (WidgetTester tester) async {
- final String initialValue = 'hello';
+ const String initialValue = 'hello';
final GlobalKey<FormFieldState<String>> inputKey = new GlobalKey<FormFieldState<String>>();
Widget builder() {
@@ -206,7 +206,7 @@
testWidgets('Provide initial value to input when controller is specified', (WidgetTester tester) async {
final TextEditingController controller = new TextEditingController();
- final String initialValue = 'hello';
+ const String initialValue = 'hello';
final GlobalKey<FormFieldState<String>> inputKey = new GlobalKey<FormFieldState<String>>();
Widget builder() {
diff --git a/packages/flutter/test/widgets/gesture_detector_test.dart b/packages/flutter/test/widgets/gesture_detector_test.dart
index 679a78a..a779bd9 100644
--- a/packages/flutter/test/widgets/gesture_detector_test.dart
+++ b/packages/flutter/test/widgets/gesture_detector_test.dart
@@ -33,14 +33,14 @@
expect(updatedDragDelta, isNull);
expect(didEndDrag, isFalse);
- final Offset firstLocation = const Offset(10.0, 10.0);
+ const Offset firstLocation = const Offset(10.0, 10.0);
final TestGesture gesture = await tester.startGesture(firstLocation, pointer: 7);
expect(didStartDrag, isTrue);
didStartDrag = false;
expect(updatedDragDelta, isNull);
expect(didEndDrag, isFalse);
- final Offset secondLocation = const Offset(10.0, 9.0);
+ const Offset secondLocation = const Offset(10.0, 9.0);
await gesture.moveTo(secondLocation);
expect(didStartDrag, isFalse);
expect(updatedDragDelta, -1.0);
@@ -60,8 +60,8 @@
int gestureCount = 0;
double dragDistance = 0.0;
- final Offset downLocation = const Offset(10.0, 10.0);
- final Offset upLocation = const Offset(10.0, 50.0); // must be far enough to be more than kTouchSlop
+ const Offset downLocation = const Offset(10.0, 10.0);
+ const Offset upLocation = const Offset(10.0, 50.0); // must be far enough to be more than kTouchSlop
final Widget widget = new GestureDetector(
onVerticalDragUpdate: (DragUpdateDetails details) { dragDistance += details.primaryDelta; },
diff --git a/packages/flutter/test/widgets/heroes_test.dart b/packages/flutter/test/widgets/heroes_test.dart
index b334951..248bc48 100644
--- a/packages/flutter/test/widgets/heroes_test.dart
+++ b/packages/flutter/test/widgets/heroes_test.dart
@@ -258,12 +258,12 @@
// Expect the height of the secondKey Hero to vary from 100 to 150
// over duration and according to curve.
- final Duration duration = const Duration(milliseconds: 300);
+ const Duration duration = const Duration(milliseconds: 300);
final Curve curve = Curves.fastOutSlowIn;
final double initialHeight = tester.getSize(find.byKey(firstKey, skipOffstage: false)).height;
final double finalHeight = tester.getSize(find.byKey(secondKey, skipOffstage: false)).height;
final double deltaHeight = finalHeight - initialHeight;
- final double epsilon = 0.001;
+ const double epsilon = 0.001;
await tester.pump(duration * 0.25);
expect(
@@ -505,7 +505,7 @@
// Hero a's return flight at 149ms. The outgoing (push) flight took
// 150ms so we should be just about back to where Hero 'a' started.
- final double epsilon = 0.001;
+ const double epsilon = 0.001;
await tester.pump(const Duration(milliseconds: 99));
closeTo(tester.getSize(find.byKey(secondKey)).height - initialHeight, epsilon);
@@ -575,7 +575,7 @@
// Hero a's return flight at 149ms. The outgoing (push) flight took
// 150ms so we should be just about back to where Hero 'a' started.
- final double epsilon = 0.001;
+ const double epsilon = 0.001;
await tester.pump(const Duration(milliseconds: 99));
closeTo(tester.getSize(find.byKey(firstKey)).height - initialHeight, epsilon);
@@ -587,8 +587,8 @@
});
testWidgets('Destination hero disappears mid-flight', (WidgetTester tester) async {
- final Key homeHeroKey = const Key('home hero');
- final Key routeHeroKey = const Key('route hero');
+ const Key homeHeroKey = const Key('home hero');
+ const Key routeHeroKey = const Key('route hero');
bool routeIncludesHero = true;
StateSetter heroCardSetState;
@@ -690,9 +690,9 @@
});
testWidgets('Destination hero scrolls mid-flight', (WidgetTester tester) async {
- final Key homeHeroKey = const Key('home hero');
- final Key routeHeroKey = const Key('route hero');
- final Key routeContainerKey = const Key('route hero container');
+ const Key homeHeroKey = const Key('home hero');
+ const Key routeHeroKey = const Key('route hero');
+ const Key routeContainerKey = const Key('route hero container');
// Show a 200x200 Hero tagged 'H', with key routeHeroKey
final MaterialPageRoute<Null> route = new MaterialPageRoute<Null>(
@@ -772,9 +772,9 @@
});
testWidgets('Destination hero scrolls out of view mid-flight', (WidgetTester tester) async {
- final Key homeHeroKey = const Key('home hero');
- final Key routeHeroKey = const Key('route hero');
- final Key routeContainerKey = const Key('route hero container');
+ const Key homeHeroKey = const Key('home hero');
+ const Key routeHeroKey = const Key('route hero');
+ const Key routeContainerKey = const Key('route hero container');
// Show a 200x200 Hero tagged 'H', with key routeHeroKey
final MaterialPageRoute<Null> route = new MaterialPageRoute<Null>(
@@ -851,8 +851,8 @@
testWidgets('Aborted flight', (WidgetTester tester) async {
// See https://github.com/flutter/flutter/issues/5798
- final Key heroABKey = const Key('AB hero');
- final Key heroBCKey = const Key('BC hero');
+ const Key heroABKey = const Key('AB hero');
+ const Key heroBCKey = const Key('BC hero');
// Show a 150x150 Hero tagged 'BC'
final MaterialPageRoute<Null> routeC = new MaterialPageRoute<Null>(
@@ -1084,8 +1084,8 @@
await tester.pumpWidget(new MaterialApp(routes: createRectTweenHeroRoutes));
expect(tester.getCenter(find.byKey(firstKey)), const Offset(50.0, 50.0));
- final double epsilon = 0.001;
- final Duration duration = const Duration(milliseconds: 300);
+ const double epsilon = 0.001;
+ const Duration duration = const Duration(milliseconds: 300);
final Curve curve = Curves.fastOutSlowIn;
final MaterialPointArcTween pushCenterTween = new MaterialPointArcTween(
begin: const Offset(50.0, 50.0),
@@ -1156,8 +1156,8 @@
await tester.tap(find.text('twoInset'));
await tester.pump(); // begin navigation from / to /twoInset.
- final double epsilon = 0.001;
- final Duration duration = const Duration(milliseconds: 300);
+ const double epsilon = 0.001;
+ const Duration duration = const Duration(milliseconds: 300);
await tester.pump();
final double x0 = tester.getTopLeft(find.byKey(secondKey)).dx;
diff --git a/packages/flutter/test/widgets/hyperlink_test.dart b/packages/flutter/test/widgets/hyperlink_test.dart
index 6f6fede..b265d31 100644
--- a/packages/flutter/test/widgets/hyperlink_test.dart
+++ b/packages/flutter/test/widgets/hyperlink_test.dart
@@ -20,7 +20,7 @@
didTapRight = true;
};
- final Key textKey = const Key('text');
+ const Key textKey = const Key('text');
await tester.pumpWidget(
new Center(
diff --git a/packages/flutter/test/widgets/icon_theme_data_test.dart b/packages/flutter/test/widgets/icon_theme_data_test.dart
index cc55803..c909224 100644
--- a/packages/flutter/test/widgets/icon_theme_data_test.dart
+++ b/packages/flutter/test/widgets/icon_theme_data_test.dart
@@ -7,7 +7,7 @@
void main() {
test('IconThemeData control test', () {
- final IconThemeData data = const IconThemeData(color: const Color(0xAAAAAAAA), opacity: 0.5, size: 16.0);
+ const IconThemeData data = const IconThemeData(color: const Color(0xAAAAAAAA), opacity: 0.5, size: 16.0);
expect(data, hasOneLineDescription);
expect(data, equals(data.copyWith()));
diff --git a/packages/flutter/test/widgets/image_package_asset_test.dart b/packages/flutter/test/widgets/image_package_asset_test.dart
index 15f2610..4383d2d 100644
--- a/packages/flutter/test/widgets/image_package_asset_test.dart
+++ b/packages/flutter/test/widgets/image_package_asset_test.dart
@@ -7,7 +7,7 @@
void main() {
test('AssetImage from package', () {
- final AssetImage image = const AssetImage(
+ const AssetImage image = const AssetImage(
'assets/image.png',
package: 'test_package',
);
@@ -15,7 +15,7 @@
});
test('ExactAssetImage from package', () {
- final ExactAssetImage image = const ExactAssetImage(
+ const ExactAssetImage image = const ExactAssetImage(
'assets/image.png',
scale: 1.5,
package: 'test_package',
diff --git a/packages/flutter/test/widgets/image_resolution_test.dart b/packages/flutter/test/widgets/image_resolution_test.dart
index dc7138d..95e7333 100644
--- a/packages/flutter/test/widgets/image_resolution_test.dart
+++ b/packages/flutter/test/widgets/image_resolution_test.dart
@@ -150,13 +150,13 @@
}
Future<Null> pumpTreeToLayout(WidgetTester tester, Widget widget) {
- final Duration pumpDuration = const Duration(milliseconds: 0);
+ const Duration pumpDuration = const Duration(milliseconds: 0);
final EnginePhase pumpPhase = EnginePhase.layout;
return tester.pumpWidget(widget, pumpDuration, pumpPhase);
}
void main() {
- final String image = 'assets/image.png';
+ const String image = 'assets/image.png';
testWidgets('Image for device pixel ratio 1.0', (WidgetTester tester) async {
const double ratio = 1.0;
diff --git a/packages/flutter/test/widgets/list_view_misc_test.dart b/packages/flutter/test/widgets/list_view_misc_test.dart
index 85b15f8..c3898d6 100644
--- a/packages/flutter/test/widgets/list_view_misc_test.dart
+++ b/packages/flutter/test/widgets/list_view_misc_test.dart
@@ -100,7 +100,7 @@
await tester.pumpWidget(buildBlock(reverse: true));
- final Offset target = const Offset(200.0, 200.0);
+ const Offset target = const Offset(200.0, 200.0);
await tester.tapAt(target);
expect(first, equals(0));
expect(second, equals(1));
diff --git a/packages/flutter/test/widgets/navigator_test.dart b/packages/flutter/test/widgets/navigator_test.dart
index ed8ac80..5f81f50 100644
--- a/packages/flutter/test/widgets/navigator_test.dart
+++ b/packages/flutter/test/widgets/navigator_test.dart
@@ -165,7 +165,7 @@
});
testWidgets('Navigator.of fails gracefully when not found in context', (WidgetTester tester) async {
- final Key targetKey = const Key('foo');
+ const Key targetKey = const Key('foo');
dynamic exception;
final Widget widget = new ThirdWidget(
targetKey: targetKey,
diff --git a/packages/flutter/test/widgets/page_forward_transitions_test.dart b/packages/flutter/test/widgets/page_forward_transitions_test.dart
index b65a794..fbd796e 100644
--- a/packages/flutter/test/widgets/page_forward_transitions_test.dart
+++ b/packages/flutter/test/widgets/page_forward_transitions_test.dart
@@ -50,8 +50,8 @@
}
void main() {
- final Duration kTwoTenthsOfTheTransitionDuration = const Duration(milliseconds: 30);
- final Duration kFourTenthsOfTheTransitionDuration = const Duration(milliseconds: 60);
+ const Duration kTwoTenthsOfTheTransitionDuration = const Duration(milliseconds: 30);
+ const Duration kFourTenthsOfTheTransitionDuration = const Duration(milliseconds: 60);
testWidgets('Check onstage/offstage handling around transitions', (WidgetTester tester) async {
diff --git a/packages/flutter/test/widgets/page_storage_test.dart b/packages/flutter/test/widgets/page_storage_test.dart
index fbe0d08..e6feb1f 100644
--- a/packages/flutter/test/widgets/page_storage_test.dart
+++ b/packages/flutter/test/widgets/page_storage_test.dart
@@ -7,7 +7,7 @@
void main() {
testWidgets('PageStorage read and write', (WidgetTester tester) async {
- final Key builderKey = const PageStorageKey<String>('builderKey');
+ const Key builderKey = const PageStorageKey<String>('builderKey');
StateSetter setState;
int storedValue = 0;
diff --git a/packages/flutter/test/widgets/parent_data_test.dart b/packages/flutter/test/widgets/parent_data_test.dart
index c5cec27..418675e 100644
--- a/packages/flutter/test/widgets/parent_data_test.dart
+++ b/packages/flutter/test/widgets/parent_data_test.dart
@@ -96,20 +96,20 @@
kNonPositioned,
]);
- final DecoratedBox kDecoratedBoxA = const DecoratedBox(decoration: kBoxDecorationA);
- final DecoratedBox kDecoratedBoxB = const DecoratedBox(decoration: kBoxDecorationB);
- final DecoratedBox kDecoratedBoxC = const DecoratedBox(decoration: kBoxDecorationC);
+ const DecoratedBox kDecoratedBoxA = const DecoratedBox(decoration: kBoxDecorationA);
+ const DecoratedBox kDecoratedBoxB = const DecoratedBox(decoration: kBoxDecorationB);
+ const DecoratedBox kDecoratedBoxC = const DecoratedBox(decoration: kBoxDecorationC);
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
- children: <Widget>[
- new Positioned(
+ children: const <Widget>[
+ const Positioned(
bottom: 5.0,
right: 7.0,
child: kDecoratedBoxA,
),
- new Positioned(
+ const Positioned(
top: 10.0,
left: 10.0,
child: kDecoratedBoxB,
@@ -128,13 +128,13 @@
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
- children: <Widget>[
- new Positioned(
+ children: const <Widget>[
+ const Positioned(
bottom: 6.0,
right: 8.0,
child: kDecoratedBoxA,
),
- new Positioned(
+ const Positioned(
left: 10.0,
right: 10.0,
child: kDecoratedBoxB,
@@ -181,7 +181,7 @@
child: new Container(child: kDecoratedBoxB),
),
new Container(
- child: new Positioned(
+ child: const Positioned(
top: 8.0,
child: kDecoratedBoxC,
),
@@ -199,10 +199,10 @@
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
- children: <Widget>[
- new Positioned(
+ children: const <Widget>[
+ const Positioned(
right: 10.0,
- child: new FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
+ child: const FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
),
],
),
@@ -222,10 +222,10 @@
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
- children: <Widget>[
- new Positioned(
+ children: const <Widget>[
+ const Positioned(
top: 7.0,
- child: new FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
+ child: const FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
),
],
),
diff --git a/packages/flutter/test/widgets/reparent_state_test.dart b/packages/flutter/test/widgets/reparent_state_test.dart
index 48eb99c..ef352d6 100644
--- a/packages/flutter/test/widgets/reparent_state_test.dart
+++ b/packages/flutter/test/widgets/reparent_state_test.dart
@@ -53,7 +53,7 @@
final GlobalKey left = new GlobalKey();
final GlobalKey right = new GlobalKey();
- final StateMarker grandchild = const StateMarker();
+ const StateMarker grandchild = const StateMarker();
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
@@ -80,7 +80,7 @@
expect(grandchildState, isNotNull);
grandchildState.marker = 'grandchild';
- final StateMarker newGrandchild = const StateMarker();
+ const StateMarker newGrandchild = const StateMarker();
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
@@ -128,7 +128,7 @@
final GlobalKey left = new GlobalKey();
final GlobalKey right = new GlobalKey();
- final StateMarker grandchild = const StateMarker();
+ const StateMarker grandchild = const StateMarker();
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
@@ -151,7 +151,7 @@
expect(grandchildState, isNotNull);
grandchildState.marker = 'grandchild';
- final StateMarker newGrandchild = const StateMarker();
+ const StateMarker newGrandchild = const StateMarker();
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
diff --git a/packages/flutter/test/widgets/routes_test.dart b/packages/flutter/test/widgets/routes_test.dart
index 38e501d..9de6b12 100644
--- a/packages/flutter/test/widgets/routes_test.dart
+++ b/packages/flutter/test/widgets/routes_test.dart
@@ -98,7 +98,7 @@
void main() {
testWidgets('Route settings', (WidgetTester tester) async {
- final RouteSettings settings = const RouteSettings(name: 'A');
+ const RouteSettings settings = const RouteSettings(name: 'A');
expect(settings, hasOneLineDescription);
final RouteSettings settings2 = settings.copyWith(name: 'B');
expect(settings2.name, 'B');
diff --git a/packages/flutter/test/widgets/row_test.dart b/packages/flutter/test/widgets/row_test.dart
index 1220e5d..ae3a1a7 100644
--- a/packages/flutter/test/widgets/row_test.dart
+++ b/packages/flutter/test/widgets/row_test.dart
@@ -30,10 +30,10 @@
testWidgets('Row with one Flexible child - no textDirection', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
final FlutterExceptionHandler oldHandler = FlutterError.onError;
dynamic exception;
@@ -61,10 +61,10 @@
testWidgets('Row with default main axis parameters - no textDirection', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
final FlutterExceptionHandler oldHandler = FlutterError.onError;
dynamic exception;
@@ -92,9 +92,9 @@
testWidgets('Row with MainAxisAlignment.center - no textDirection', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
final FlutterExceptionHandler oldHandler = FlutterError.onError;
dynamic exception;
@@ -122,10 +122,10 @@
testWidgets('Row with MainAxisAlignment.end - no textDirection', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
final FlutterExceptionHandler oldHandler = FlutterError.onError;
dynamic exception;
@@ -154,10 +154,10 @@
testWidgets('Row with MainAxisAlignment.spaceBetween - no textDirection', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
final FlutterExceptionHandler oldHandler = FlutterError.onError;
dynamic exception;
@@ -186,11 +186,11 @@
testWidgets('Row with MainAxisAlignment.spaceAround - no textDirection', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
- final Key child3Key = const Key('child3');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
+ const Key child3Key = const Key('child3');
final FlutterExceptionHandler oldHandler = FlutterError.onError;
dynamic exception;
@@ -220,10 +220,10 @@
testWidgets('Row with MainAxisAlignment.spaceEvenly - no textDirection', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
final FlutterExceptionHandler oldHandler = FlutterError.onError;
dynamic exception;
@@ -252,9 +252,9 @@
testWidgets('Row and MainAxisSize.min - no textDirection', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('rowKey');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key rowKey = const Key('rowKey');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
final FlutterExceptionHandler oldHandler = FlutterError.onError;
dynamic exception;
@@ -282,7 +282,7 @@
testWidgets('Row MainAxisSize.min layout at zero size - no textDirection', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key childKey = const Key('childKey');
+ const Key childKey = const Key('childKey');
await tester.pumpWidget(new Center(
child: new Container(
@@ -312,10 +312,10 @@
testWidgets('Row with one Flexible child - LTR', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// Default is MainAxisAlignment.start so children so the children's
@@ -362,10 +362,10 @@
testWidgets('Row with default main axis parameters - LTR', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// Default is MainAxisAlignment.start so children so the children's
@@ -412,9 +412,9 @@
testWidgets('Row with MainAxisAlignment.center - LTR', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's left edges should be at 300, 400
@@ -454,10 +454,10 @@
testWidgets('Row with MainAxisAlignment.end - LTR', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's left edges should be at 500, 600, 700.
@@ -504,10 +504,10 @@
testWidgets('Row with MainAxisAlignment.spaceBetween - LTR', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's left edges should be at 0, 350, 700
@@ -554,11 +554,11 @@
testWidgets('Row with MainAxisAlignment.spaceAround - LTR', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
- final Key child3Key = const Key('child3');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
+ const Key child3Key = const Key('child3');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's left edges should be at 50, 250, 450, 650
@@ -612,10 +612,10 @@
testWidgets('Row with MainAxisAlignment.spaceEvenly - LTR', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 200x100 children's left edges should be at 50, 300, 550
@@ -662,9 +662,9 @@
testWidgets('Row and MainAxisSize.min - LTR', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('rowKey');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key rowKey = const Key('rowKey');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
// Row with MainAxisSize.min without flexible children shrink wraps.
// Row's width should be 250, children should be at 0, 100.
@@ -704,7 +704,7 @@
testWidgets('Row MainAxisSize.min layout at zero size - LTR', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key childKey = const Key('childKey');
+ const Key childKey = const Key('childKey');
await tester.pumpWidget(new Center(
child: new Container(
@@ -735,10 +735,10 @@
testWidgets('Row with one Flexible child - RTL', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// Default is MainAxisAlignment.start so children so the children's
@@ -785,10 +785,10 @@
testWidgets('Row with default main axis parameters - RTL', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// Default is MainAxisAlignment.start so children so the children's
@@ -835,9 +835,9 @@
testWidgets('Row with MainAxisAlignment.center - RTL', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's right edges should be at 300, 400 from the right
@@ -877,10 +877,10 @@
testWidgets('Row with MainAxisAlignment.end - RTL', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's right edges should be at 500, 600, 700 from the right.
@@ -927,10 +927,10 @@
testWidgets('Row with MainAxisAlignment.spaceBetween - RTL', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's right edges should be at 0, 350, 700 from the right
@@ -977,11 +977,11 @@
testWidgets('Row with MainAxisAlignment.spaceAround - RTL', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
- final Key child3Key = const Key('child3');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
+ const Key child3Key = const Key('child3');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's right edges should be at 50, 250, 450, 650 from the right
@@ -1035,10 +1035,10 @@
testWidgets('Row with MainAxisAlignment.spaceEvenly - RTL', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('row');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
- final Key child2Key = const Key('child2');
+ const Key rowKey = const Key('row');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
+ const Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 200x100 children's right edges should be at 50, 300, 550 from the right
@@ -1085,9 +1085,9 @@
testWidgets('Row and MainAxisSize.min - RTL', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key rowKey = const Key('rowKey');
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key rowKey = const Key('rowKey');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
// Row with MainAxisSize.min without flexible children shrink wraps.
// Row's width should be 250, children should be at 0, 100 from right.
@@ -1127,7 +1127,7 @@
testWidgets('Row MainAxisSize.min layout at zero size - RTL', (WidgetTester tester) async {
OrderPainter.log.clear();
- final Key childKey = const Key('childKey');
+ const Key childKey = const Key('childKey');
await tester.pumpWidget(new Center(
child: new Container(
diff --git a/packages/flutter/test/widgets/rtl_test.dart b/packages/flutter/test/widgets/rtl_test.dart
index f129ba9..e164e55 100644
--- a/packages/flutter/test/widgets/rtl_test.dart
+++ b/packages/flutter/test/widgets/rtl_test.dart
@@ -7,16 +7,16 @@
void main() {
testWidgets('Padding RTL', (WidgetTester tester) async {
- final Widget child = const Padding(
+ const Widget child = const Padding(
padding: const EdgeInsetsDirectional.only(start: 10.0),
child: const Placeholder(),
);
- await tester.pumpWidget(new Directionality(
+ await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr,
child: child,
));
expect(tester.getTopLeft(find.byType(Placeholder)), const Offset(10.0, 0.0));
- await tester.pumpWidget(new Directionality(
+ await tester.pumpWidget(const Directionality(
textDirection: TextDirection.rtl,
child: child,
));
diff --git a/packages/flutter/test/widgets/safe_area_test.dart b/packages/flutter/test/widgets/safe_area_test.dart
index 3eb7d3b..1703535 100644
--- a/packages/flutter/test/widgets/safe_area_test.dart
+++ b/packages/flutter/test/widgets/safe_area_test.dart
@@ -39,7 +39,7 @@
});
testWidgets('SafeArea - changing', (WidgetTester tester) async {
- final Widget child = const SafeArea(
+ const Widget child = const SafeArea(
bottom: false,
child: const SafeArea(
left: false,
@@ -48,7 +48,7 @@
),
);
await tester.pumpWidget(
- new MediaQuery(
+ const MediaQuery(
data: const MediaQueryData(padding: const EdgeInsets.all(20.0)),
child: child,
),
@@ -56,7 +56,7 @@
expect(tester.getTopLeft(find.byType(Placeholder)), const Offset(20.0, 20.0));
expect(tester.getBottomRight(find.byType(Placeholder)), const Offset(780.0, 600.0));
await tester.pumpWidget(
- new MediaQuery(
+ const MediaQuery(
data: const MediaQueryData(padding: const EdgeInsets.only(
left: 100.0,
top: 30.0,
diff --git a/packages/flutter/test/widgets/scrollable_grid_test.dart b/packages/flutter/test/widgets/scrollable_grid_test.dart
index b5beb7b..66eb536 100644
--- a/packages/flutter/test/widgets/scrollable_grid_test.dart
+++ b/packages/flutter/test/widgets/scrollable_grid_test.dart
@@ -22,7 +22,7 @@
// Tests https://github.com/flutter/flutter/issues/5522
testWidgets('GridView displays correct children with nonzero padding', (WidgetTester tester) async {
- final EdgeInsets padding = const EdgeInsets.fromLTRB(0.0, 100.0, 0.0, 0.0);
+ const EdgeInsets padding = const EdgeInsets.fromLTRB(0.0, 100.0, 0.0, 0.0);
final Widget testWidget = new Directionality(
textDirection: TextDirection.ltr,
diff --git a/packages/flutter/test/widgets/sized_box_test.dart b/packages/flutter/test/widgets/sized_box_test.dart
index 9bd7459..b9a50e2 100644
--- a/packages/flutter/test/widgets/sized_box_test.dart
+++ b/packages/flutter/test/widgets/sized_box_test.dart
@@ -7,15 +7,15 @@
void main() {
testWidgets('SizedBox constructors', (WidgetTester tester) async {
- final SizedBox a = const SizedBox();
+ const SizedBox a = const SizedBox();
expect(a.width, isNull);
expect(a.height, isNull);
- final SizedBox b = const SizedBox(width: 10.0);
+ const SizedBox b = const SizedBox(width: 10.0);
expect(b.width, 10.0);
expect(b.height, isNull);
- final SizedBox c = const SizedBox(width: 10.0, height: 20.0);
+ const SizedBox c = const SizedBox(width: 10.0, height: 20.0);
expect(c.width, 10.0);
expect(c.height, 20.0);
@@ -27,7 +27,7 @@
expect(e.width, 1.0);
expect(e.height, 2.0);
- final SizedBox f = const SizedBox.expand();
+ const SizedBox f = const SizedBox.expand();
expect(f.width, double.INFINITY);
expect(f.height, double.INFINITY);
});
diff --git a/packages/flutter/test/widgets/slivers_padding_test.dart b/packages/flutter/test/widgets/slivers_padding_test.dart
index cf27fa3..08c640b 100644
--- a/packages/flutter/test/widgets/slivers_padding_test.dart
+++ b/packages/flutter/test/widgets/slivers_padding_test.dart
@@ -39,7 +39,7 @@
void main() {
testWidgets('Viewport+SliverPadding basic test (VISUAL)', (WidgetTester tester) async {
- final EdgeInsets padding = const EdgeInsets.fromLTRB(25.0, 20.0, 15.0, 35.0);
+ const EdgeInsets padding = const EdgeInsets.fromLTRB(25.0, 20.0, 15.0, 35.0);
await test(tester, 0.0, padding, AxisDirection.down, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
@@ -78,7 +78,7 @@
});
testWidgets('Viewport+SliverPadding basic test (LTR)', (WidgetTester tester) async {
- final EdgeInsetsDirectional padding = const EdgeInsetsDirectional.fromSTEB(25.0, 20.0, 15.0, 35.0);
+ const EdgeInsetsDirectional padding = const EdgeInsetsDirectional.fromSTEB(25.0, 20.0, 15.0, 35.0);
await test(tester, 0.0, padding, AxisDirection.down, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
@@ -117,7 +117,7 @@
});
testWidgets('Viewport+SliverPadding basic test (RTL)', (WidgetTester tester) async {
- final EdgeInsetsDirectional padding = const EdgeInsetsDirectional.fromSTEB(25.0, 20.0, 15.0, 35.0);
+ const EdgeInsetsDirectional padding = const EdgeInsetsDirectional.fromSTEB(25.0, 20.0, 15.0, 35.0);
await test(tester, 0.0, padding, AxisDirection.down, TextDirection.rtl);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
@@ -156,7 +156,7 @@
});
testWidgets('Viewport+SliverPadding hit testing', (WidgetTester tester) async {
- final EdgeInsets padding = const EdgeInsets.all(30.0);
+ const EdgeInsets padding = const EdgeInsets.all(30.0);
await test(tester, 350.0, padding, AxisDirection.down, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
@@ -178,7 +178,7 @@
});
testWidgets('Viewport+SliverPadding hit testing up', (WidgetTester tester) async {
- final EdgeInsets padding = const EdgeInsets.all(30.0);
+ const EdgeInsets padding = const EdgeInsets.all(30.0);
await test(tester, 350.0, padding, AxisDirection.up, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
@@ -200,7 +200,7 @@
});
testWidgets('Viewport+SliverPadding hit testing left', (WidgetTester tester) async {
- final EdgeInsets padding = const EdgeInsets.all(30.0);
+ const EdgeInsets padding = const EdgeInsets.all(30.0);
await test(tester, 350.0, padding, AxisDirection.left, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
@@ -222,7 +222,7 @@
});
testWidgets('Viewport+SliverPadding hit testing right', (WidgetTester tester) async {
- final EdgeInsets padding = const EdgeInsets.all(30.0);
+ const EdgeInsets padding = const EdgeInsets.all(30.0);
await test(tester, 350.0, padding, AxisDirection.right, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
diff --git a/packages/flutter/test/widgets/stack_test.dart b/packages/flutter/test/widgets/stack_test.dart
index fac7a88..2ebec85 100644
--- a/packages/flutter/test/widgets/stack_test.dart
+++ b/packages/flutter/test/widgets/stack_test.dart
@@ -37,7 +37,7 @@
});
testWidgets('Can change position data', (WidgetTester tester) async {
- final Key key = const Key('container');
+ const Key key = const Key('container');
await tester.pumpWidget(
new Stack(
@@ -94,7 +94,7 @@
});
testWidgets('Can remove parent data', (WidgetTester tester) async {
- final Key key = const Key('container');
+ const Key key = const Key('container');
final Container container = new Container(key: key, width: 10.0, height: 10.0);
await tester.pumpWidget(
@@ -132,8 +132,8 @@
});
testWidgets('Can align non-positioned children (LTR)', (WidgetTester tester) async {
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
await tester.pumpWidget(
new Directionality(
@@ -178,8 +178,8 @@
});
testWidgets('Can align non-positioned children (RTL)', (WidgetTester tester) async {
- final Key child0Key = const Key('child0');
- final Key child1Key = const Key('child1');
+ const Key child0Key = const Key('child0');
+ const Key child1Key = const Key('child1');
await tester.pumpWidget(
new Directionality(
@@ -242,7 +242,7 @@
});
testWidgets('Can construct an IndexedStack', (WidgetTester tester) async {
- final int itemCount = 3;
+ const int itemCount = 3;
List<int> itemsPainted;
Widget buildFrame(int index) {
@@ -278,8 +278,8 @@
});
testWidgets('Can hit test an IndexedStack', (WidgetTester tester) async {
- final Key key = const Key('indexedStack');
- final int itemCount = 3;
+ const Key key = const Key('indexedStack');
+ const int itemCount = 3;
List<int> itemsTapped;
Widget buildFrame(int index) {
@@ -309,21 +309,21 @@
});
testWidgets('Can set width and height', (WidgetTester tester) async {
- final Key key = const Key('container');
+ const Key key = const Key('container');
- final BoxDecoration kBoxDecoration = const BoxDecoration(
+ const BoxDecoration kBoxDecoration = const BoxDecoration(
color: const Color(0xFF00FF00),
);
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
- children: <Widget>[
- new Positioned(
+ children: const <Widget>[
+ const Positioned(
left: 10.0,
width: 11.0,
height: 12.0,
- child: new DecoratedBox(key: key, decoration: kBoxDecoration),
+ child: const DecoratedBox(key: key, decoration: kBoxDecoration),
),
],
),
@@ -350,12 +350,12 @@
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
- children: <Widget>[
- new Positioned(
+ children: const <Widget>[
+ const Positioned(
right: 10.0,
width: 11.0,
height: 12.0,
- child: new DecoratedBox(key: key, decoration: kBoxDecoration),
+ child: const DecoratedBox(key: key, decoration: kBoxDecoration),
),
],
),
diff --git a/packages/flutter/test/widgets/stateful_components_test.dart b/packages/flutter/test/widgets/stateful_components_test.dart
index b2bae20..d9f61c2 100644
--- a/packages/flutter/test/widgets/stateful_components_test.dart
+++ b/packages/flutter/test/widgets/stateful_components_test.dart
@@ -45,12 +45,12 @@
void main() {
testWidgets('resync stateful widget', (WidgetTester tester) async {
- final Key innerKey = const Key('inner');
- final Key outerKey = const Key('outer');
+ const Key innerKey = const Key('inner');
+ const Key outerKey = const Key('outer');
- final InnerWidget inner1 = new InnerWidget(key: innerKey);
+ const InnerWidget inner1 = const InnerWidget(key: innerKey);
InnerWidget inner2;
- final OuterContainer outer1 = new OuterContainer(key: outerKey, child: inner1);
+ const OuterContainer outer1 = const OuterContainer(key: outerKey, child: inner1);
OuterContainer outer2;
await tester.pumpWidget(outer1);
@@ -61,7 +61,7 @@
expect(innerElementState._didInitState, isTrue);
expect(innerElement.renderObject.attached, isTrue);
- inner2 = new InnerWidget(key: innerKey);
+ inner2 = const InnerWidget(key: innerKey);
outer2 = new OuterContainer(key: outerKey, child: inner2);
await tester.pumpWidget(outer2);
diff --git a/packages/flutter/test/widgets/syncing_test.dart b/packages/flutter/test/widgets/syncing_test.dart
index 033cc7c..0f62f57 100644
--- a/packages/flutter/test/widgets/syncing_test.dart
+++ b/packages/flutter/test/widgets/syncing_test.dart
@@ -112,8 +112,8 @@
});
testWidgets('swap instances around', (WidgetTester tester) async {
- final Widget a = const TestWidget(persistentState: 0x61, syncedState: 0x41, child: const Text('apple', textDirection: TextDirection.ltr));
- final Widget b = const TestWidget(persistentState: 0x62, syncedState: 0x42, child: const Text('banana', textDirection: TextDirection.ltr));
+ const Widget a = const TestWidget(persistentState: 0x61, syncedState: 0x41, child: const Text('apple', textDirection: TextDirection.ltr));
+ const Widget b = const TestWidget(persistentState: 0x62, syncedState: 0x42, child: const Text('banana', textDirection: TextDirection.ltr));
await tester.pumpWidget(new Column());
final GlobalKey keyA = new GlobalKey();
diff --git a/packages/flutter/test/widgets/ticker_provider_test.dart b/packages/flutter/test/widgets/ticker_provider_test.dart
index 67991c5..1467521 100644
--- a/packages/flutter/test/widgets/ticker_provider_test.dart
+++ b/packages/flutter/test/widgets/ticker_provider_test.dart
@@ -7,7 +7,7 @@
void main() {
testWidgets('TickerMode', (WidgetTester tester) async {
- final Widget widget = const TickerMode(
+ const Widget widget = const TickerMode(
enabled: false,
child: const CircularProgressIndicator()
);
diff --git a/packages/flutter/test/widgets/tracking_scroll_controller_test.dart b/packages/flutter/test/widgets/tracking_scroll_controller_test.dart
index 3ff890b..451e0fa 100644
--- a/packages/flutter/test/widgets/tracking_scroll_controller_test.dart
+++ b/packages/flutter/test/widgets/tracking_scroll_controller_test.dart
@@ -9,7 +9,7 @@
testWidgets('TrackingScrollController saves offset',
(WidgetTester tester) async {
final TrackingScrollController controller = new TrackingScrollController();
- final double listItemHeight = 100.0;
+ const double listItemHeight = 100.0;
await tester.pumpWidget(
new Directionality(
diff --git a/packages/flutter/test/widgets/transitions_test.dart b/packages/flutter/test/widgets/transitions_test.dart
index 413b5b5..09138ae 100644
--- a/packages/flutter/test/widgets/transitions_test.dart
+++ b/packages/flutter/test/widgets/transitions_test.dart
@@ -8,7 +8,7 @@
void main() {
testWidgets('toString control test', (WidgetTester tester) async {
- final Widget widget = const FadeTransition(
+ const Widget widget = const FadeTransition(
opacity: kAlwaysCompleteAnimation,
child: const Text('Ready', textDirection: TextDirection.ltr),
);
diff --git a/packages/flutter/test/widgets/widget_inspector_test.dart b/packages/flutter/test/widgets/widget_inspector_test.dart
index 00c31e2..26e0d20 100644
--- a/packages/flutter/test/widgets/widget_inspector_test.dart
+++ b/packages/flutter/test/widgets/widget_inspector_test.dart
@@ -269,9 +269,9 @@
final WidgetInspectorService service = WidgetInspectorService.instance;
service.disposeAllGroups();
final Object a = new Object();
- final String group1 = 'group-1';
- final String group2 = 'group-2';
- final String group3 = 'group-3';
+ const String group1 = 'group-1';
+ const String group2 = 'group-2';
+ const String group3 = 'group-3';
final String aId = service.toId(a, group1);
expect(service.toId(a, group2), equals(aId));
expect(service.toId(a, group3), equals(aId));
@@ -287,8 +287,8 @@
service.disposeAllGroups();
final Object a = new Object();
final Object b = new Object();
- final String group1 = 'group-1';
- final String group2 = 'group-2';
+ const String group1 = 'group-1';
+ const String group2 = 'group-2';
final String aId = service.toId(a, group1);
final String bId = service.toId(b, group1);
expect(service.toId(a, group2), equals(aId));
@@ -301,8 +301,8 @@
});
test('WidgetInspectorService toObjectForSourceLocation', () {
- final String group = 'test-group';
- final Text widget = const Text('a', textDirection: TextDirection.ltr);
+ const String group = 'test-group';
+ const Text widget = const Text('a', textDirection: TextDirection.ltr);
final WidgetInspectorService service = WidgetInspectorService.instance;
service.disposeAllGroups();
final String id = service.toId(widget, group);
@@ -316,14 +316,14 @@
});
test('WidgetInspectorService object id test', () {
- final Text a = const Text('a', textDirection: TextDirection.ltr);
- final Text b = const Text('b', textDirection: TextDirection.ltr);
- final Text c = const Text('c', textDirection: TextDirection.ltr);
- final Text d = const Text('d', textDirection: TextDirection.ltr);
+ const Text a = const Text('a', textDirection: TextDirection.ltr);
+ const Text b = const Text('b', textDirection: TextDirection.ltr);
+ const Text c = const Text('c', textDirection: TextDirection.ltr);
+ const Text d = const Text('d', textDirection: TextDirection.ltr);
- final String group1 = 'group-1';
- final String group2 = 'group-2';
- final String group3 = 'group-3';
+ const String group1 = 'group-1';
+ const String group2 = 'group-2';
+ const String group3 = 'group-3';
final WidgetInspectorService service = WidgetInspectorService.instance;
service.disposeAllGroups();
@@ -397,7 +397,7 @@
});
testWidgets('WidgetInspectorService getParentChain', (WidgetTester tester) async {
- final String group = 'test-group';
+ const String group = 'test-group';
await tester.pumpWidget(
new Directionality(
@@ -454,7 +454,7 @@
test('WidgetInspectorService getProperties', () {
final DiagnosticsNode diagnostic = const Text('a', textDirection: TextDirection.ltr).toDiagnosticsNode();
- final String group = 'group';
+ const String group = 'group';
final WidgetInspectorService service = WidgetInspectorService.instance;
service.disposeAllGroups();
final String id = service.toId(diagnostic, group);
@@ -470,7 +470,7 @@
});
testWidgets('WidgetInspectorService getChildren', (WidgetTester tester) async {
- final String group = 'test-group';
+ const String group = 'test-group';
await tester.pumpWidget(
new Directionality(
diff --git a/packages/flutter_localizations/test/widgets_test.dart b/packages/flutter_localizations/test/widgets_test.dart
index aa57d2d..53e2e17 100644
--- a/packages/flutter_localizations/test/widgets_test.dart
+++ b/packages/flutter_localizations/test/widgets_test.dart
@@ -202,7 +202,7 @@
});
testWidgets('Localizations.localeFor in a WidgetsApp with an explicit locale', (WidgetTester tester) async {
- final Locale locale = const Locale('en', 'US');
+ const Locale locale = const Locale('en', 'US');
BuildContext pageContext;
await tester.pumpWidget(
diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart
index bdf6131..1b908df 100644
--- a/packages/flutter_test/lib/src/matchers.dart
+++ b/packages/flutter_test/lib/src/matchers.dart
@@ -514,8 +514,8 @@
// If a toStringDeep method doesn't properly handle nested values that
// contain line breaks it can fail to add the required prefixes to all
// lined when toStringDeep is called specifying prefixes.
- final String prefixLineOne = 'PREFIX_LINE_ONE____';
- final String prefixOtherLines = 'PREFIX_OTHER_LINES_';
+ const String prefixLineOne = 'PREFIX_LINE_ONE____';
+ const String prefixOtherLines = 'PREFIX_OTHER_LINES_';
final List<String> prefixIssues = <String>[];
String descriptionWithPrefixes =
object.toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines);
diff --git a/packages/flutter_test/test/widget_tester_test.dart b/packages/flutter_test/test/widget_tester_test.dart
index a9ef219..644466a 100644
--- a/packages/flutter_test/test/widget_tester_test.dart
+++ b/packages/flutter_test/test/widget_tester_test.dart
@@ -113,7 +113,7 @@
testWidgets('fails with a custom description in the message', (WidgetTester tester) async {
await tester.pumpWidget(const Text('foo', textDirection: TextDirection.ltr));
- final String customDescription = 'custom description';
+ const String customDescription = 'custom description';
TestFailure failure;
try {
expect(find.byElementPredicate((_) => false, description: customDescription), findsOneWidget);
@@ -130,7 +130,7 @@
testWidgets('fails with a custom description in the message', (WidgetTester tester) async {
await tester.pumpWidget(const Text('foo', textDirection: TextDirection.ltr));
- final String customDescription = 'custom description';
+ const String customDescription = 'custom description';
TestFailure failure;
try {
expect(find.byWidgetPredicate((_) => false, description: customDescription), findsOneWidget);
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index a0a19c0..9c9cac6 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -683,7 +683,7 @@
_timeOrigin = null;
runCommand(device.adbCommandForDevice(args)).then<Null>((Process process) {
_process = process;
- final Utf8Decoder decoder = const Utf8Decoder(allowMalformed: true);
+ const Utf8Decoder decoder = const Utf8Decoder(allowMalformed: true);
_process.stdout.transform(decoder).transform(const LineSplitter()).listen(_onLine);
_process.stderr.transform(decoder).transform(const LineSplitter()).listen(_onLine);
_process.exitCode.whenComplete(() {
diff --git a/packages/flutter_tools/lib/src/base/process_manager.dart b/packages/flutter_tools/lib/src/base/process_manager.dart
index 447a3ba..bb39578 100644
--- a/packages/flutter_tools/lib/src/base/process_manager.dart
+++ b/packages/flutter_tools/lib/src/base/process_manager.dart
@@ -35,7 +35,7 @@
void enableRecordingProcessManager(String location) {
final ProcessManager originalProcessManager = processManager;
final Directory dir = getRecordingSink(location, _kRecordingType);
- final ProcessManager delegate = const LocalProcessManager();
+ const ProcessManager delegate = const LocalProcessManager();
final RecordingProcessManager manager = new RecordingProcessManager(delegate, dir);
addShutdownHook(() async {
await manager.flush(finishRunningProcesses: true);
diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart
index 1661242..22874b0 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_base.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart
@@ -40,7 +40,7 @@
}
void writeBenchmark(Stopwatch stopwatch, int errorCount, int membersMissingDocumentation) {
- final String benchmarkOut = 'analysis_benchmark.json';
+ const String benchmarkOut = 'analysis_benchmark.json';
final Map<String, dynamic> data = <String, dynamic>{
'time': (stopwatch.elapsedMilliseconds / 1000.0),
'issues': errorCount,
diff --git a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
index 273aa72..cafc0a6 100644
--- a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
+++ b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
@@ -251,7 +251,7 @@
final Uri vmServiceAddr = isolate.owner.vmService.httpAddress;
final String name = isolate.name;
final String shortName = name.substring(0, name.indexOf('\$'));
- final String main = '\$main-';
+ const String main = '\$main-';
final String number = name.substring(name.indexOf(main) + main.length);
// The Observatory requires somewhat non-standard URIs that the Uri class
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index d53ebe5..5e7b3bc 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -95,7 +95,7 @@
..writeAsStringSync(coverageData, flush: true);
printTrace('wrote coverage data to $coveragePath (size=${coverageData.length})');
- final String baseCoverageData = 'coverage/lcov.base.info';
+ const String baseCoverageData = 'coverage/lcov.base.info';
if (mergeCoverageData) {
if (!platform.isLinux) {
printError(
diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart
index 685bd0e..040d12c 100644
--- a/packages/flutter_tools/lib/src/doctor.dart
+++ b/packages/flutter_tools/lib/src/doctor.dart
@@ -232,7 +232,7 @@
}
bool _genSnapshotRuns(String genSnapshotPath) {
- final int kExpectedExitCode = 255;
+ const int kExpectedExitCode = 255;
try {
return processManager.runSync(<String>[genSnapshotPath]).exitCode == kExpectedExitCode;
} catch (error) {
@@ -355,7 +355,7 @@
final Archive archive = new ZipDecoder().decodeBytes(fs.file(jarPath).readAsBytesSync());
final ArchiveFile file = archive.findFile('META-INF/plugin.xml');
final String content = UTF8.decode(file.content);
- final String versionStartTag = '<version>';
+ const String versionStartTag = '<version>';
final int start = content.indexOf(versionStartTag);
final int end = content.indexOf('</version>', start);
return content.substring(start + versionStartTag.length, end);
diff --git a/packages/flutter_tools/lib/src/ios/code_signing.dart b/packages/flutter_tools/lib/src/ios/code_signing.dart
index 2efbfdf..b891e29 100644
--- a/packages/flutter_tools/lib/src/ios/code_signing.dart
+++ b/packages/flutter_tools/lib/src/ios/code_signing.dart
@@ -107,7 +107,7 @@
if (!exitsHappy(const <String>['which', 'security']) || !exitsHappy(const <String>['which', 'openssl']))
return null;
- final List<String> findIdentityCommand =
+ const List<String> findIdentityCommand =
const <String>['security', 'find-identity', '-p', 'codesigning', '-v'];
final List<String> validCodeSigningIdentities = runCheckedSync(findIdentityCommand)
.split('\n')
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index b5b126c..eead7f3 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -528,14 +528,14 @@
if (lines.any((String line) => line.contains('path = Flutter/flutter_assets')))
return true;
- final String l1 = ' 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };';
- final String l2 = ' 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };';
- final String l3 = ' 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };';
- final String l4 = ' 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };';
- final String l5 = ' 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,';
- final String l6 = ' 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,';
- final String l7 = ' 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,';
- final String l8 = ' 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,';
+ const String l1 = ' 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };';
+ const String l2 = ' 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };';
+ const String l3 = ' 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };';
+ const String l4 = ' 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };';
+ const String l5 = ' 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,';
+ const String l6 = ' 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,';
+ const String l7 = ' 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,';
+ const String l8 = ' 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,';
printStatus("Upgrading project.pbxproj of $app' to include the "
@@ -561,10 +561,10 @@
lines.insert(lines.indexOf(l5) + 1, l6);
lines.insert(lines.indexOf(l7) + 1, l8);
- final String l9 = ' 9740EEBB1CF902C7004384FC /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; };';
- final String l10 = ' 9740EEB71CF902C7004384FC /* app.flx */ = {isa = PBXFileReference; lastKnownFileType = file; name = app.flx; path = Flutter/app.flx; sourceTree = "<group>"; };';
- final String l11 = ' 9740EEB71CF902C7004384FC /* app.flx */,';
- final String l12 = ' 9740EEBB1CF902C7004384FC /* app.flx in Resources */,';
+ const String l9 = ' 9740EEBB1CF902C7004384FC /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; };';
+ const String l10 = ' 9740EEB71CF902C7004384FC /* app.flx */ = {isa = PBXFileReference; lastKnownFileType = file; name = app.flx; path = Flutter/app.flx; sourceTree = "<group>"; };';
+ const String l11 = ' 9740EEB71CF902C7004384FC /* app.flx */,';
+ const String l12 = ' 9740EEBB1CF902C7004384FC /* app.flx in Resources */,';
if (lines.contains(l9)) {
printStatus('Removing app.flx from project.pbxproj since it has been '
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart
index 2dc3490..62788d5 100644
--- a/packages/flutter_tools/lib/src/test/flutter_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -570,7 +570,7 @@
void startTimeoutTimer(),
void reportObservatoryUri(Uri uri),
}) {
- final String observatoryString = 'Observatory listening on ';
+ const String observatoryString = 'Observatory listening on ';
for (Stream<List<int>> stream in
<Stream<List<int>>>[process.stderr, process.stdout]) {
diff --git a/packages/flutter_tools/test/android/android_device_test.dart b/packages/flutter_tools/test/android/android_device_test.dart
index b4b7474..5ee2c58 100644
--- a/packages/flutter_tools/test/android/android_device_test.dart
+++ b/packages/flutter_tools/test/android/android_device_test.dart
@@ -15,7 +15,7 @@
void main() {
group('android_device', () {
testUsingContext('stores the requested id', () {
- final String deviceId = '1234';
+ const String deviceId = '1234';
final AndroidDevice device = new AndroidDevice(deviceId);
expect(device.id, deviceId);
});
diff --git a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart
index ec1a996..8c720b5 100644
--- a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart
+++ b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart
@@ -130,7 +130,7 @@
testUsingContext('App font uses font file from package', () async {
establishFlutterRoot();
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: packages/test_package/bar
@@ -139,10 +139,10 @@
writePackagesFile('test_package:p/p/lib/');
writePubspecFile('p/p/pubspec.yaml', 'test_package');
- final String font = 'bar';
+ const String font = 'bar';
writeFontAsset('p/p/lib/', font);
- final String expectedFontManifest =
+ const String expectedFontManifest =
'[{"fonts":[{"asset":"packages/test_package/bar"}],"family":"foo"}]';
await buildAndVerifyFonts(
<String>[],
@@ -155,7 +155,7 @@
testUsingContext('App font uses local font file and package font file', () async {
establishFlutterRoot();
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: packages/test_package/bar
@@ -165,9 +165,9 @@
writePackagesFile('test_package:p/p/lib/');
writePubspecFile('p/p/pubspec.yaml', 'test_package');
- final String packageFont = 'bar';
+ const String packageFont = 'bar';
writeFontAsset('p/p/lib/', packageFont);
- final String localFont = 'a/bar';
+ const String localFont = 'a/bar';
writeFontAsset('', localFont);
final String expectedFontManifest =
@@ -186,7 +186,7 @@
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: a/bar
@@ -197,7 +197,7 @@
fontsSection: fontsSection,
);
- final String font = 'a/bar';
+ const String font = 'a/bar';
writeFontAsset('p/p/', font);
final String expectedFontManifest =
@@ -216,7 +216,7 @@
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/\ntest_package2:p2/p/lib/');
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: packages/test_package2/bar
@@ -228,7 +228,7 @@
);
writePubspecFile('p2/p/pubspec.yaml', 'test_package2');
- final String font = 'bar';
+ const String font = 'bar';
writeFontAsset('p2/p/lib/', font);
final String expectedFontManifest =
@@ -248,7 +248,7 @@
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
- final String pubspec = '''
+ const String pubspec = '''
- family: foo
fonts:
- style: italic
@@ -260,7 +260,7 @@
'test_package',
fontsSection: pubspec,
);
- final String font = 'a/bar';
+ const String font = 'a/bar';
writeFontAsset('p/p/', font);
final String expectedFontManifest =
@@ -277,7 +277,7 @@
testUsingContext('App uses local font and package font with own font file.', () async {
establishFlutterRoot();
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: a/bar
@@ -294,7 +294,7 @@
fontsSection: fontsSection,
);
- final String font = 'a/bar';
+ const String font = 'a/bar';
writeFontAsset('', font);
writeFontAsset('p/p/', font);
diff --git a/packages/flutter_tools/test/asset_bundle_package_test.dart b/packages/flutter_tools/test/asset_bundle_package_test.dart
index dc9dfe6..af1183c 100644
--- a/packages/flutter_tools/test/asset_bundle_package_test.dart
+++ b/packages/flutter_tools/test/asset_bundle_package_test.dart
@@ -125,7 +125,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml');
expect(bundle.entries.length, 2); // LICENSE, AssetManifest
- final String expectedAssetManifest = '{}';
+ const String expectedAssetManifest = '{}';
expect(
UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
expectedAssetManifest,
@@ -145,7 +145,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml');
expect(bundle.entries.length, 2); // LICENSE, AssetManifest
- final String expectedAssetManifest = '{}';
+ const String expectedAssetManifest = '{}';
expect(
UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
expectedAssetManifest,
diff --git a/packages/flutter_tools/test/asset_bundle_test.dart b/packages/flutter_tools/test/asset_bundle_test.dart
index b485fe6..64c8763 100644
--- a/packages/flutter_tools/test/asset_bundle_test.dart
+++ b/packages/flutter_tools/test/asset_bundle_test.dart
@@ -56,8 +56,8 @@
// Create a temporary directory and write a single file into it.
final Directory tempDir = fs.systemTempDirectory.createTempSync();
final String projectRoot = tempDir.path;
- final String assetPath = 'banana.txt';
- final String assetContents = 'banana';
+ const String assetPath = 'banana.txt';
+ const String assetContents = 'banana';
final File tempFile = fs.file(fs.path.join(projectRoot, assetPath));
tempFile.parent.createSync(recursive: true);
tempFile.writeAsBytesSync(UTF8.encode(assetContents));
@@ -111,7 +111,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml');
expect(bundle.entries.length, 1);
- final String expectedAssetManifest = '{}';
+ const String expectedAssetManifest = '{}';
expect(
UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
expectedAssetManifest,
diff --git a/packages/flutter_tools/test/base/file_system_test.dart b/packages/flutter_tools/test/base/file_system_test.dart
index 9ef0059..f39c325 100644
--- a/packages/flutter_tools/test/base/file_system_test.dart
+++ b/packages/flutter_tools/test/base/file_system_test.dart
@@ -34,7 +34,7 @@
/// Copies between 2 instances of file systems which is also supported by copyDirectorySync().
test('test directory copy', () async {
final MemoryFileSystem sourceMemoryFs = new MemoryFileSystem();
- final String sourcePath = '/some/origin';
+ const String sourcePath = '/some/origin';
final Directory sourceDirectory = await sourceMemoryFs.directory(sourcePath).create(recursive: true);
sourceMemoryFs.currentDirectory = sourcePath;
final File sourceFile1 = sourceMemoryFs.file('some_file.txt')..writeAsStringSync('bleh');
@@ -44,7 +44,7 @@
// Copy to another memory file system instance.
final MemoryFileSystem targetMemoryFs = new MemoryFileSystem();
- final String targetPath = '/some/non-existent/target';
+ const String targetPath = '/some/non-existent/target';
final Directory targetDirectory = targetMemoryFs.directory(targetPath);
copyDirectorySync(sourceDirectory, targetDirectory);
diff --git a/packages/flutter_tools/test/dependency_checker_test.dart b/packages/flutter_tools/test/dependency_checker_test.dart
index 224b44d..ecc76df 100644
--- a/packages/flutter_tools/test/dependency_checker_test.dart
+++ b/packages/flutter_tools/test/dependency_checker_test.dart
@@ -95,7 +95,7 @@
testUsingContext('moved flutter sdk', () async {
final Directory destinationPath = fs.systemTempDirectory.createTempSync('dependency_checker_test_');
// Copy the golden input and let the test run in an isolated temporary in-memory file system.
- final LocalFileSystem localFileSystem = const LocalFileSystem();
+ const LocalFileSystem localFileSystem = const LocalFileSystem();
final Directory sourcePath = localFileSystem.directory(localFileSystem.path.join(dataPath, 'changed_sdk_location'));
copyDirectorySync(sourcePath, destinationPath);
fs.currentDirectory = destinationPath;
diff --git a/packages/flutter_tools/test/devfs_test.dart b/packages/flutter_tools/test/devfs_test.dart
index 19eaa3e..3e802b6 100644
--- a/packages/flutter_tools/test/devfs_test.dart
+++ b/packages/flutter_tools/test/devfs_test.dart
@@ -186,7 +186,7 @@
});
testUsingContext('add new package with double slashes in URI', () async {
- final String packageName = 'doubleslashpkg';
+ const String packageName = 'doubleslashpkg';
await _createPackage(fs, packageName, 'somefile.txt', doubleSlash: true);
final Set<String> fileFilter = new Set<String>();
diff --git a/packages/flutter_tools/test/flutter_manifest_test.dart b/packages/flutter_tools/test/flutter_manifest_test.dart
index ee7e0e6..56e7a99 100644
--- a/packages/flutter_tools/test/flutter_manifest_test.dart
+++ b/packages/flutter_tools/test/flutter_manifest_test.dart
@@ -27,7 +27,7 @@
});
test('has no fonts or assets when the "flutter" section is empty', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -44,7 +44,7 @@
});
test('knows if material design is used', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -57,7 +57,7 @@
});
test('has two assets', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -75,7 +75,7 @@
});
test('has one font family with one asset', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -93,7 +93,7 @@
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font font = fonts[0];
- final String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}]}';
+ const String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}]}';
expect(font.descriptor.toString(), fontDescriptor);
expect(font.familyName, 'foo');
final List<FontAsset> assets = font.fontAssets;
@@ -105,7 +105,7 @@
});
test('has one font family with a simple asset and one with weight', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -121,12 +121,12 @@
''';
final FlutterManifest flutterManifest = await FlutterManifest.createFromString(manifest);
- final String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {weight: 400, asset: a/bar}], family: foo}]';
+ const String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {weight: 400, asset: a/bar}], family: foo}]';
expect(flutterManifest.fontsDescriptor.toString(), expectedFontsDescriptor);
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font font = fonts[0];
- final String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, asset: a/bar}]}';
+ const String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, asset: a/bar}]}';
expect(font.descriptor.toString(), fontDescriptor);
expect(font.familyName, 'foo');
final List<FontAsset> assets = font.fontAssets;
@@ -142,7 +142,7 @@
});
test('has one font family with a simple asset and one with weight and style', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -159,12 +159,12 @@
''';
final FlutterManifest flutterManifest = await FlutterManifest.createFromString(manifest);
- final String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo}]';
+ const String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo}]';
expect(flutterManifest.fontsDescriptor.toString(), expectedFontsDescriptor);
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font font = fonts[0];
- final String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
+ const String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
expect(font.descriptor.toString(), fontDescriptor);
expect(font.familyName, 'foo');
final List<FontAsset> assets = font.fontAssets;
@@ -180,7 +180,7 @@
});
test('has two font families, each with one simple asset and one with weight and style', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -210,7 +210,7 @@
expect(fonts.length, 2);
final Font fooFont = fonts[0];
- final String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
+ const String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
expect(fooFont.descriptor.toString(), barFontDescriptor);
expect(fooFont.familyName, 'foo');
final List<FontAsset> fooAassets = fooFont.fontAssets;
@@ -225,7 +225,7 @@
expect(fooFontAsset1.style, 'italic');
final Font barFont = fonts[1];
- final String fontDescriptor = '{family: bar, fonts: [{asset: a/baz}, {weight: 400, style: italic, asset: a/baz}]}';
+ const String fontDescriptor = '{family: bar, fonts: [{asset: a/baz}, {weight: 400, style: italic, asset: a/baz}]}';
expect(barFont.descriptor.toString(), fontDescriptor);
expect(barFont.familyName, 'bar');
final List<FontAsset> barAssets = barFont.fontAssets;
@@ -241,7 +241,7 @@
});
testUsingContext('has only one of two font familes when one declaration is missing the "family" option', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -270,7 +270,7 @@
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font fooFont = fonts[0];
- final String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
+ const String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
expect(fooFont.descriptor.toString(), barFontDescriptor);
expect(fooFont.familyName, 'foo');
final List<FontAsset> fooAassets = fooFont.fontAssets;
@@ -286,7 +286,7 @@
});
testUsingContext('has only one of two font familes when one declaration is missing the "fonts" option', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -310,7 +310,7 @@
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font fooFont = fonts[0];
- final String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
+ const String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
expect(fooFont.descriptor.toString(), barFontDescriptor);
expect(fooFont.familyName, 'foo');
final List<FontAsset> fooAassets = fooFont.fontAssets;
@@ -326,7 +326,7 @@
});
testUsingContext('has no font family when declaration is missing the "asset" option', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -340,7 +340,7 @@
''';
final FlutterManifest flutterManifest = await FlutterManifest.createFromString(manifest);
- final String expectedFontsDescriptor = '[{fonts: [{weight: 400}], family: foo}]';
+ const String expectedFontsDescriptor = '[{fonts: [{weight: 400}], family: foo}]';
expect(flutterManifest.fontsDescriptor.toString(), expectedFontsDescriptor);
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 0);
diff --git a/packages/flutter_tools/test/ios/mac_test.dart b/packages/flutter_tools/test/ios/mac_test.dart
index 3bdd6e2..7b59f5e 100644
--- a/packages/flutter_tools/test/ios/mac_test.dart
+++ b/packages/flutter_tools/test/ios/mac_test.dart
@@ -113,7 +113,7 @@
});
testUsingContext('xcodeSelectPath returns path when xcode-select is installed', () {
- final String xcodePath = '/Applications/Xcode8.0.app/Contents/Developer';
+ const String xcodePath = '/Applications/Xcode8.0.app/Contents/Developer';
when(mockProcessManager.runSync(<String>['/usr/bin/xcode-select', '--print-path']))
.thenReturn(new ProcessResult(1, 0, xcodePath, ''));
expect(xcode.xcodeSelectPath, xcodePath);
diff --git a/packages/flutter_tools/test/ios/xcodeproj_test.dart b/packages/flutter_tools/test/ios/xcodeproj_test.dart
index a8eeb7f..75cec8a 100644
--- a/packages/flutter_tools/test/ios/xcodeproj_test.dart
+++ b/packages/flutter_tools/test/ios/xcodeproj_test.dart
@@ -6,7 +6,7 @@
void main() {
group('Xcode project properties', () {
test('properties from default project can be parsed', () {
- final String output = '''
+ const String output = '''
Information about project "Runner":
Targets:
Runner
@@ -27,7 +27,7 @@
expect(info.buildConfigurations, <String>['Debug', 'Release']);
});
test('properties from project with custom schemes can be parsed', () {
- final String output = '''
+ const String output = '''
Information about project "Runner":
Targets:
Runner