shorter nullable list duplications (#30305)

This commit is contained in:
Alexandre Ardhuin 2019-04-05 19:23:35 +02:00 committed by Dan Field
parent 1ae32facfe
commit 32f1b810ae
3 changed files with 3 additions and 3 deletions

View File

@ -119,7 +119,7 @@ class ListModel<E> {
Iterable<E> initialItems,
}) : assert(listKey != null),
assert(removedItemBuilder != null),
_items = List<E>.from(initialItems ?? <E>[]);
_items = initialItems?.toList() ?? <E>[];
final GlobalKey<AnimatedListState> listKey;
final dynamic removedItemBuilder;

View File

@ -613,7 +613,7 @@ class _ListModel {
Iterable<int> initialItems,
}) : assert(listKey != null),
assert(removedItemBuilder != null),
_items = List<int>.from(initialItems ?? <int>[]);
_items = initialItems?.toList() ?? <int>[];
final GlobalKey<AnimatedListState> listKey;
final dynamic removedItemBuilder;

View File

@ -1813,7 +1813,7 @@ class _MatchesSemanticsData extends Matcher {
final List<CustomSemanticsAction> providedCustomActions = data.customSemanticsActionIds.map((int id) {
return CustomSemanticsAction.getAction(id);
}).toList();
final List<CustomSemanticsAction> expectedCustomActions = List<CustomSemanticsAction>.from(customActions ?? const <int>[]);
final List<CustomSemanticsAction> expectedCustomActions = customActions?.toList() ?? <CustomSemanticsAction>[];
if (hintOverrides?.onTapHint != null)
expectedCustomActions.add(CustomSemanticsAction.overridingAction(hint: hintOverrides.onTapHint, action: SemanticsAction.tap));
if (hintOverrides?.onLongPressHint != null)