toList<T> function

List<T> toList<T>(
  1. dynamic value,
  2. DynTransformer<T> txr
)

Converts a dynamic json value into a list, using the provided transformer to convert

Implementation

List<T> toList<T>(dynamic value, DynTransformer<T> txr) {
  if (value is Iterable) {
    return value.map((item) => txr(item)).toList();
  } else {
    throw ArgumentError("Expected list value");
  }
}