set literal conversions (#27811)
diff --git a/packages/flutter/lib/src/cupertino/route.dart b/packages/flutter/lib/src/cupertino/route.dart
index e577a0a..3cfebf1 100644
--- a/packages/flutter/lib/src/cupertino/route.dart
+++ b/packages/flutter/lib/src/cupertino/route.dart
@@ -193,7 +193,7 @@
/// * [popGestureEnabled], which returns true if a user-triggered pop gesture
/// would be allowed.
static bool isPopGestureInProgress(PageRoute<dynamic> route) => _popGestureInProgress.contains(route);
- static final Set<PageRoute<dynamic>> _popGestureInProgress = Set<PageRoute<dynamic>>();
+ static final Set<PageRoute<dynamic>> _popGestureInProgress = <PageRoute<dynamic>>{};
/// True if a Cupertino pop gesture is currently underway for this route.
///
diff --git a/packages/flutter/lib/src/gestures/mouse_tracking.dart b/packages/flutter/lib/src/gestures/mouse_tracking.dart
index da65c24..5c93d4f 100644
--- a/packages/flutter/lib/src/gestures/mouse_tracking.dart
+++ b/packages/flutter/lib/src/gestures/mouse_tracking.dart
@@ -70,7 +70,7 @@
///
/// This is used to detect layers that used to have the mouse pointer inside
/// them, but now no longer do (to facilitate exit notification).
- Set<int> activeDevices = Set<int>();
+ Set<int> activeDevices = <int>{};
}
/// Describes a function that finds an annotation given an offset in logical
diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart
index 077d6b3..caf2c58 100644
--- a/packages/flutter/lib/src/material/time_picker.dart
+++ b/packages/flutter/lib/src/material/time_picker.dart
@@ -965,10 +965,10 @@
textDirection: textDirection,
onTap: label.onTap,
),
- tags: Set<SemanticsTag>.from(const <SemanticsTag>[
+ tags: <SemanticsTag>{
// Used by tests to find this node.
- SemanticsTag('dial-label'),
- ]),
+ const SemanticsTag('dial-label'),
+ },
);
nodes.add(node);
labelTheta += labelThetaIncrement;
diff --git a/packages/flutter/lib/src/rendering/custom_layout.dart b/packages/flutter/lib/src/rendering/custom_layout.dart
index e8a53c8..f51ba31 100644
--- a/packages/flutter/lib/src/rendering/custom_layout.dart
+++ b/packages/flutter/lib/src/rendering/custom_layout.dart
@@ -183,7 +183,7 @@
Set<RenderBox> debugPreviousChildrenNeedingLayout;
assert(() {
debugPreviousChildrenNeedingLayout = _debugChildrenNeedingLayout;
- _debugChildrenNeedingLayout = Set<RenderBox>();
+ _debugChildrenNeedingLayout = <RenderBox>{};
return true;
}());
diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart
index 69df942..d4a8655 100644
--- a/packages/flutter/lib/src/rendering/object.dart
+++ b/packages/flutter/lib/src/rendering/object.dart
@@ -921,7 +921,7 @@
}
bool _debugDoingSemantics = false;
- final Set<RenderObject> _nodesNeedingSemantics = Set<RenderObject>();
+ final Set<RenderObject> _nodesNeedingSemantics = <RenderObject>{};
/// Update the semantics for render objects marked as needing a semantics
/// update.
@@ -2422,7 +2422,7 @@
final bool producesForkingFragment = !config.hasBeenAnnotated && !config.isSemanticBoundary;
final List<_InterestingSemanticsFragment> fragments = <_InterestingSemanticsFragment>[];
- final Set<_InterestingSemanticsFragment> toBeMarkedExplicit = Set<_InterestingSemanticsFragment>();
+ final Set<_InterestingSemanticsFragment> toBeMarkedExplicit = <_InterestingSemanticsFragment>{};
final bool childrenMergeIntoParent = mergeIntoParent || config.isMergingSemanticsOfDescendants;
// When set to true there's currently not enough information in this subtree
@@ -3244,7 +3244,7 @@
void addTags(Iterable<SemanticsTag> tags) {
if (tags == null || tags.isEmpty)
return;
- _tagsForChildren ??= Set<SemanticsTag>();
+ _tagsForChildren ??= <SemanticsTag>{};
_tagsForChildren.addAll(tags);
}
diff --git a/packages/flutter/lib/src/rendering/platform_view.dart b/packages/flutter/lib/src/rendering/platform_view.dart
index d816939..dfd1f4e 100644
--- a/packages/flutter/lib/src/rendering/platform_view.dart
+++ b/packages/flutter/lib/src/rendering/platform_view.dart
@@ -481,7 +481,7 @@
// Pointer for which we have already won the arena, events for pointers in this set are
// immediately dispatched to the Android view.
- final Set<int> forwardedPointers = Set<int>();
+ final Set<int> forwardedPointers = <int>{};
// We use OneSequenceGestureRecognizers as they support gesture arena teams.
// TODO(amirh): get a list of GestureRecognizers here.
diff --git a/packages/flutter/lib/src/semantics/semantics.dart b/packages/flutter/lib/src/semantics/semantics.dart
index 828c399..8df9bf9 100644
--- a/packages/flutter/lib/src/semantics/semantics.dart
+++ b/packages/flutter/lib/src/semantics/semantics.dart
@@ -1284,7 +1284,7 @@
return true;
}());
assert(() {
- final Set<SemanticsNode> seenChildren = Set<SemanticsNode>();
+ final Set<SemanticsNode> seenChildren = <SemanticsNode>{};
for (SemanticsNode child in newChildren)
assert(seenChildren.add(child)); // check for duplicate adds
return true;
@@ -1742,7 +1742,7 @@
double scrollExtentMin = _scrollExtentMin;
final double elevation = _elevation;
double thickness = _thickness;
- final Set<int> customSemanticsActionIds = Set<int>();
+ final Set<int> customSemanticsActionIds = <int>{};
for (CustomSemanticsAction action in _customSemanticsActions.keys)
customSemanticsActionIds.add(CustomSemanticsAction.getIdentifier(action));
if (hintOverrides != null) {
@@ -1781,7 +1781,7 @@
if (decreasedValue == '' || decreasedValue == null)
decreasedValue = node._decreasedValue;
if (node.tags != null) {
- mergedTags ??= Set<SemanticsTag>();
+ mergedTags ??= <SemanticsTag>{};
mergedTags.addAll(node.tags);
}
if (node._customSemanticsActions != null) {
@@ -2270,7 +2270,7 @@
}
final List<int> sortedIds = <int>[];
- final Set<int> visitedIds = Set<int>();
+ final Set<int> visitedIds = <int>{};
final List<SemanticsNode> startNodes = nodes.toList()..sort((SemanticsNode a, SemanticsNode b) {
final Offset aTopLeft = _pointInParentCoordinates(a, a.rect.topLeft);
final Offset bTopLeft = _pointInParentCoordinates(b, b.rect.topLeft);
@@ -2410,9 +2410,9 @@
/// obtain a [SemanticsHandle]. This will create a [SemanticsOwner] if
/// necessary.
class SemanticsOwner extends ChangeNotifier {
- final Set<SemanticsNode> _dirtyNodes = Set<SemanticsNode>();
+ final Set<SemanticsNode> _dirtyNodes = <SemanticsNode>{};
final Map<int, SemanticsNode> _nodes = <int, SemanticsNode>{};
- final Set<SemanticsNode> _detachedNodes = Set<SemanticsNode>();
+ final Set<SemanticsNode> _detachedNodes = <SemanticsNode>{};
final Map<int, CustomSemanticsAction> _actions = <int, CustomSemanticsAction>{};
/// The root node of the semantics tree, if any.
@@ -2432,7 +2432,7 @@
void sendSemanticsUpdate() {
if (_dirtyNodes.isEmpty)
return;
- final Set<int> customSemanticsActionIds = Set<int>();
+ final Set<int> customSemanticsActionIds = <int>{};
final List<SemanticsNode> visitedNodes = <SemanticsNode>[];
while (_dirtyNodes.isNotEmpty) {
final List<SemanticsNode> localDirtyNodes = _dirtyNodes.where((SemanticsNode node) => !_detachedNodes.contains(node)).toList();
@@ -3551,7 +3551,7 @@
/// * [RenderSemanticsGestureHandler.excludeFromScrolling] for an example of
/// how tags are used.
void addTagForChildren(SemanticsTag tag) {
- _tagsForChildren ??= Set<SemanticsTag>();
+ _tagsForChildren ??= <SemanticsTag>{};
_tagsForChildren.add(tag);
}
diff --git a/packages/flutter/lib/src/services/raw_keyboard.dart b/packages/flutter/lib/src/services/raw_keyboard.dart
index ee5bce9..02c1441 100644
--- a/packages/flutter/lib/src/services/raw_keyboard.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard.dart
@@ -478,7 +478,7 @@
}
}
- final Set<LogicalKeyboardKey> _keysPressed = Set<LogicalKeyboardKey>();
+ final Set<LogicalKeyboardKey> _keysPressed = <LogicalKeyboardKey>{};
/// Returns the set of keys currently pressed.
Set<LogicalKeyboardKey> get keysPressed {
diff --git a/packages/flutter/lib/src/widgets/animated_switcher.dart b/packages/flutter/lib/src/widgets/animated_switcher.dart
index ea21fa8..9f3a1a1 100644
--- a/packages/flutter/lib/src/widgets/animated_switcher.dart
+++ b/packages/flutter/lib/src/widgets/animated_switcher.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'dart:collection';
-
import 'package:flutter/animation.dart';
import 'package:flutter/foundation.dart';
@@ -278,7 +276,7 @@
class _AnimatedSwitcherState extends State<AnimatedSwitcher> with TickerProviderStateMixin {
_ChildEntry _currentEntry;
- final Set<_ChildEntry> _outgoingEntries = LinkedHashSet<_ChildEntry>();
+ final Set<_ChildEntry> _outgoingEntries = <_ChildEntry>{};
List<Widget> _outgoingWidgets = const <Widget>[];
int _childNumber = 0;
diff --git a/packages/flutter/lib/src/widgets/form.dart b/packages/flutter/lib/src/widgets/form.dart
index 96844dd..c511cd3 100644
--- a/packages/flutter/lib/src/widgets/form.dart
+++ b/packages/flutter/lib/src/widgets/form.dart
@@ -83,7 +83,7 @@
/// Typically obtained via [Form.of].
class FormState extends State<Form> {
int _generation = 0;
- final Set<FormFieldState<dynamic>> _fields = Set<FormFieldState<dynamic>>();
+ final Set<FormFieldState<dynamic>> _fields = <FormFieldState<dynamic>>{};
// Called when a form field has changed. This will cause all form fields
// to rebuild, useful if form fields have interdependencies.
diff --git a/packages/flutter/lib/src/widgets/localizations.dart b/packages/flutter/lib/src/widgets/localizations.dart
index b9bb81c..c3a4712 100644
--- a/packages/flutter/lib/src/widgets/localizations.dart
+++ b/packages/flutter/lib/src/widgets/localizations.dart
@@ -44,7 +44,7 @@
// Only load the first delegate for each delegate type that supports
// locale.languageCode.
- final Set<Type> types = Set<Type>();
+ final Set<Type> types = <Type>{};
final List<LocalizationsDelegate<dynamic>> delegates = <LocalizationsDelegate<dynamic>>[];
for (LocalizationsDelegate<dynamic> delegate in allDelegates) {
if (!types.contains(delegate.type) && delegate.isSupported(locale)) {
diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart
index 13c9224..0564c3c 100644
--- a/packages/flutter/lib/src/widgets/navigator.dart
+++ b/packages/flutter/lib/src/widgets/navigator.dart
@@ -1465,7 +1465,7 @@
class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
final GlobalKey<OverlayState> _overlayKey = GlobalKey<OverlayState>();
final List<Route<dynamic>> _history = <Route<dynamic>>[];
- final Set<Route<dynamic>> _poppedRoutes = Set<Route<dynamic>>();
+ final Set<Route<dynamic>> _poppedRoutes = <Route<dynamic>>{};
/// The [FocusScopeNode] for the [FocusScope] that encloses the routes.
final FocusScopeNode focusScopeNode = FocusScopeNode();
@@ -2145,7 +2145,7 @@
}
}
- final Set<int> _activePointers = Set<int>();
+ final Set<int> _activePointers = <int>{};
void _handlePointerDown(PointerDownEvent event) {
_activePointers.add(event.pointer);
diff --git a/packages/flutter/lib/src/widgets/platform_view.dart b/packages/flutter/lib/src/widgets/platform_view.dart
index 9f16ae1..73c5d4e 100644
--- a/packages/flutter/lib/src/widgets/platform_view.dart
+++ b/packages/flutter/lib/src/widgets/platform_view.dart
@@ -297,7 +297,7 @@
bool _initialized = false;
static final Set<Factory<OneSequenceGestureRecognizer>> _emptyRecognizersSet =
- Set<Factory<OneSequenceGestureRecognizer>>();
+ <Factory<OneSequenceGestureRecognizer>>{};
@override
Widget build(BuildContext context) {
@@ -380,7 +380,7 @@
bool _initialized = false;
static final Set<Factory<OneSequenceGestureRecognizer>> _emptyRecognizersSet =
- Set<Factory<OneSequenceGestureRecognizer>>();
+ <Factory<OneSequenceGestureRecognizer>>{};
@override
Widget build(BuildContext context) {
diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart
index 84ab501..eb23e00 100644
--- a/packages/flutter/lib/src/widgets/routes.dart
+++ b/packages/flutter/lib/src/widgets/routes.dart
@@ -1363,7 +1363,7 @@
void subscribe(RouteAware routeAware, R route) {
assert(routeAware != null);
assert(route != null);
- final Set<RouteAware> subscribers = _listeners.putIfAbsent(route, () => Set<RouteAware>());
+ final Set<RouteAware> subscribers = _listeners.putIfAbsent(route, () => <RouteAware>{});
if (subscribers.add(routeAware)) {
routeAware.didPush();
}
diff --git a/packages/flutter/lib/src/widgets/scroll_position.dart b/packages/flutter/lib/src/widgets/scroll_position.dart
index c6b1bb0..3018a17 100644
--- a/packages/flutter/lib/src/widgets/scroll_position.dart
+++ b/packages/flutter/lib/src/widgets/scroll_position.dart
@@ -432,7 +432,7 @@
break;
}
- final Set<SemanticsAction> actions = Set<SemanticsAction>();
+ final Set<SemanticsAction> actions = <SemanticsAction>{};
if (pixels > minScrollExtent)
actions.add(backward);
if (pixels < maxScrollExtent)
diff --git a/packages/flutter/lib/src/widgets/table.dart b/packages/flutter/lib/src/widgets/table.dart
index acc21f2..e71b2a7 100644
--- a/packages/flutter/lib/src/widgets/table.dart
+++ b/packages/flutter/lib/src/widgets/table.dart
@@ -308,7 +308,7 @@
}
final Iterator<_TableElementRow> oldUnkeyedRows = _children.where((_TableElementRow row) => row.key == null).iterator;
final List<_TableElementRow> newChildren = <_TableElementRow>[];
- final Set<List<Element>> taken = Set<List<Element>>();
+ final Set<List<Element>> taken = <List<Element>>{};
for (TableRow row in newWidget.children) {
List<Element> oldChildren;
if (row.key != null && oldKeyedRows.containsKey(row.key)) {
diff --git a/packages/flutter/lib/src/widgets/ticker_provider.dart b/packages/flutter/lib/src/widgets/ticker_provider.dart
index 2eb79ca..57db697 100644
--- a/packages/flutter/lib/src/widgets/ticker_provider.dart
+++ b/packages/flutter/lib/src/widgets/ticker_provider.dart
@@ -157,7 +157,7 @@
@override
Ticker createTicker(TickerCallback onTick) {
- _tickers ??= Set<_WidgetTicker>();
+ _tickers ??= <_WidgetTicker>{};
final _WidgetTicker result = _WidgetTicker(onTick, this, debugLabel: 'created by $this');
_tickers.add(result);
return result;
diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart
index 9777959..cd48ec9 100644
--- a/packages/flutter/lib/src/widgets/widget_inspector.dart
+++ b/packages/flutter/lib/src/widgets/widget_inspector.dart
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'dart:async';
-import 'dart:collection';
import 'dart:convert';
import 'dart:developer' as developer;
import 'dart:math' as math;
@@ -2259,7 +2258,7 @@
return size == null ? double.maxFinite : size.width * size.height;
}
regularHits.sort((RenderObject a, RenderObject b) => _area(a).compareTo(_area(b)));
- final Set<RenderObject> hits = LinkedHashSet<RenderObject>();
+ final Set<RenderObject> hits = <RenderObject>{};
hits..addAll(edgeHits)..addAll(regularHits);
return hits.toList();
}
diff --git a/packages/flutter/test/rendering/proxy_box_test.dart b/packages/flutter/test/rendering/proxy_box_test.dart
index fe900a2..09519e9 100644
--- a/packages/flutter/test/rendering/proxy_box_test.dart
+++ b/packages/flutter/test/rendering/proxy_box_test.dart
@@ -89,7 +89,7 @@
expect(config.getActionHandler(SemanticsAction.scrollRight), isNotNull);
config = SemanticsConfiguration();
- renderObj.validActions = <SemanticsAction>[SemanticsAction.tap, SemanticsAction.scrollLeft].toSet();
+ renderObj.validActions = <SemanticsAction>{SemanticsAction.tap, SemanticsAction.scrollLeft};
renderObj.describeSemanticsConfiguration(config);
expect(config.getActionHandler(SemanticsAction.tap), isNotNull);
diff --git a/packages/flutter/test/semantics/semantics_test.dart b/packages/flutter/test/semantics/semantics_test.dart
index d7afc13..66fcfd3 100644
--- a/packages/flutter/test/semantics/semantics_test.dart
+++ b/packages/flutter/test/semantics/semantics_test.dart
@@ -26,7 +26,7 @@
expect(node.isTagged(tag1), isFalse);
expect(node.isTagged(tag2), isFalse);
- node.tags = Set<SemanticsTag>()..add(tag1);
+ node.tags = <SemanticsTag>{tag1};
expect(node.isTagged(tag1), isTrue);
expect(node.isTagged(tag2), isFalse);
@@ -36,9 +36,7 @@
});
test('getSemanticsData includes tags', () {
- final Set<SemanticsTag> tags = Set<SemanticsTag>()
- ..add(tag1)
- ..add(tag2);
+ final Set<SemanticsTag> tags = <SemanticsTag>{tag1, tag2};
final SemanticsNode node = SemanticsNode()
..rect = Rect.fromLTRB(0.0, 0.0, 10.0, 10.0)
diff --git a/packages/flutter/test/services/fake_platform_views.dart b/packages/flutter/test/services/fake_platform_views.dart
index fcea5db..735db57 100644
--- a/packages/flutter/test/services/fake_platform_views.dart
+++ b/packages/flutter/test/services/fake_platform_views.dart
@@ -20,7 +20,7 @@
final Map<int, List<FakeAndroidMotionEvent>> motionEvents = <int, List<FakeAndroidMotionEvent>>{};
- final Set<String> _registeredViewTypes = Set<String>();
+ final Set<String> _registeredViewTypes = <String>{};
int _textureCounter = 0;
@@ -153,7 +153,7 @@
Iterable<FakeUiKitView> get views => _views.values;
final Map<int, FakeUiKitView> _views = <int, FakeUiKitView>{};
- final Set<String> _registeredViewTypes = Set<String>();
+ final Set<String> _registeredViewTypes = <String>{};
// When this completer is non null, the 'create' method channel call will be
// delayed until it completes.
diff --git a/packages/flutter/test/widgets/inherited_model_test.dart b/packages/flutter/test/widgets/inherited_model_test.dart
index 57201f8..bb4f4c4 100644
--- a/packages/flutter/test/widgets/inherited_model_test.dart
+++ b/packages/flutter/test/widgets/inherited_model_test.dart
@@ -241,7 +241,7 @@
child: ABCModel( // The "inner" model
a: 100 + _a,
b: 100 + _b,
- aspects: Set<String>.of(<String>['a']),
+ aspects: <String>{'a'},
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
@@ -328,7 +328,7 @@
int _a = 0;
int _b = 1;
int _c = 2;
- Set<String> _innerModelAspects = Set<String>.of(<String>['a']);
+ Set<String> _innerModelAspects = <String>{'a'};
// Same as in abcPage in the "Inner InheritedModel shadows the outer one"
// test except: the "Add b aspect" changes adds 'b' to the set of
@@ -406,14 +406,14 @@
},
);
- _innerModelAspects = Set<String>.of(<String>['a']);
+ _innerModelAspects = <String>{'a'};
await tester.pumpWidget(MaterialApp(home: abcPage));
expect(find.text('a: 100 [0]'), findsOneWidget); // showA depends on the inner model
expect(find.text('b: 1 [0]'), findsOneWidget); // showB depends on the outer model
expect(find.text('c: 2 [0]'), findsOneWidget);
expect(find.text('a: 100 b: 101 c: null'), findsOneWidget); // inner model's a, b, c
- _innerModelAspects = Set<String>.of(<String>['a', 'b']);
+ _innerModelAspects = <String>{'a', 'b'};
await tester.tap(find.text('rebuild'));
await tester.pumpAndSettle();
expect(find.text('a: 100 [1]'), findsOneWidget); // rebuilt showA still depend on the inner model
@@ -448,7 +448,7 @@
expect(find.text('c: 3 [2]'), findsOneWidget); // rebuilt showC still depends on the outer model
expect(find.text('a: 101 b: 102 c: null'), findsOneWidget);
- _innerModelAspects = Set<String>.of(<String>['a', 'b', 'c']);
+ _innerModelAspects = <String>{'a', 'b', 'c'};
await tester.tap(find.text('rebuild'));
await tester.pumpAndSettle();
expect(find.text('a: 101 [3]'), findsOneWidget); // rebuilt showA still depend on the inner model
@@ -457,7 +457,7 @@
expect(find.text('a: 101 b: 102 c: null'), findsOneWidget); // inner model's a, b, c
// Now the inner model supports no aspects
- _innerModelAspects = Set<String>.of(<String>[]);
+ _innerModelAspects = <String>{};
await tester.tap(find.text('rebuild'));
await tester.pumpAndSettle();
expect(find.text('a: 1 [4]'), findsOneWidget); // rebuilt showA now depends on the outer model
diff --git a/packages/flutter/test/widgets/list_wheel_scroll_view_test.dart b/packages/flutter/test/widgets/list_wheel_scroll_view_test.dart
index 65a5ba8..cc6a937 100644
--- a/packages/flutter/test/widgets/list_wheel_scroll_view_test.dart
+++ b/packages/flutter/test/widgets/list_wheel_scroll_view_test.dart
@@ -277,7 +277,7 @@
});
testWidgets('builder is never called twice for same index', (WidgetTester tester) async {
- final Set<int> builtChildren = Set<int>();
+ final Set<int> builtChildren = <int>{};
final FixedExtentScrollController controller =
FixedExtentScrollController();
diff --git a/packages/flutter/test/widgets/platform_view_test.dart b/packages/flutter/test/widgets/platform_view_test.dart
index 4b4ecae..057ec20 100644
--- a/packages/flutter/test/widgets/platform_view_test.dart
+++ b/packages/flutter/test/widgets/platform_view_test.dart
@@ -590,11 +590,11 @@
height: 100.0,
child: AndroidView(
viewType: 'webview',
- gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
+ gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<VerticalDragGestureRecognizer>(
() => VerticalDragGestureRecognizer(),
),
- ].toSet(),
+ },
layoutDirection: TextDirection.ltr,
),
),
@@ -727,11 +727,11 @@
height: 100.0,
child: AndroidView(
viewType: 'webview',
- gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
+ gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<OneSequenceGestureRecognizer>(
() => EagerGestureRecognizer(),
),
- ].toSet(),
+ },
layoutDirection: TextDirection.ltr,
),
),
@@ -760,11 +760,11 @@
final AndroidView androidView = AndroidView(
viewType: 'webview',
- gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
+ gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<EagerGestureRecognizer>(
() => EagerGestureRecognizer(),
),
- ].toSet(),
+ },
layoutDirection: TextDirection.ltr,
);
@@ -786,9 +786,9 @@
await tester.pumpWidget(
AndroidView(
viewType: 'webview',
- gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
+ gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<EagerGestureRecognizer>(constructRecognizer),
- ].toSet(),
+ },
layoutDirection: TextDirection.ltr,
),
);
@@ -797,9 +797,9 @@
AndroidView(
viewType: 'webview',
hitTestBehavior: PlatformViewHitTestBehavior.translucent,
- gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
+ gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<EagerGestureRecognizer>(constructRecognizer),
- ].toSet(),
+ },
layoutDirection: TextDirection.ltr,
),
);
@@ -1214,11 +1214,11 @@
height: 100.0,
child: UiKitView(
viewType: 'webview',
- gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
+ gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<VerticalDragGestureRecognizer>(
() => VerticalDragGestureRecognizer(),
),
- ].toSet(),
+ },
layoutDirection: TextDirection.ltr,
),
),
@@ -1338,11 +1338,11 @@
height: 100.0,
child: UiKitView(
viewType: 'webview',
- gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
+ gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<OneSequenceGestureRecognizer>(
() => EagerGestureRecognizer(),
),
- ].toSet(),
+ },
layoutDirection: TextDirection.ltr,
),
),
@@ -1407,9 +1407,9 @@
await tester.pumpWidget(
UiKitView(
viewType: 'webview',
- gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
+ gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<EagerGestureRecognizer>(constructRecognizer),
- ].toSet(),
+ },
layoutDirection: TextDirection.ltr,
),
);
@@ -1418,9 +1418,9 @@
UiKitView(
viewType: 'webview',
hitTestBehavior: PlatformViewHitTestBehavior.translucent,
- gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
+ gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<EagerGestureRecognizer>(constructRecognizer),
- ].toSet(),
+ },
layoutDirection: TextDirection.ltr,
),
);
diff --git a/packages/flutter/test/widgets/semantics_tester.dart b/packages/flutter/test/widgets/semantics_tester.dart
index 3db3f67..7b22c79 100644
--- a/packages/flutter/test/widgets/semantics_tester.dart
+++ b/packages/flutter/test/widgets/semantics_tester.dart
@@ -61,7 +61,7 @@
assert(decreasedValue != null),
assert(hint != null),
assert(children != null),
- tags = tags?.toSet() ?? Set<SemanticsTag>();
+ tags = tags?.toSet() ?? <SemanticsTag>{};
/// Creates an object with some test semantics data, with the [id] and [rect]
/// set to the appropriate values for the root node.
@@ -92,7 +92,7 @@
elevation = 0.0,
thickness = 0.0,
assert(children != null),
- tags = tags?.toSet() ?? Set<SemanticsTag>();
+ tags = tags?.toSet() ?? <SemanticsTag>{};
/// Creates an object with some test semantics data, with the [id] and [rect]
/// set to the appropriate values for direct children of the root node.
@@ -131,7 +131,7 @@
assert(hint != null),
transform = _applyRootChildScale(transform),
assert(children != null),
- tags = tags?.toSet() ?? Set<SemanticsTag>();
+ tags = tags?.toSet() ?? <SemanticsTag>{};
/// The unique identifier for this node.
///
diff --git a/packages/flutter_localizations/lib/src/material_localizations.dart b/packages/flutter_localizations/lib/src/material_localizations.dart
index 53690d0..93181f2 100644
--- a/packages/flutter_localizations/lib/src/material_localizations.dart
+++ b/packages/flutter_localizations/lib/src/material_localizations.dart
@@ -573,7 +573,7 @@
// Keep track of initialzed locales, or will fail on attempted double init.
// This can only happen if a locale with a stripped scriptCode has already
// been initialzed. This should be removed when scriptCode stripping is removed.
- final Set<String> initializedLocales = Set<String>();
+ final Set<String> initializedLocales = <String>{};
date_localizations.dateSymbols.forEach((String locale, dynamic data) {
// Strip scriptCode from the locale, as we do not distinguish between scripts
// for dates.
diff --git a/packages/flutter_test/lib/src/test_compat.dart b/packages/flutter_test/lib/src/test_compat.dart
index f21dd4e..c987fec 100644
--- a/packages/flutter_test/lib/src/test_compat.dart
+++ b/packages/flutter_test/lib/src/test_compat.dart
@@ -365,7 +365,7 @@
String _lastProgressSuffix;
/// The set of all subscriptions to various streams.
- final Set<StreamSubscription<void>> _subscriptions = Set<StreamSubscription<void>>();
+ final Set<StreamSubscription<void>> _subscriptions = <StreamSubscription<void>>{};
/// A callback called when the engine begins running [liveTest].
void _onTestStarted(LiveTest liveTest) {
diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart
index 0ff7bd2..b15d313 100644
--- a/packages/flutter_test/lib/src/widget_tester.dart
+++ b/packages/flutter_test/lib/src/widget_tester.dart
@@ -551,7 +551,7 @@
@override
Ticker createTicker(TickerCallback onTick) {
- _tickers ??= Set<_TestTicker>();
+ _tickers ??= <_TestTicker>{};
final _TestTicker result = _TestTicker(onTick, _removeTicker);
_tickers.add(result);
return result;
diff --git a/packages/flutter_tools/lib/src/android/gradle.dart b/packages/flutter_tools/lib/src/android/gradle.dart
index af9b3e8..0fcbd77 100644
--- a/packages/flutter_tools/lib/src/android/gradle.dart
+++ b/packages/flutter_tools/lib/src/android/gradle.dart
@@ -682,7 +682,7 @@
.trim();
// Extract build types and product flavors.
- final Set<String> variants = Set<String>();
+ final Set<String> variants = <String>{};
for (String s in tasks.split('\n')) {
final Match match = _assembleTaskPattern.matchAsPrefix(s);
if (match != null) {
@@ -691,8 +691,8 @@
variants.add(variant);
}
}
- final Set<String> buildTypes = Set<String>();
- final Set<String> productFlavors = Set<String>();
+ final Set<String> buildTypes = <String>{};
+ final Set<String> productFlavors = <String>{};
for (final String variant1 in variants) {
for (final String variant2 in variants) {
if (variant2.startsWith(variant1) && variant2 != variant1) {
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index 2918097..70e2ec7 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -320,7 +320,7 @@
// example, a package might itself contain code from multiple third-party
// sources, and might need to include a license for each one.)
final Map<String, Set<String>> packageLicenses = <String, Set<String>>{};
- final Set<String> allPackages = Set<String>();
+ final Set<String> allPackages = <String>{};
for (String packageName in packageMap.map.keys) {
final Uri package = packageMap.map[packageName];
if (package != null && package.scheme == 'file') {
@@ -342,7 +342,7 @@
packageNames = <String>[packageName];
licenseText = rawLicense;
}
- packageLicenses.putIfAbsent(licenseText, () => Set<String>())
+ packageLicenses.putIfAbsent(licenseText, () => <String>{})
..addAll(packageNames);
allPackages.addAll(packageNames);
}
diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart
index 8e60120..5c52534 100644
--- a/packages/flutter_tools/lib/src/base/build.dart
+++ b/packages/flutter_tools/lib/src/base/build.dart
@@ -118,7 +118,7 @@
final String vmServicePath = fs.path.join(skyEnginePkg, 'sdk_ext', 'vmservice_io.dart');
final List<String> inputPaths = <String>[uiPath, vmServicePath, mainPath];
- final Set<String> outputPaths = Set<String>();
+ final Set<String> outputPaths = <String>{};
final String depfilePath = fs.path.join(outputDir.path, 'snapshot.d');
final List<String> genSnapshotArgs = <String>[
@@ -458,7 +458,7 @@
genSnapshotArgs.addAll(extraGenSnapshotOptions);
}
- final Set<String> outputPaths = Set<String>();
+ final Set<String> outputPaths = <String>{};
outputPaths.addAll(<String>[isolateSnapshotData]);
if (!createPatch) {
outputPaths.add(isolateSnapshotInstructions);
diff --git a/packages/flutter_tools/lib/src/base/utils.dart b/packages/flutter_tools/lib/src/base/utils.dart
index a309293..a18ae8b 100644
--- a/packages/flutter_tools/lib/src/base/utils.dart
+++ b/packages/flutter_tools/lib/src/base/utils.dart
@@ -146,7 +146,7 @@
/// available.
class ItemListNotifier<T> {
ItemListNotifier() {
- _items = Set<T>();
+ _items = <T>{};
}
ItemListNotifier.from(List<T> items) {
diff --git a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
index 1be67c6..4d79959 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
@@ -26,7 +26,7 @@
String analysisTarget;
bool firstAnalysis = true;
- Set<String> analyzedPaths = Set<String>();
+ Set<String> analyzedPaths = <String>{};
Map<String, List<AnalysisError>> analysisErrors = <String, List<AnalysisError>>{};
Stopwatch analysisTimer;
int lastErrorCount = 0;
diff --git a/packages/flutter_tools/lib/src/commands/channel.dart b/packages/flutter_tools/lib/src/commands/channel.dart
index 7716db8..dce73af 100644
--- a/packages/flutter_tools/lib/src/commands/channel.dart
+++ b/packages/flutter_tools/lib/src/commands/channel.dart
@@ -52,7 +52,7 @@
// Beware: currentBranch could contain PII. See getBranchName().
final String currentChannel = FlutterVersion.instance.channel;
final String currentBranch = FlutterVersion.instance.getBranchName();
- final Set<String> seenChannels = Set<String>();
+ final Set<String> seenChannels = <String>{};
final List<String> rawOutput = <String>[];
showAll = showAll || currentChannel != currentBranch;
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index faaf109..e3d1d0e 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -612,7 +612,7 @@
return segments.join('.');
}
-final Set<String> _packageDependencies = Set<String>.from(<String>[
+const Set<String> _packageDependencies = <String>{
'analyzer',
'args',
'async',
@@ -639,7 +639,7 @@
'utf',
'watcher',
'yaml',
-]);
+};
/// Return null if the project name is legal. Return a validation message if
/// we should disallow the project name.
diff --git a/packages/flutter_tools/lib/src/commands/ide_config.dart b/packages/flutter_tools/lib/src/commands/ide_config.dart
index e977779..2e14108 100644
--- a/packages/flutter_tools/lib/src/commands/ide_config.dart
+++ b/packages/flutter_tools/lib/src/commands/ide_config.dart
@@ -121,7 +121,7 @@
return;
}
- final Set<String> manifest = Set<String>();
+ final Set<String> manifest = <String>{};
final List<FileSystemEntity> flutterFiles = _flutterRoot.listSync(recursive: true);
for (FileSystemEntity entity in flutterFiles) {
final String relativePath = fs.path.relative(entity.path, from: _flutterRoot.absolute.path);
diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart
index 76de432..254826a 100644
--- a/packages/flutter_tools/lib/src/commands/update_packages.dart
+++ b/packages/flutter_tools/lib/src/commands/update_packages.dart
@@ -200,7 +200,7 @@
// First, collect up the explicit dependencies:
final List<PubspecYaml> pubspecs = <PubspecYaml>[];
final Map<String, PubspecDependency> dependencies = <String, PubspecDependency>{};
- final Set<String> specialDependencies = Set<String>();
+ final Set<String> specialDependencies = <String>{};
for (Directory directory in packages) { // these are all the directories with pubspec.yamls we care about
printTrace('Reading pubspec.yaml from: ${directory.path}');
PubspecYaml pubspec;
@@ -279,7 +279,7 @@
for (PubspecDependency dependency in pubspec.dependencies) {
if (dependency.kind == DependencyKind.normal) {
tree._versions[package] = version;
- tree._dependencyTree[package] ??= Set<String>();
+ tree._dependencyTree[package] ??= <String>{};
tree._dependencyTree[package].add(dependency.name);
}
}
@@ -341,7 +341,7 @@
throwToolExit('Package $to not found in the dependency tree.');
final Queue<_DependencyLink> traversalQueue = Queue<_DependencyLink>();
- final Set<String> visited = Set<String>();
+ final Set<String> visited = <String>{};
final List<_DependencyLink> paths = <_DependencyLink>[];
traversalQueue.addFirst(_DependencyLink(from: null, to: from));
@@ -625,8 +625,8 @@
void apply(PubDependencyTree versions, Set<String> specialDependencies) {
assert(versions != null);
final List<String> output = <String>[]; // the string data to output to the file, line by line
- final Set<String> directDependencies = Set<String>(); // packages this pubspec directly depends on (i.e. not transitive)
- final Set<String> devDependencies = Set<String>();
+ final Set<String> directDependencies = <String>{}; // packages this pubspec directly depends on (i.e. not transitive)
+ final Set<String> devDependencies = <String>{};
Section section = Section.other; // the section we're currently handling
// the line number where we're going to insert the transitive dependencies.
@@ -723,8 +723,8 @@
final List<String> transitiveDevDependencyOutput = <String>[];
// Which dependencies we need to handle for the transitive and dev dependency sections.
- final Set<String> transitiveDependencies = Set<String>();
- final Set<String> transitiveDevDependencies = Set<String>();
+ final Set<String> transitiveDependencies = <String>{};
+ final Set<String> transitiveDevDependencies = <String>{};
// Merge the lists of dependencies we've seen in this file from dependencies, dev dependencies,
// and the dependencies we know this file mentions that are already pinned
@@ -735,7 +735,7 @@
// Create a new set to hold the list of packages we've already processed, so
// that we don't redundantly process them multiple times.
- final Set<String> done = Set<String>();
+ final Set<String> done = <String>{};
for (String package in directDependencies)
transitiveDependencies.addAll(versions.getTransitiveDependenciesFor(package, seen: done, exclude: implied));
for (String package in devDependencies)
@@ -752,7 +752,7 @@
transitiveDevDependencyOutput.add(' $package: ${versions.versionFor(package)} $kTransitiveMagicString');
// Build a sorted list of all dependencies for the checksum.
- final Set<String> checksumDependencies = Set<String>()
+ final Set<String> checksumDependencies = <String>{}
..addAll(directDependencies)
..addAll(devDependencies)
..addAll(transitiveDependenciesAsList)
diff --git a/packages/flutter_tools/lib/src/dependency_checker.dart b/packages/flutter_tools/lib/src/dependency_checker.dart
index bcc9407..8f0aea7 100644
--- a/packages/flutter_tools/lib/src/dependency_checker.dart
+++ b/packages/flutter_tools/lib/src/dependency_checker.dart
@@ -11,7 +11,7 @@
DependencyChecker(this.builder, this.assets);
final DartDependencySetBuilder builder;
- final Set<String> _dependencies = Set<String>();
+ final Set<String> _dependencies = <String>{};
final AssetBundle assets;
/// Returns [true] if any components have been modified after [threshold] or
diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart
index e6dabb1..7940e8b 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -403,7 +403,7 @@
final Directory rootDirectory;
String _packagesFilePath;
final Map<Uri, DevFSContent> _entries = <Uri, DevFSContent>{};
- final Set<String> assetPathsToEvict = Set<String>();
+ final Set<String> assetPathsToEvict = <String>{};
final List<Future<Map<String, dynamic>>> _pendingOperations =
<Future<Map<String, dynamic>>>[];
@@ -533,7 +533,7 @@
// run with no changes is supposed to be fast (considering that it is
// initiated by user key press).
final List<String> invalidatedFiles = <String>[];
- final Set<Uri> filesUris = Set<Uri>();
+ final Set<Uri> filesUris = <Uri>{};
for (Uri uri in dirtyEntries.keys.toList()) {
if (!uri.path.startsWith(assetBuildDirPrefix)) {
final DevFSContent content = dirtyEntries[uri];
diff --git a/packages/flutter_tools/lib/src/flutter_manifest.dart b/packages/flutter_tools/lib/src/flutter_manifest.dart
index 0c094f7..7b39071 100644
--- a/packages/flutter_tools/lib/src/flutter_manifest.dart
+++ b/packages/flutter_tools/lib/src/flutter_manifest.dart
@@ -391,9 +391,9 @@
if (fonts == null) {
return;
}
- final Set<int> fontWeights = Set<int>.from(const <int>[
+ const Set<int> fontWeights = <int>{
100, 200, 300, 400, 500, 600, 700, 800, 900,
- ]);
+ };
for (final YamlMap fontMap in fonts) {
for (dynamic key in fontMap.keys.where((dynamic key) => key != 'family' && key != 'fonts')) {
errors.add('Unexpected child "$key" found under "fonts".');
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index 648547e..b45f4fe 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -733,7 +733,7 @@
final RegExp oldAssets = RegExp(r'\/\* (flutter_assets|app\.flx)');
final StringBuffer buffer = StringBuffer();
- final Set<String> printedStatuses = Set<String>();
+ final Set<String> printedStatuses = <String>{};
for (final String line in lines) {
final Match match = oldAssets.firstMatch(line);
diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart
index e196816..db71d60 100644
--- a/packages/flutter_tools/lib/src/version.dart
+++ b/packages/flutter_tools/lib/src/version.dart
@@ -43,12 +43,12 @@
String _repositoryUrl;
String get repositoryUrl => _repositoryUrl;
- static Set<String> officialChannels = Set<String>.from(<String>[
+ static const Set<String> officialChannels = <String>{
'master',
'dev',
'beta',
'stable',
- ]);
+ };
/// This maps old branch names to the names of branches that replaced them.
///
diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart
index f0d69eb..8a5a711 100644
--- a/packages/flutter_tools/lib/src/vmservice.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -272,7 +272,7 @@
final Map<String, StreamController<ServiceEvent>> _eventControllers =
<String, StreamController<ServiceEvent>>{};
- final Set<String> _listeningFor = Set<String>();
+ final Set<String> _listeningFor = <String>{};
/// Whether our connection to the VM service has been closed;
bool get isClosed => _peer.isClosed;
@@ -749,7 +749,7 @@
void _removeDeadIsolates(List<Isolate> newIsolates) {
// Build a set of new isolates.
- final Set<String> newIsolateSet = Set<String>();
+ final Set<String> newIsolateSet = <String>{};
for (Isolate iso in newIsolates)
newIsolateSet.add(iso.id);
diff --git a/packages/flutter_tools/test/devfs_test.dart b/packages/flutter_tools/test/devfs_test.dart
index db86a6b..318ed1b 100644
--- a/packages/flutter_tools/test/devfs_test.dart
+++ b/packages/flutter_tools/test/devfs_test.dart
@@ -300,7 +300,7 @@
const String packageName = 'doubleslashpkg';
await _createPackage(fs, packageName, 'somefile.txt', doubleSlash: true);
- final Set<String> fileFilter = Set<String>();
+ final Set<String> fileFilter = <String>{};
final List<Uri> pkgUris = <Uri>[fs.path.toUri(basePath)]..addAll(_packages.values);
for (Uri pkgUri in pkgUris) {
if (!pkgUri.isAbsolute) {
diff --git a/packages/flutter_tools/test/hot_test.dart b/packages/flutter_tools/test/hot_test.dart
index f681f42..a9efb24 100644
--- a/packages/flutter_tools/test/hot_test.dart
+++ b/packages/flutter_tools/test/hot_test.dart
@@ -114,7 +114,7 @@
pathToReload: anyNamed('pathToReload'),
)).thenAnswer((Invocation _) => Future<UpdateFSReport>.value(
UpdateFSReport(success: true, syncedBytes: 1000, invalidatedSourcesCount: 1)));
- when(mockDevFs.assetPathsToEvict).thenReturn(Set<String>());
+ when(mockDevFs.assetPathsToEvict).thenReturn(<String>{});
when(mockDevFs.baseUri).thenReturn(Uri.file('test'));
setUp(() {
diff --git a/packages/flutter_tools/test/utils_test.dart b/packages/flutter_tools/test/utils_test.dart
index 5ac0649..cbbe16e 100644
--- a/packages/flutter_tools/test/utils_test.dart
+++ b/packages/flutter_tools/test/utils_test.dart
@@ -62,7 +62,7 @@
});
test('is pretty random', () {
- final Set<String> set = Set<String>();
+ final Set<String> set = <String>{};
Uuid uuid = Uuid();
for (int i = 0; i < 64; i++) {
diff --git a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart
index 99b06e6..88c62a1 100644
--- a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart
+++ b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart
@@ -117,7 +117,7 @@
final Map<int, PortForwarder> _dartVmPortMap = <int, PortForwarder>{};
/// Tracks stale ports so as not to reconnect while polling.
- final Set<int> _stalePorts = Set<int>();
+ final Set<int> _stalePorts = <int>{};
/// A broadcast stream that emits events relating to Dart VM's as they update.
Stream<DartVmEvent> get onDartVmEvent => _onDartVmEvent;