load method

  1. @override
Future load(
  1. String path, {
  2. bool fromAssets = true,
})
override

Implementation

@override
Future load(String path, {bool fromAssets = true}) async {
  final String rawString;
  if (fromAssets) {
    rawString = await rootBundle.loadString(path);
  } else {
    final file = File(path);

    if (!(await file.exists())) {
      throw Exception("File not found");
    }

    rawString = await file.readAsString();
  }

  return json.decode(rawString);
}