list<T> static method
Returns a List of T
values from the specified list, using the given
decoder
to parse each value.
If the list is absent or empty, returns null (not an empty list).
Otherwise, returns a list with as many items as the specified list, with
each entry in the list decoded using decoder
.
If T
is non-nullable, the decoder must also be non-nullable.
Implementation
static List<T>? list<T>(DataSource source, List<Object> key, ArgumentDecoder<T> decoder) {
final int count = source.length(key);
if (count == 0) {
return null;
}
return List<T>.generate(count, (int index) {
return decoder(source, [...key, index]);
});
}