Skip to content

Commit d802df4

Browse files
authored
Switch to Iterable.cast instance method (flutter#150185)
Switch away from the `Iterable.castFrom` static method to the `Iterable.cast` instance method which is more readable and more consistent with other iterable usages.
1 parent 43e71ae commit d802df4

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/flutter/lib/src/widgets/nested_scroll_view.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,8 +1209,7 @@ class _NestedScrollController extends ScrollController {
12091209
}
12101210

12111211
Iterable<_NestedScrollPosition> get nestedPositions {
1212-
// TODO(vegorov): use instance method version of castFrom when it is available.
1213-
return Iterable.castFrom<ScrollPosition, _NestedScrollPosition>(positions);
1212+
return positions.cast<_NestedScrollPosition>();
12141213
}
12151214
}
12161215

packages/flutter_driver/lib/src/driver/timeline.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ List<TimelineEvent>? _parseEvents(Map<String, dynamic> json) {
111111
return null;
112112
}
113113

114-
final List<TimelineEvent> timelineEvents =
115-
Iterable.castFrom<dynamic, Map<String, dynamic>>(jsonEvents)
116-
.map<TimelineEvent>(
117-
(Map<String, dynamic> eventJson) => TimelineEvent(eventJson))
118-
.toList();
114+
final List<TimelineEvent> timelineEvents = jsonEvents
115+
.cast<Map<String, dynamic>>()
116+
.map<TimelineEvent>(
117+
(Map<String, dynamic> eventJson) => TimelineEvent(eventJson))
118+
.toList();
119119

120120
timelineEvents.sort((TimelineEvent e1, TimelineEvent e2) {
121121
return switch ((e1.timestampMicros, e2.timestampMicros)) {

0 commit comments

Comments
 (0)