argumentList<T> method
- String name
Returns a type-checked list argument with its live elements preserved.
Implementation
List<T> argumentList<T>(String name) {
final value = namedArguments[name];
if (value is List<T>) {
return value;
}
if (value is List && value.every((element) => element is T)) {
return value.cast<T>();
}
throw StateError('Argument $name is not a list of $T.');
}