values<T> static method

List<T>? values<T>(
  1. String key,
  2. dynamic source
)

Returns a list of values associated with the given key from the source, cast to the specified type.

Implementation

static List<T>? values<T>(String key, dynamic source) {
  final data = _v(key, source);
  if (data is List) {
    final list = <T>[];
    for (var item in data) {
      if (item is T) {
        list.add(item);
      }
    }
    return list;
  } else {
    return null;
  }
}