Switch to Iterable.cast
instance method (#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.
This commit is contained in:
parent
43e71ae64f
commit
d802df49d8
@ -1209,8 +1209,7 @@ class _NestedScrollController extends ScrollController {
|
||||
}
|
||||
|
||||
Iterable<_NestedScrollPosition> get nestedPositions {
|
||||
// TODO(vegorov): use instance method version of castFrom when it is available.
|
||||
return Iterable.castFrom<ScrollPosition, _NestedScrollPosition>(positions);
|
||||
return positions.cast<_NestedScrollPosition>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,11 +111,11 @@ List<TimelineEvent>? _parseEvents(Map<String, dynamic> json) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final List<TimelineEvent> timelineEvents =
|
||||
Iterable.castFrom<dynamic, Map<String, dynamic>>(jsonEvents)
|
||||
.map<TimelineEvent>(
|
||||
(Map<String, dynamic> eventJson) => TimelineEvent(eventJson))
|
||||
.toList();
|
||||
final List<TimelineEvent> timelineEvents = jsonEvents
|
||||
.cast<Map<String, dynamic>>()
|
||||
.map<TimelineEvent>(
|
||||
(Map<String, dynamic> eventJson) => TimelineEvent(eventJson))
|
||||
.toList();
|
||||
|
||||
timelineEvents.sort((TimelineEvent e1, TimelineEvent e2) {
|
||||
return switch ((e1.timestampMicros, e2.timestampMicros)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user