import 'dart:convert';
import 'food.dart';
import 'package:flutter/services.dart' as root_bundle;

class FoodDTO {

  static Future<List<Food>> readJson() async {
    final jsonData =
    await root_bundle.rootBundle.loadString('assets/json/csvjson_full.json');
    final list = json.decode(jsonData) as List<dynamic>;
    return list.map((e) => Food.fromJson(e)).toList();
  }
}