fromJson static method

List<Insight>? fromJson(
  1. dynamic json
)

Implementation

static List<Insight>? fromJson(dynamic json) {
  if (json == null) {
    return null;
  }
  List<Insight> result = [];
  for (dynamic jsonInsight in json) {
    InsightType insightType =
        InsightTypesExtension.getType(jsonInsight['type']);

    result.add(Insight(
        id: jsonInsight['id'],
        type: insightType,
        barcode: jsonInsight['barcode'],
        countries: jsonInsight['countries'],
        lang: jsonInsight['lang'],
        model: jsonInsight['model'],
        confidence: jsonInsight['confidence']));
  }
  return result;
}