collect static method

List<Quantity> collect(
  1. List list
)

Simplifies creating a list of objects from JSON payload.

Implementation

static List<Quantity> collect(List<dynamic> list) {
  final samples = <Quantity>[];
  for (final Map<String, dynamic> map in list) {
    final sample = Quantity.fromJson(map);
    samples.add(sample);
  }
  return samples;
}