getPropsList<T> function

List<T> getPropsList<T>(
  1. Map<String, dynamic> props,
  2. String key
)

Extracts a List value from props.

Returns an empty list if the value is not a List.

Implementation

List<T> getPropsList<T>(Map<String, dynamic> props, String key) {
  final value = props[key];
  if (value is List) {
    return value.whereType<T>().toList();
  }
  return [];
}