toJson static method
Implementation
static List<Map<String, dynamic>> toJson(List<Insight>? insights) {
if (insights == null) {
return [];
}
List<Map<String, dynamic>> result = [];
for (Insight insight in insights) {
Map<String, dynamic> jsonInsight = {};
jsonInsight['id'] = insight.id;
jsonInsight['type'] = insight.type.value;
jsonInsight['barcode'] = insight.barcode;
jsonInsight['countries'] = insight.countries;
jsonInsight['lang'] = insight.lang;
jsonInsight['model'] = insight.model;
jsonInsight['confidence'] = insight.confidence;
result.add(jsonInsight);
}
return result;
}