collect static method

List<Source> collect(
  1. List list
)

Simplifies creating a list of objects from JSON payload.

Implementation

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