Commit 329e52c0 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by Ian Hickson

apply upcoming rule use_collection_literals_when_possible (#8649)

parent 906103dd
...@@ -134,7 +134,7 @@ class CardBuilder extends SliverChildDelegate { ...@@ -134,7 +134,7 @@ class CardBuilder extends SliverChildDelegate {
class OverlayGeometryAppState extends State<OverlayGeometryApp> { class OverlayGeometryAppState extends State<OverlayGeometryApp> {
List<CardModel> cardModels; List<CardModel> cardModels;
Map<MarkerType, Point> markers = new Map<MarkerType, Point>(); Map<MarkerType, Point> markers = <MarkerType, Point>{};
double markersScrollOffset = 0.0; double markersScrollOffset = 0.0;
@override @override
......
...@@ -303,7 +303,7 @@ class CalcExpression { ...@@ -303,7 +303,7 @@ class CalcExpression {
assert(false); assert(false);
} }
} }
final List<ExpressionToken> outList = new List<ExpressionToken>(); final List<ExpressionToken> outList = <ExpressionToken>[];
outList.add(new ResultToken(currentTermValue)); outList.add(new ResultToken(currentTermValue));
return new CalcExpression(outList, ExpressionState.Result); return new CalcExpression(outList, ExpressionState.Result);
} }
......
...@@ -82,7 +82,7 @@ Future<Null> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou ...@@ -82,7 +82,7 @@ Future<Null> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
startEvent = event; startEvent = event;
} else if (startEvent != null && eventName == 'Frame') { } else if (startEvent != null && eventName == 'Frame') {
final String routeName = startEvent['args']['to']; final String routeName = startEvent['args']['to'];
durations[routeName] ??= new List<int>(); durations[routeName] ??= <int>[];
durations[routeName].add(event['dur']); durations[routeName].add(event['dur']);
startEvent = null; startEvent = null;
} }
......
...@@ -9,7 +9,7 @@ import 'dart:collection'; ...@@ -9,7 +9,7 @@ import 'dart:collection';
/// Consider using an [ObserverList] instead of a [List] when the number of /// Consider using an [ObserverList] instead of a [List] when the number of
/// [contains] calls dominates the number of [add] and [remove] calls. /// [contains] calls dominates the number of [add] and [remove] calls.
class ObserverList<T> extends Iterable<T> { class ObserverList<T> extends Iterable<T> {
final List<T> _list = new List<T>(); final List<T> _list = <T>[];
bool _isDirty = false; bool _isDirty = false;
HashSet<T> _set; HashSet<T> _set;
......
...@@ -49,7 +49,7 @@ class GestureArenaEntry { ...@@ -49,7 +49,7 @@ class GestureArenaEntry {
} }
class _GestureArena { class _GestureArena {
final List<GestureArenaMember> members = new List<GestureArenaMember>(); final List<GestureArenaMember> members = <GestureArenaMember>[];
bool isOpen = true; bool isOpen = true;
bool isHeld = false; bool isHeld = false;
bool hasPendingSweep = false; bool hasPendingSweep = false;
...@@ -71,7 +71,7 @@ class _GestureArena { ...@@ -71,7 +71,7 @@ class _GestureArena {
/// See [https://flutter.io/gestures/#gesture-disambiguation] for more /// See [https://flutter.io/gestures/#gesture-disambiguation] for more
/// information about the role this class plays in the gesture system. /// information about the role this class plays in the gesture system.
class GestureArenaManager { class GestureArenaManager {
final Map<int, _GestureArena> _arenas = new Map<int, _GestureArena>(); final Map<int, _GestureArena> _arenas = <int, _GestureArena>{};
/// Adds a new member (e.g., gesture recognizer) to the arena. /// Adds a new member (e.g., gesture recognizer) to the arena.
GestureArenaEntry add(int pointer, GestureArenaMember member) { GestureArenaEntry add(int pointer, GestureArenaMember member) {
......
...@@ -264,7 +264,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -264,7 +264,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
double _getPrimaryValueFromOffset(Offset value); double _getPrimaryValueFromOffset(Offset value);
bool get _hasSufficientPendingDragDeltaToAccept; bool get _hasSufficientPendingDragDeltaToAccept;
Map<int, VelocityTracker> _velocityTrackers = new Map<int, VelocityTracker>(); Map<int, VelocityTracker> _velocityTrackers = <int, VelocityTracker>{};
@override @override
void addPointer(PointerEvent event) { void addPointer(PointerEvent event) {
......
...@@ -94,7 +94,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { ...@@ -94,7 +94,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
Timer _doubleTapTimer; Timer _doubleTapTimer;
_TapTracker _firstTap; _TapTracker _firstTap;
final Map<int, _TapTracker> _trackers = new Map<int, _TapTracker>(); final Map<int, _TapTracker> _trackers = <int, _TapTracker>{};
@override @override
void addPointer(PointerEvent event) { void addPointer(PointerEvent event) {
...@@ -341,7 +341,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer { ...@@ -341,7 +341,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
/// particular location after [longTapDelay]. /// particular location after [longTapDelay].
GestureMultiTapDownCallback onLongTapDown; GestureMultiTapDownCallback onLongTapDown;
final Map<int, _TapGesture> _gestureMap = new Map<int, _TapGesture>(); final Map<int, _TapGesture> _gestureMap = <int, _TapGesture>{};
@override @override
void addPointer(PointerEvent event) { void addPointer(PointerEvent event) {
......
...@@ -13,7 +13,7 @@ typedef void PointerRoute(PointerEvent event); ...@@ -13,7 +13,7 @@ typedef void PointerRoute(PointerEvent event);
/// A routing table for [PointerEvent] events. /// A routing table for [PointerEvent] events.
class PointerRouter { class PointerRouter {
final Map<int, LinkedHashSet<PointerRoute>> _routeMap = new Map<int, LinkedHashSet<PointerRoute>>(); final Map<int, LinkedHashSet<PointerRoute>> _routeMap = <int, LinkedHashSet<PointerRoute>>{};
final LinkedHashSet<PointerRoute> _globalRoutes = new LinkedHashSet<PointerRoute>(); final LinkedHashSet<PointerRoute> _globalRoutes = new LinkedHashSet<PointerRoute>();
/// Adds a route to the routing table. /// Adds a route to the routing table.
......
...@@ -115,7 +115,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -115,7 +115,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
double _initialSpan; double _initialSpan;
double _currentSpan; double _currentSpan;
Map<int, Point> _pointerLocations; Map<int, Point> _pointerLocations;
Map<int, VelocityTracker> _velocityTrackers = new Map<int, VelocityTracker>(); Map<int, VelocityTracker> _velocityTrackers = <int, VelocityTracker>{};
double get _scaleFactor => _initialSpan > 0.0 ? _currentSpan / _initialSpan : 1.0; double get _scaleFactor => _initialSpan > 0.0 ? _currentSpan / _initialSpan : 1.0;
...@@ -127,7 +127,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -127,7 +127,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
_state = ScaleState.possible; _state = ScaleState.possible;
_initialSpan = 0.0; _initialSpan = 0.0;
_currentSpan = 0.0; _currentSpan = 0.0;
_pointerLocations = new Map<int, Point>(); _pointerLocations = <int, Point>{};
} }
} }
......
...@@ -90,7 +90,7 @@ class _CombiningGestureArenaMember extends GestureArenaMember { ...@@ -90,7 +90,7 @@ class _CombiningGestureArenaMember extends GestureArenaMember {
/// To assign a gesture recognizer to a team, see /// To assign a gesture recognizer to a team, see
/// [OneSequenceGestureRecognizer.team]. /// [OneSequenceGestureRecognizer.team].
class GestureArenaTeam { class GestureArenaTeam {
final Map<int, _CombiningGestureArenaMember> _combiners = new Map<int, _CombiningGestureArenaMember>(); final Map<int, _CombiningGestureArenaMember> _combiners = <int, _CombiningGestureArenaMember>{};
/// Adds a new member to the arena on behalf of this team. /// Adds a new member to the arena on behalf of this team.
/// ///
......
...@@ -63,10 +63,10 @@ class _LeastSquaresVelocityTrackerStrategy extends _VelocityTrackerStrategy { ...@@ -63,10 +63,10 @@ class _LeastSquaresVelocityTrackerStrategy extends _VelocityTrackerStrategy {
@override @override
_Estimate getEstimate() { _Estimate getEstimate() {
// Iterate over movement samples in reverse time order and collect samples. // Iterate over movement samples in reverse time order and collect samples.
final List<double> x = new List<double>(); final List<double> x = <double>[];
final List<double> y = new List<double>(); final List<double> y = <double>[];
final List<double> w = new List<double>(); final List<double> w = <double>[];
final List<double> time = new List<double>(); final List<double> time = <double>[];
int m = 0; int m = 0;
int index = _index; int index = _index;
......
...@@ -134,7 +134,7 @@ class AlertDialog extends StatelessWidget { ...@@ -134,7 +134,7 @@ class AlertDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<Widget> children = new List<Widget>(); final List<Widget> children = <Widget>[];
if (title != null) { if (title != null) {
children.add(new Padding( children.add(new Padding(
......
...@@ -233,7 +233,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr ...@@ -233,7 +233,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<Widget> children = new List<Widget>(); final List<Widget> children = <Widget>[];
if (_previousAnimation.status != AnimationStatus.dismissed) { if (_previousAnimation.status != AnimationStatus.dismissed) {
children.add(new ScaleTransition( children.add(new ScaleTransition(
scale: _previousAnimation, scale: _previousAnimation,
...@@ -777,7 +777,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -777,7 +777,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
} }
} }
final List<LayoutId> children = new List<LayoutId>(); final List<LayoutId> children = <LayoutId>[];
_addIfNonNull(children, config.body, _ScaffoldSlot.body); _addIfNonNull(children, config.body, _ScaffoldSlot.body);
......
...@@ -178,7 +178,7 @@ class Stepper extends StatefulWidget { ...@@ -178,7 +178,7 @@ class Stepper extends StatefulWidget {
class _StepperState extends State<Stepper> with TickerProviderStateMixin { class _StepperState extends State<Stepper> with TickerProviderStateMixin {
List<GlobalKey> _keys; List<GlobalKey> _keys;
final Map<int, StepState> _oldStates = new Map<int, StepState>(); final Map<int, StepState> _oldStates = <int, StepState>{};
@override @override
void initState() { void initState() {
......
...@@ -578,10 +578,10 @@ class BoxShadow { ...@@ -578,10 +578,10 @@ class BoxShadow {
if (a == null && b == null) if (a == null && b == null)
return null; return null;
if (a == null) if (a == null)
a = new List<BoxShadow>(); a = <BoxShadow>[];
if (b == null) if (b == null)
b = new List<BoxShadow>(); b = <BoxShadow>[];
final List<BoxShadow> result = new List<BoxShadow>(); final List<BoxShadow> result = <BoxShadow>[];
final int commonLength = math.min(a.length, b.length); final int commonLength = math.min(a.length, b.length);
for (int i = 0; i < commonLength; ++i) for (int i = 0; i < commonLength; ++i)
result.add(BoxShadow.lerp(a[i], b[i], t)); result.add(BoxShadow.lerp(a[i], b[i], t));
......
...@@ -1483,7 +1483,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1483,7 +1483,7 @@ abstract class RenderBox extends RenderObject {
double getDistanceToActualBaseline(TextBaseline baseline) { double getDistanceToActualBaseline(TextBaseline baseline) {
assert(_debugDoingBaseline); assert(_debugDoingBaseline);
if (_cachedBaselines == null) if (_cachedBaselines == null)
_cachedBaselines = new Map<TextBaseline, double>(); _cachedBaselines = <TextBaseline, double>{};
_cachedBaselines.putIfAbsent(baseline, () => computeDistanceToActualBaseline(baseline)); _cachedBaselines.putIfAbsent(baseline, () => computeDistanceToActualBaseline(baseline));
return _cachedBaselines[baseline]; return _cachedBaselines[baseline];
} }
......
...@@ -170,7 +170,7 @@ abstract class MultiChildLayoutDelegate { ...@@ -170,7 +170,7 @@ abstract class MultiChildLayoutDelegate {
}); });
try { try {
_idToChild = new Map<Object, RenderBox>(); _idToChild = <Object, RenderBox>{};
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
final MultiChildLayoutParentData childParentData = child.parentData; final MultiChildLayoutParentData childParentData = child.parentData;
......
...@@ -494,7 +494,7 @@ class RenderTable extends RenderBox { ...@@ -494,7 +494,7 @@ class RenderTable extends RenderBox {
assert(configuration != null); assert(configuration != null);
_columns = columns ?? (children != null && children.isNotEmpty ? children.first.length : 0); _columns = columns ?? (children != null && children.isNotEmpty ? children.first.length : 0);
_rows = rows ?? 0; _rows = rows ?? 0;
_children = new List<RenderBox>()..length = _columns * _rows; _children = <RenderBox>[]..length = _columns * _rows;
_columnWidths = columnWidths ?? new HashMap<int, TableColumnWidth>(); _columnWidths = columnWidths ?? new HashMap<int, TableColumnWidth>();
_defaultColumnWidth = defaultColumnWidth; _defaultColumnWidth = defaultColumnWidth;
_border = border; _border = border;
...@@ -529,7 +529,7 @@ class RenderTable extends RenderBox { ...@@ -529,7 +529,7 @@ class RenderTable extends RenderBox {
final int oldColumns = columns; final int oldColumns = columns;
final List<RenderBox> oldChildren = _children; final List<RenderBox> oldChildren = _children;
_columns = value; _columns = value;
_children = new List<RenderBox>()..length = columns * rows; _children = <RenderBox>[]..length = columns * rows;
final int columnsToCopy = math.min(columns, oldColumns); final int columnsToCopy = math.min(columns, oldColumns);
for (int y = 0; y < rows; y += 1) { for (int y = 0; y < rows; y += 1) {
for (int x = 0; x < columnsToCopy; x += 1) for (int x = 0; x < columnsToCopy; x += 1)
......
...@@ -402,7 +402,7 @@ abstract class SchedulerBinding extends BindingBase { ...@@ -402,7 +402,7 @@ abstract class SchedulerBinding extends BindingBase {
}); });
} }
final List<FrameCallback> _persistentCallbacks = new List<FrameCallback>(); final List<FrameCallback> _persistentCallbacks = <FrameCallback>[];
/// Adds a persistent frame callback. /// Adds a persistent frame callback.
/// ///
...@@ -420,7 +420,7 @@ abstract class SchedulerBinding extends BindingBase { ...@@ -420,7 +420,7 @@ abstract class SchedulerBinding extends BindingBase {
_persistentCallbacks.add(callback); _persistentCallbacks.add(callback);
} }
final List<FrameCallback> _postFrameCallbacks = new List<FrameCallback>(); final List<FrameCallback> _postFrameCallbacks = <FrameCallback>[];
/// Schedule a callback for the end of this frame. /// Schedule a callback for the end of this frame.
/// ///
...@@ -637,7 +637,7 @@ abstract class SchedulerBinding extends BindingBase { ...@@ -637,7 +637,7 @@ abstract class SchedulerBinding extends BindingBase {
Timeline.startSync('Animate'); Timeline.startSync('Animate');
assert(schedulerPhase == SchedulerPhase.transientCallbacks); assert(schedulerPhase == SchedulerPhase.transientCallbacks);
final Map<int, _FrameCallbackEntry> callbacks = _transientCallbacks; final Map<int, _FrameCallbackEntry> callbacks = _transientCallbacks;
_transientCallbacks = new Map<int, _FrameCallbackEntry>(); _transientCallbacks = <int, _FrameCallbackEntry>{};
callbacks.forEach((int id, _FrameCallbackEntry callbackEntry) { callbacks.forEach((int id, _FrameCallbackEntry callbackEntry) {
if (!_removedIds.contains(id)) if (!_removedIds.contains(id))
_invokeFrameCallback(callbackEntry.callback, timeStamp, callbackEntry.debugStack); _invokeFrameCallback(callbackEntry.callback, timeStamp, callbackEntry.debugStack);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:collection';
import 'image_stream.dart'; import 'image_stream.dart';
const int _kDefaultSize = 1000; const int _kDefaultSize = 1000;
...@@ -27,7 +25,7 @@ const int _kDefaultSize = 1000; ...@@ -27,7 +25,7 @@ const int _kDefaultSize = 1000;
/// Generally this class is not used directly. The [ImageProvider] class and its /// Generally this class is not used directly. The [ImageProvider] class and its
/// subclasses automatically handle the caching of images. /// subclasses automatically handle the caching of images.
class ImageCache { class ImageCache {
final LinkedHashMap<Object, ImageStreamCompleter> _cache = new LinkedHashMap<Object, ImageStreamCompleter>(); final Map<Object, ImageStreamCompleter> _cache = <Object, ImageStreamCompleter>{};
/// Maximum number of entries to store in the cache. /// Maximum number of entries to store in the cache.
/// ///
......
...@@ -358,7 +358,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> { ...@@ -358,7 +358,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
break; break;
case _kMap: case _kMap:
final int length = _readSize(buffer); final int length = _readSize(buffer);
result = new Map<dynamic, dynamic>(); result = <dynamic, dynamic>{};
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
result[_readValue(buffer)] = _readValue(buffer); result[_readValue(buffer)] = _readValue(buffer);
} }
...@@ -418,4 +418,3 @@ class StandardMethodCodec implements MethodCodec { ...@@ -418,4 +418,3 @@ class StandardMethodCodec implements MethodCodec {
throw new FormatException('Invalid envelope'); throw new FormatException('Invalid envelope');
} }
} }
...@@ -380,8 +380,8 @@ List<T> _mapAvatarsToData<T>(List<_DragAvatar<T>> avatars) { ...@@ -380,8 +380,8 @@ List<T> _mapAvatarsToData<T>(List<_DragAvatar<T>> avatars) {
} }
class _DragTargetState<T> extends State<DragTarget<T>> { class _DragTargetState<T> extends State<DragTarget<T>> {
final List<_DragAvatar<T>> _candidateAvatars = new List<_DragAvatar<T>>(); final List<_DragAvatar<T>> _candidateAvatars = <_DragAvatar<T>>[];
final List<_DragAvatar<dynamic>> _rejectedAvatars = new List<_DragAvatar<dynamic>>(); final List<_DragAvatar<dynamic>> _rejectedAvatars = <_DragAvatar<dynamic>>[];
bool didEnter(_DragAvatar<dynamic> avatar) { bool didEnter(_DragAvatar<dynamic> avatar) {
assert(!_candidateAvatars.contains(avatar)); assert(!_candidateAvatars.contains(avatar));
......
...@@ -167,11 +167,11 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key { ...@@ -167,11 +167,11 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
/// constructor. /// constructor.
const GlobalKey.constructor() : super._(); const GlobalKey.constructor() : super._();
static final Map<GlobalKey, Element> _registry = new Map<GlobalKey, Element>(); static final Map<GlobalKey, Element> _registry = <GlobalKey, Element>{};
static final Map<GlobalKey, Set<GlobalKeyRemoveListener>> _removeListeners = new Map<GlobalKey, Set<GlobalKeyRemoveListener>>(); static final Map<GlobalKey, Set<GlobalKeyRemoveListener>> _removeListeners = <GlobalKey, Set<GlobalKeyRemoveListener>>{};
static final Set<GlobalKey> _removedKeys = new HashSet<GlobalKey>(); static final Set<GlobalKey> _removedKeys = new HashSet<GlobalKey>();
static final Set<Element> _debugIllFatedElements = new HashSet<Element>(); static final Set<Element> _debugIllFatedElements = new HashSet<Element>();
static final Map<GlobalKey, Element> _debugReservations = new Map<GlobalKey, Element>(); static final Map<GlobalKey, Element> _debugReservations = <GlobalKey, Element>{};
void _register(Element element) { void _register(Element element) {
assert(() { assert(() {
...@@ -3421,7 +3421,7 @@ class InheritedElement extends ProxyElement { ...@@ -3421,7 +3421,7 @@ class InheritedElement extends ProxyElement {
if (incomingWidgets != null) if (incomingWidgets != null)
_inheritedWidgets = new Map<Type, InheritedElement>.from(incomingWidgets); _inheritedWidgets = new Map<Type, InheritedElement>.from(incomingWidgets);
else else
_inheritedWidgets = new Map<Type, InheritedElement>(); _inheritedWidgets = <Type, InheritedElement>{};
_inheritedWidgets[widget.runtimeType] = this; _inheritedWidgets[widget.runtimeType] = this;
} }
...@@ -3789,7 +3789,7 @@ abstract class RenderObjectElement extends BuildableElement { ...@@ -3789,7 +3789,7 @@ abstract class RenderObjectElement extends BuildableElement {
final bool haveOldChildren = oldChildrenTop <= oldChildrenBottom; final bool haveOldChildren = oldChildrenTop <= oldChildrenBottom;
Map<Key, Element> oldKeyedChildren; Map<Key, Element> oldKeyedChildren;
if (haveOldChildren) { if (haveOldChildren) {
oldKeyedChildren = new Map<Key, Element>(); oldKeyedChildren = <Key, Element>{};
while (oldChildrenTop <= oldChildrenBottom) { while (oldChildrenTop <= oldChildrenBottom) {
final Element oldChild = replaceWithNullIfForgotten(oldChildren[oldChildrenTop]); final Element oldChild = replaceWithNullIfForgotten(oldChildren[oldChildrenTop]);
assert(oldChild == null || oldChild._debugLifecycleState == _ElementLifecycle.active); assert(oldChild == null || oldChild._debugLifecycleState == _ElementLifecycle.active);
......
...@@ -697,7 +697,7 @@ class Navigator extends StatefulWidget { ...@@ -697,7 +697,7 @@ class Navigator extends StatefulWidget {
/// The state for a [Navigator] widget. /// The state for a [Navigator] widget.
class NavigatorState extends State<Navigator> with TickerProviderStateMixin { class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
final GlobalKey<OverlayState> _overlayKey = new GlobalKey<OverlayState>(); final GlobalKey<OverlayState> _overlayKey = new GlobalKey<OverlayState>();
final List<Route<dynamic>> _history = new List<Route<dynamic>>(); final List<Route<dynamic>> _history = <Route<dynamic>>[];
final Set<Route<dynamic>> _poppedRoutes = new Set<Route<dynamic>>(); final Set<Route<dynamic>> _poppedRoutes = new Set<Route<dynamic>>();
@override @override
......
...@@ -266,7 +266,7 @@ class Overlay extends StatefulWidget { ...@@ -266,7 +266,7 @@ class Overlay extends StatefulWidget {
/// Used to insert [OverlayEntry]s into the overlay using the [insert] and /// Used to insert [OverlayEntry]s into the overlay using the [insert] and
/// [insertAll] functions. /// [insertAll] functions.
class OverlayState extends State<Overlay> with TickerProviderStateMixin { class OverlayState extends State<Overlay> with TickerProviderStateMixin {
final List<OverlayEntry> _entries = new List<OverlayEntry>(); final List<OverlayEntry> _entries = <OverlayEntry>[];
@override @override
void initState() { void initState() {
......
...@@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart';
void main() { void main() {
testWidgets('Events bubble up the tree', (WidgetTester tester) async { testWidgets('Events bubble up the tree', (WidgetTester tester) async {
final List<String> log = new List<String>(); final List<String> log = <String>[];
await tester.pumpWidget( await tester.pumpWidget(
new Listener( new Listener(
......
...@@ -330,7 +330,7 @@ class DevFS { ...@@ -330,7 +330,7 @@ class DevFS {
final Set<String> assetPathsToEvict = new Set<String>(); final Set<String> assetPathsToEvict = new Set<String>();
final List<Future<Map<String, dynamic>>> _pendingOperations = final List<Future<Map<String, dynamic>>> _pendingOperations =
new List<Future<Map<String, dynamic>>>(); <Future<Map<String, dynamic>>>[];
Uri _baseUri; Uri _baseUri;
Uri get baseUri => _baseUri; Uri get baseUri => _baseUri;
...@@ -376,7 +376,7 @@ class DevFS { ...@@ -376,7 +376,7 @@ class DevFS {
// Handle deletions. // Handle deletions.
printTrace('Scanning for deleted files'); printTrace('Scanning for deleted files');
final String assetBuildDirPrefix = _asUriPath(getAssetBuildDirectory()); final String assetBuildDirPrefix = _asUriPath(getAssetBuildDirectory());
final List<Uri> toRemove = new List<Uri>(); final List<Uri> toRemove = <Uri>[];
_entries.forEach((Uri deviceUri, DevFSContent content) { _entries.forEach((Uri deviceUri, DevFSContent content) {
if (!content._exists) { if (!content._exists) {
final Future<Map<String, dynamic>> operation = final Future<Map<String, dynamic>> operation =
......
...@@ -434,7 +434,7 @@ class _IOSDeviceLogReader extends DeviceLogReader { ...@@ -434,7 +434,7 @@ class _IOSDeviceLogReader extends DeviceLogReader {
} }
class _IOSDevicePortForwarder extends DevicePortForwarder { class _IOSDevicePortForwarder extends DevicePortForwarder {
_IOSDevicePortForwarder(this.device) : _forwardedPorts = new List<ForwardedPort>(); _IOSDevicePortForwarder(this.device) : _forwardedPorts = <ForwardedPort>[];
final IOSDevice device; final IOSDevice device;
......
...@@ -61,7 +61,7 @@ class HotRunner extends ResidentRunner { ...@@ -61,7 +61,7 @@ class HotRunner extends ResidentRunner {
Uri _observatoryUri; Uri _observatoryUri;
final bool benchmarkMode; final bool benchmarkMode;
final Map<String, int> benchmarkData = new Map<String, int>(); final Map<String, int> benchmarkData = <String, int>{};
// The initial launch is from a snapshot. // The initial launch is from a snapshot.
bool _runningFromSnapshot = true; bool _runningFromSnapshot = true;
String kernelFilePath; String kernelFilePath;
...@@ -141,7 +141,7 @@ class HotRunner extends ResidentRunner { ...@@ -141,7 +141,7 @@ class HotRunner extends ResidentRunner {
return 1; return 1;
} }
final Map<String, dynamic> platformArgs = new Map<String, dynamic>(); final Map<String, dynamic> platformArgs = <String, dynamic>{};
await startEchoingDeviceLog(package); await startEchoingDeviceLog(package);
......
...@@ -24,7 +24,7 @@ const String _kCopyTemplateExtension = '.copy.tmpl'; ...@@ -24,7 +24,7 @@ const String _kCopyTemplateExtension = '.copy.tmpl';
/// extensions. /// extensions.
class Template { class Template {
Template(Directory templateSource, Directory baseDir) { Template(Directory templateSource, Directory baseDir) {
_templateFilePaths = new Map<String, String>(); _templateFilePaths = <String, String>{};
if (!templateSource.existsSync()) { if (!templateSource.existsSync()) {
return; return;
......
...@@ -505,14 +505,14 @@ class VM extends ServiceObjectOwner { ...@@ -505,14 +505,14 @@ class VM extends ServiceObjectOwner {
_removeDeadIsolates(map['isolates']); _removeDeadIsolates(map['isolates']);
} }
final Map<String, ServiceObject> _cache = new Map<String,ServiceObject>(); final Map<String, ServiceObject> _cache = <String,ServiceObject>{};
final Map<String,Isolate> _isolateCache = new Map<String,Isolate>(); final Map<String,Isolate> _isolateCache = <String,Isolate>{};
/// The list of live isolates, ordered by isolate start time. /// The list of live isolates, ordered by isolate start time.
final List<Isolate> isolates = new List<Isolate>(); final List<Isolate> isolates = <Isolate>[];
/// The set of live views. /// The set of live views.
final Map<String, FlutterView> _viewCache = new Map<String, FlutterView>(); final Map<String, FlutterView> _viewCache = <String, FlutterView>{};
int _compareIsolates(Isolate a, Isolate b) { int _compareIsolates(Isolate a, Isolate b) {
final DateTime aStart = a.startTime; final DateTime aStart = a.startTime;
...@@ -767,7 +767,7 @@ class Isolate extends ServiceObjectOwner { ...@@ -767,7 +767,7 @@ class Isolate extends ServiceObjectOwner {
DateTime startTime; DateTime startTime;
ServiceEvent pauseEvent; ServiceEvent pauseEvent;
final Map<String, ServiceObject> _cache = new Map<String, ServiceObject>(); final Map<String, ServiceObject> _cache = <String, ServiceObject>{};
@override @override
ServiceObject getFromMap(Map<String, dynamic> map) { ServiceObject getFromMap(Map<String, dynamic> map) {
...@@ -967,7 +967,7 @@ class Isolate extends ServiceObjectOwner { ...@@ -967,7 +967,7 @@ class Isolate extends ServiceObjectOwner {
class ServiceMap extends ServiceObject implements Map<String, dynamic> { class ServiceMap extends ServiceObject implements Map<String, dynamic> {
ServiceMap._empty(ServiceObjectOwner owner) : super._empty(owner); ServiceMap._empty(ServiceObjectOwner owner) : super._empty(owner);
final Map<String, dynamic> _map = new Map<String, dynamic>(); final Map<String, dynamic> _map = <String, dynamic>{};
@override @override
void _update(Map<String, dynamic> map, bool mapIsRef) { void _update(Map<String, dynamic> map, bool mapIsRef) {
......
...@@ -77,7 +77,7 @@ void applyMocksToCommand(FlutterCommand command) { ...@@ -77,7 +77,7 @@ void applyMocksToCommand(FlutterCommand command) {
/// Common functionality for tracking mock interaction /// Common functionality for tracking mock interaction
class BasicMock { class BasicMock {
final List<String> messages = new List<String>(); final List<String> messages = <String>[];
void expectMessages(List<String> expectedMessages) { void expectMessages(List<String> expectedMessages) {
final List<String> actualMessages = new List<String>.from(messages); final List<String> actualMessages = new List<String>.from(messages);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment