readMap function

Future<Map<String, dynamic>> readMap(
  1. dynamic file
)

Implementation

Future<Map<String, dynamic>> readMap(file) async {
  if (!await file.exists()) {
    throw Exception('Map file does not exist! ${file.path}');
  }
  String contents = await file.readAsString();
  return json.decode(contents);
}