Unverified Commit e4a1d3e1 authored by Dan Field's avatar Dan Field Committed by GitHub

Prefer .of to .from (#94772)

parent ac6b5951
...@@ -137,7 +137,7 @@ mixin AnimationLocalListenersMixin { ...@@ -137,7 +137,7 @@ mixin AnimationLocalListenersMixin {
@protected @protected
@pragma('vm:notify-debugger-on-exception') @pragma('vm:notify-debugger-on-exception')
void notifyListeners() { void notifyListeners() {
final List<VoidCallback> localListeners = List<VoidCallback>.from(_listeners); final List<VoidCallback> localListeners = List<VoidCallback>.of(_listeners);
for (final VoidCallback listener in localListeners) { for (final VoidCallback listener in localListeners) {
InformationCollector? collector; InformationCollector? collector;
assert(() { assert(() {
...@@ -226,7 +226,7 @@ mixin AnimationLocalStatusListenersMixin { ...@@ -226,7 +226,7 @@ mixin AnimationLocalStatusListenersMixin {
@protected @protected
@pragma('vm:notify-debugger-on-exception') @pragma('vm:notify-debugger-on-exception')
void notifyStatusListeners(AnimationStatus status) { void notifyStatusListeners(AnimationStatus status) {
final List<AnimationStatusListener> localListeners = List<AnimationStatusListener>.from(_statusListeners); final List<AnimationStatusListener> localListeners = List<AnimationStatusListener>.of(_statusListeners);
for (final AnimationStatusListener listener in localListeners) { for (final AnimationStatusListener listener in localListeners) {
try { try {
if (_statusListeners.contains(listener)) if (_statusListeners.contains(listener))
......
...@@ -159,7 +159,7 @@ class _CupertinoTabViewState extends State<CupertinoTabView> { ...@@ -159,7 +159,7 @@ class _CupertinoTabViewState extends State<CupertinoTabView> {
void _updateObservers() { void _updateObservers() {
_navigatorObservers = _navigatorObservers =
List<NavigatorObserver>.from(widget.navigatorObservers) List<NavigatorObserver>.of(widget.navigatorObservers)
..add(_heroController); ..add(_heroController);
} }
......
...@@ -179,7 +179,7 @@ class CachingIterable<E> extends IterableBase<E> { ...@@ -179,7 +179,7 @@ class CachingIterable<E> extends IterableBase<E> {
@override @override
List<E> toList({ bool growable = true }) { List<E> toList({ bool growable = true }) {
_precacheEntireList(); _precacheEntireList();
return List<E>.from(_results, growable: growable); return List<E>.of(_results, growable: growable);
} }
void _precacheEntireList() { void _precacheEntireList() {
......
...@@ -583,7 +583,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer { ...@@ -583,7 +583,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
@override @override
void dispose() { void dispose() {
final List<_TapGesture> localGestures = List<_TapGesture>.from(_gestureMap.values); final List<_TapGesture> localGestures = List<_TapGesture>.of(_gestureMap.values);
for (final _TapGesture gesture in localGestures) for (final _TapGesture gesture in localGestures)
gesture.cancel(); gesture.cancel();
// Rejection of each gesture should cause it to be removed from our map // Rejection of each gesture should cause it to be removed from our map
......
...@@ -118,12 +118,12 @@ class PointerRouter { ...@@ -118,12 +118,12 @@ class PointerRouter {
/// PointerRouter object. /// PointerRouter object.
void route(PointerEvent event) { void route(PointerEvent event) {
final Map<PointerRoute, Matrix4?>? routes = _routeMap[event.pointer]; final Map<PointerRoute, Matrix4?>? routes = _routeMap[event.pointer];
final Map<PointerRoute, Matrix4?> copiedGlobalRoutes = Map<PointerRoute, Matrix4?>.from(_globalRoutes); final Map<PointerRoute, Matrix4?> copiedGlobalRoutes = Map<PointerRoute, Matrix4?>.of(_globalRoutes);
if (routes != null) { if (routes != null) {
_dispatchEventToRoutes( _dispatchEventToRoutes(
event, event,
routes, routes,
Map<PointerRoute, Matrix4?>.from(routes), Map<PointerRoute, Matrix4?>.of(routes),
); );
} }
_dispatchEventToRoutes(event, _globalRoutes, copiedGlobalRoutes); _dispatchEventToRoutes(event, _globalRoutes, copiedGlobalRoutes);
......
...@@ -300,7 +300,7 @@ abstract class OneSequenceGestureRecognizer extends GestureRecognizer { ...@@ -300,7 +300,7 @@ abstract class OneSequenceGestureRecognizer extends GestureRecognizer {
@protected @protected
@mustCallSuper @mustCallSuper
void resolve(GestureDisposition disposition) { void resolve(GestureDisposition disposition) {
final List<GestureArenaEntry> localEntries = List<GestureArenaEntry>.from(_entries.values); final List<GestureArenaEntry> localEntries = List<GestureArenaEntry>.of(_entries.values);
_entries.clear(); _entries.clear();
for (final GestureArenaEntry entry in localEntries) for (final GestureArenaEntry entry in localEntries)
entry.resolve(disposition); entry.resolve(disposition);
......
...@@ -1360,8 +1360,8 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi ...@@ -1360,8 +1360,8 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
// otherwise, no explicit type adding items maybe trigger a crash/failure // otherwise, no explicit type adding items maybe trigger a crash/failure
// when hint and selectedItemBuilder are provided. // when hint and selectedItemBuilder are provided.
final List<Widget> items = widget.selectedItemBuilder == null final List<Widget> items = widget.selectedItemBuilder == null
? (widget.items != null ? List<Widget>.from(widget.items!) : <Widget>[]) ? (widget.items != null ? List<Widget>.of(widget.items!) : <Widget>[])
: List<Widget>.from(widget.selectedItemBuilder!(context)); : List<Widget>.of(widget.selectedItemBuilder!(context));
int? hintIndex; int? hintIndex;
if (widget.hint != null || (!_enabled && widget.disabledHint != null)) { if (widget.hint != null || (!_enabled && widget.disabledHint != null)) {
......
...@@ -168,7 +168,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -168,7 +168,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_children = List<MergeableMaterialItem>.from(widget.children); _children = List<MergeableMaterialItem>.of(widget.children);
for (int i = 0; i < _children.length; i += 1) { for (int i = 0; i < _children.length; i += 1) {
final MergeableMaterialItem child = _children[i]; final MergeableMaterialItem child = _children[i];
......
...@@ -1419,7 +1419,7 @@ class _TabBarViewState extends State<TabBarView> { ...@@ -1419,7 +1419,7 @@ class _TabBarViewState extends State<TabBarView> {
setState(() { setState(() {
_warpUnderwayCount += 1; _warpUnderwayCount += 1;
_childrenWithKey = List<Widget>.from(_childrenWithKey, growable: false); _childrenWithKey = List<Widget>.of(_childrenWithKey, growable: false);
final Widget temp = _childrenWithKey[initialPage]; final Widget temp = _childrenWithKey[initialPage];
_childrenWithKey[initialPage] = _childrenWithKey[previousIndex]; _childrenWithKey[initialPage] = _childrenWithKey[previousIndex];
_childrenWithKey[previousIndex] = temp; _childrenWithKey[previousIndex] = temp;
......
...@@ -627,7 +627,7 @@ abstract class ImageStreamCompleter with Diagnosticable { ...@@ -627,7 +627,7 @@ abstract class ImageStreamCompleter with Diagnosticable {
return; return;
// Make a copy to allow for concurrent modification. // Make a copy to allow for concurrent modification.
final List<ImageStreamListener> localListeners = final List<ImageStreamListener> localListeners =
List<ImageStreamListener>.from(_listeners); List<ImageStreamListener>.of(_listeners);
for (final ImageStreamListener listener in localListeners) { for (final ImageStreamListener listener in localListeners) {
try { try {
listener.onImage(image.clone(), false); listener.onImage(image.clone(), false);
......
...@@ -647,7 +647,7 @@ class RenderTable extends RenderBox { ...@@ -647,7 +647,7 @@ class RenderTable extends RenderBox {
// update our internal values // update our internal values
_columns = columns; _columns = columns;
_rows = cells.length ~/ columns; _rows = cells.length ~/ columns;
_children = List<RenderBox?>.from(cells); _children = List<RenderBox?>.of(cells);
assert(_children.length == rows * columns); assert(_children.length == rows * columns);
markNeedsLayout(); markNeedsLayout();
} }
......
...@@ -279,7 +279,7 @@ mixin SchedulerBinding on BindingBase { ...@@ -279,7 +279,7 @@ mixin SchedulerBinding on BindingBase {
@pragma('vm:notify-debugger-on-exception') @pragma('vm:notify-debugger-on-exception')
void _executeTimingsCallbacks(List<FrameTiming> timings) { void _executeTimingsCallbacks(List<FrameTiming> timings) {
final List<TimingsCallback> clonedCallbacks = final List<TimingsCallback> clonedCallbacks =
List<TimingsCallback>.from(_timingsCallbacks); List<TimingsCallback>.of(_timingsCallbacks);
for (final TimingsCallback callback in clonedCallbacks) { for (final TimingsCallback callback in clonedCallbacks) {
try { try {
if (_timingsCallbacks.contains(callback)) { if (_timingsCallbacks.contains(callback)) {
...@@ -562,7 +562,7 @@ mixin SchedulerBinding on BindingBase { ...@@ -562,7 +562,7 @@ mixin SchedulerBinding on BindingBase {
// even if the information collector is called after // even if the information collector is called after
// the problem has been resolved. // the problem has been resolved.
final int count = transientCallbackCount; final int count = transientCallbackCount;
final Map<int, _FrameCallbackEntry> callbacks = Map<int, _FrameCallbackEntry>.from(_transientCallbacks); final Map<int, _FrameCallbackEntry> callbacks = Map<int, _FrameCallbackEntry>.of(_transientCallbacks);
FlutterError.reportError(FlutterErrorDetails( FlutterError.reportError(FlutterErrorDetails(
exception: reason, exception: reason,
library: 'scheduler library', library: 'scheduler library',
...@@ -1084,7 +1084,7 @@ mixin SchedulerBinding on BindingBase { ...@@ -1084,7 +1084,7 @@ mixin SchedulerBinding on BindingBase {
// POST-FRAME CALLBACKS // POST-FRAME CALLBACKS
_schedulerPhase = SchedulerPhase.postFrameCallbacks; _schedulerPhase = SchedulerPhase.postFrameCallbacks;
final List<FrameCallback> localPostFrameCallbacks = final List<FrameCallback> localPostFrameCallbacks =
List<FrameCallback>.from(_postFrameCallbacks); List<FrameCallback>.of(_postFrameCallbacks);
_postFrameCallbacks.clear(); _postFrameCallbacks.clear();
for (final FrameCallback callback in localPostFrameCallbacks) for (final FrameCallback callback in localPostFrameCallbacks)
_invokeFrameCallback(callback, _currentFrameTimeStamp!); _invokeFrameCallback(callback, _currentFrameTimeStamp!);
......
...@@ -217,7 +217,7 @@ class AttributedString { ...@@ -217,7 +217,7 @@ class AttributedString {
// None of the strings is empty. // None of the strings is empty.
final String newString = string + other.string; final String newString = string + other.string;
final List<StringAttribute> newAttributes = List<StringAttribute>.from(attributes); final List<StringAttribute> newAttributes = List<StringAttribute>.of(attributes);
if (other.attributes.isNotEmpty) { if (other.attributes.isNotEmpty) {
final int offset = string.length; final int offset = string.length;
for (final StringAttribute attribute in other.attributes) { for (final StringAttribute attribute in other.attributes) {
...@@ -1739,7 +1739,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { ...@@ -1739,7 +1739,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
} }
assert(!newChildren.any((SemanticsNode node) => node.isMergedIntoParent) || isPartOfNodeMerging); assert(!newChildren.any((SemanticsNode node) => node.isMergedIntoParent) || isPartOfNodeMerging);
_debugPreviousSnapshot = List<SemanticsNode>.from(newChildren); _debugPreviousSnapshot = List<SemanticsNode>.of(newChildren);
SemanticsNode ancestor = this; SemanticsNode ancestor = this;
while (ancestor.parent is SemanticsNode) while (ancestor.parent is SemanticsNode)
...@@ -2262,8 +2262,8 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { ...@@ -2262,8 +2262,8 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
_flags = config._flags; _flags = config._flags;
_textDirection = config.textDirection; _textDirection = config.textDirection;
_sortKey = config.sortKey; _sortKey = config.sortKey;
_actions = Map<SemanticsAction, SemanticsActionHandler>.from(config._actions); _actions = Map<SemanticsAction, SemanticsActionHandler>.of(config._actions);
_customSemanticsActions = Map<CustomSemanticsAction, VoidCallback>.from(config._customSemanticsActions); _customSemanticsActions = Map<CustomSemanticsAction, VoidCallback>.of(config._customSemanticsActions);
_actionsAsBits = config._actionsAsBits; _actionsAsBits = config._actionsAsBits;
_textSelection = config._textSelection; _textSelection = config._textSelection;
_isMultiline = config.isMultiline; _isMultiline = config.isMultiline;
...@@ -2304,7 +2304,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { ...@@ -2304,7 +2304,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
AttributedString attributedDecreasedValue = _attributedDecreasedValue; AttributedString attributedDecreasedValue = _attributedDecreasedValue;
AttributedString attributedHint = _attributedHint; AttributedString attributedHint = _attributedHint;
TextDirection? textDirection = _textDirection; TextDirection? textDirection = _textDirection;
Set<SemanticsTag>? mergedTags = tags == null ? null : Set<SemanticsTag>.from(tags!); Set<SemanticsTag>? mergedTags = tags == null ? null : Set<SemanticsTag>.of(tags!);
TextSelection? textSelection = _textSelection; TextSelection? textSelection = _textSelection;
int? scrollChildCount = _scrollChildCount; int? scrollChildCount = _scrollChildCount;
int? scrollIndex = _scrollIndex; int? scrollIndex = _scrollIndex;
......
...@@ -672,7 +672,7 @@ class RawKeyboard { ...@@ -672,7 +672,7 @@ class RawKeyboard {
'${event.data}', '${event.data}',
); );
// Send the event to passive listeners. // Send the event to passive listeners.
for (final ValueChanged<RawKeyEvent> listener in List<ValueChanged<RawKeyEvent>>.from(_listeners)) { for (final ValueChanged<RawKeyEvent> listener in List<ValueChanged<RawKeyEvent>>.of(_listeners)) {
try { try {
if (_listeners.contains(listener)) { if (_listeners.contains(listener)) {
listener(event); listener(event);
......
...@@ -341,7 +341,7 @@ abstract class Action<T extends Intent> with Diagnosticable { ...@@ -341,7 +341,7 @@ abstract class Action<T extends Intent> with Diagnosticable {
// Make a local copy so that a listener can unregister while the list is // Make a local copy so that a listener can unregister while the list is
// being iterated over. // being iterated over.
final List<ActionListenerCallback> localListeners = List<ActionListenerCallback>.from(_listeners); final List<ActionListenerCallback> localListeners = List<ActionListenerCallback>.of(_listeners);
for (final ActionListenerCallback listener in localListeners) { for (final ActionListenerCallback listener in localListeners) {
InformationCollector? collector; InformationCollector? collector;
assert(() { assert(() {
......
...@@ -635,7 +635,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB ...@@ -635,7 +635,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
/// [SystemChannels.navigation]. /// [SystemChannels.navigation].
@protected @protected
Future<void> handlePopRoute() async { Future<void> handlePopRoute() async {
for (final WidgetsBindingObserver observer in List<WidgetsBindingObserver>.from(_observers)) { for (final WidgetsBindingObserver observer in List<WidgetsBindingObserver>.of(_observers)) {
if (await observer.didPopRoute()) if (await observer.didPopRoute())
return; return;
} }
...@@ -655,14 +655,14 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB ...@@ -655,14 +655,14 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
@protected @protected
@mustCallSuper @mustCallSuper
Future<void> handlePushRoute(String route) async { Future<void> handlePushRoute(String route) async {
for (final WidgetsBindingObserver observer in List<WidgetsBindingObserver>.from(_observers)) { for (final WidgetsBindingObserver observer in List<WidgetsBindingObserver>.of(_observers)) {
if (await observer.didPushRoute(route)) if (await observer.didPushRoute(route))
return; return;
} }
} }
Future<void> _handlePushRouteInformation(Map<dynamic, dynamic> routeArguments) async { Future<void> _handlePushRouteInformation(Map<dynamic, dynamic> routeArguments) async {
for (final WidgetsBindingObserver observer in List<WidgetsBindingObserver>.from(_observers)) { for (final WidgetsBindingObserver observer in List<WidgetsBindingObserver>.of(_observers)) {
if ( if (
await observer.didPushRouteInformation( await observer.didPushRouteInformation(
RouteInformation( RouteInformation(
......
...@@ -1511,7 +1511,7 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier { ...@@ -1511,7 +1511,7 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
if (_listeners.isEmpty) { if (_listeners.isEmpty) {
return; return;
} }
final List<ValueChanged<FocusHighlightMode>> localListeners = List<ValueChanged<FocusHighlightMode>>.from(_listeners); final List<ValueChanged<FocusHighlightMode>> localListeners = List<ValueChanged<FocusHighlightMode>>.of(_listeners);
for (final ValueChanged<FocusHighlightMode> listener in localListeners) { for (final ValueChanged<FocusHighlightMode> listener in localListeners) {
try { try {
if (_listeners.contains(listener)) { if (_listeners.contains(listener)) {
......
...@@ -1854,7 +1854,7 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget { ...@@ -1854,7 +1854,7 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
/// ///
/// Widget build(...) { /// Widget build(...) {
/// // Always create a new list of children as a Widget is immutable. /// // Always create a new list of children as a Widget is immutable.
/// return Row(children: List.from(_children)); /// return Row(children: List.of(_children));
/// } /// }
/// } /// }
/// ``` /// ```
...@@ -5053,7 +5053,7 @@ class InheritedElement extends ProxyElement { ...@@ -5053,7 +5053,7 @@ class InheritedElement extends ProxyElement {
assert(_lifecycleState == _ElementLifecycle.active); assert(_lifecycleState == _ElementLifecycle.active);
final Map<Type, InheritedElement>? incomingWidgets = _parent?._inheritedWidgets; final Map<Type, InheritedElement>? incomingWidgets = _parent?._inheritedWidgets;
if (incomingWidgets != null) if (incomingWidgets != null)
_inheritedWidgets = HashMap<Type, InheritedElement>.from(incomingWidgets); _inheritedWidgets = HashMap<Type, InheritedElement>.of(incomingWidgets);
else else
_inheritedWidgets = HashMap<Type, InheritedElement>(); _inheritedWidgets = HashMap<Type, InheritedElement>();
_inheritedWidgets![widget.runtimeType] = this; _inheritedWidgets![widget.runtimeType] = this;
......
...@@ -448,7 +448,7 @@ class Localizations extends StatefulWidget { ...@@ -448,7 +448,7 @@ class Localizations extends StatefulWidget {
assert(context != null); assert(context != null);
final _LocalizationsScope? scope = context.dependOnInheritedWidgetOfExactType<_LocalizationsScope>(); final _LocalizationsScope? scope = context.dependOnInheritedWidgetOfExactType<_LocalizationsScope>();
assert(scope != null, 'a Localizations ancestor was not found'); assert(scope != null, 'a Localizations ancestor was not found');
return List<LocalizationsDelegate<dynamic>>.from(scope!.localizationsState.widget.delegates); return List<LocalizationsDelegate<dynamic>>.of(scope!.localizationsState.widget.delegates);
} }
/// Returns the localized resources object of the given `type` for the widget /// Returns the localized resources object of the given `type` for the widget
......
...@@ -437,7 +437,7 @@ class OverlayState extends State<Overlay> with TickerProviderStateMixin { ...@@ -437,7 +437,7 @@ class OverlayState extends State<Overlay> with TickerProviderStateMixin {
return; return;
if (listEquals(_entries, newEntriesList)) if (listEquals(_entries, newEntriesList))
return; return;
final LinkedHashSet<OverlayEntry> old = LinkedHashSet<OverlayEntry>.from(_entries); final LinkedHashSet<OverlayEntry> old = LinkedHashSet<OverlayEntry>.of(_entries);
for (final OverlayEntry entry in newEntriesList) { for (final OverlayEntry entry in newEntriesList) {
entry._overlay ??= this; entry._overlay ??= this;
} }
......
...@@ -1405,7 +1405,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -1405,7 +1405,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
Future<RoutePopDisposition> willPop() async { Future<RoutePopDisposition> willPop() async {
final _ModalScopeState<T>? scope = _scopeKey.currentState; final _ModalScopeState<T>? scope = _scopeKey.currentState;
assert(scope != null); assert(scope != null);
for (final WillPopCallback callback in List<WillPopCallback>.from(_willPopCallbacks)) { for (final WillPopCallback callback in List<WillPopCallback>.of(_willPopCallbacks)) {
if (await callback() != true) if (await callback() != true)
return RoutePopDisposition.doNotPop; return RoutePopDisposition.doNotPop;
} }
......
...@@ -168,7 +168,7 @@ class ScrollController extends ChangeNotifier { ...@@ -168,7 +168,7 @@ class ScrollController extends ChangeNotifier {
/// value was out of range. /// value was out of range.
void jumpTo(double value) { void jumpTo(double value) {
assert(_positions.isNotEmpty, 'ScrollController not attached to any scroll views.'); assert(_positions.isNotEmpty, 'ScrollController not attached to any scroll views.');
for (final ScrollPosition position in List<ScrollPosition>.from(_positions)) for (final ScrollPosition position in List<ScrollPosition>.of(_positions))
position.jumpTo(value); position.jumpTo(value);
} }
......
...@@ -128,7 +128,7 @@ class ScrollNotificationObserverState extends State<ScrollNotificationObserver> ...@@ -128,7 +128,7 @@ class ScrollNotificationObserverState extends State<ScrollNotificationObserver>
if (_listeners!.isEmpty) if (_listeners!.isEmpty)
return; return;
final List<_ListenerEntry> localListeners = List<_ListenerEntry>.from(_listeners!); final List<_ListenerEntry> localListeners = List<_ListenerEntry>.of(_listeners!);
for (final _ListenerEntry entry in localListeners) { for (final _ListenerEntry entry in localListeners) {
try { try {
if (entry.list != null) if (entry.list != null)
......
...@@ -167,7 +167,7 @@ class _SharedAppDataState extends State<SharedAppData> { ...@@ -167,7 +167,7 @@ class _SharedAppDataState extends State<SharedAppData> {
void setValue<K extends Object, V>(K key, V value) { void setValue<K extends Object, V>(K key, V value) {
if (data[key] != value) { if (data[key] != value) {
setState(() { setState(() {
data = Map<Object, Object?>.from(data); data = Map<Object, Object?>.of(data);
data[key] = value; data[key] = value;
}); });
} }
......
...@@ -74,7 +74,7 @@ class KeySet<T extends KeyboardKey> { ...@@ -74,7 +74,7 @@ class KeySet<T extends KeyboardKey> {
: assert(keys != null), : assert(keys != null),
assert(keys.isNotEmpty), assert(keys.isNotEmpty),
assert(!keys.contains(null)), assert(!keys.contains(null)),
_keys = HashSet<T>.from(keys); _keys = HashSet<T>.of(keys);
/// Returns a copy of the [KeyboardKey]s in this [KeySet]. /// Returns a copy of the [KeyboardKey]s in this [KeySet].
Set<T> get keys => _keys.toSet(); Set<T> get keys => _keys.toSet();
......
...@@ -662,7 +662,7 @@ class SliverChildListDelegate extends SliverChildDelegate { ...@@ -662,7 +662,7 @@ class SliverChildListDelegate extends SliverChildDelegate {
/// ///
/// Widget build(BuildContext context) { /// Widget build(BuildContext context) {
/// // Always create a new list of children as a Widget is immutable. /// // Always create a new list of children as a Widget is immutable.
/// return PageView(children: List<Widget>.from(_children)); /// return PageView(children: List<Widget>.of(_children));
/// } /// }
/// } /// }
/// ``` /// ```
......
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