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