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) {
    final InsightType insightType =
        InsightType.fromOffTag(jsonInsight['type']) ?? InsightType.UNDEFINED;

    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;
}