jsonFromPath function
Implementation
Future<dynamic> jsonFromPath(String path) async {
if (!path.endsWith('.json')) return null;
final file = File(path);
if (!await file.exists()) return null;
return json.decode(await file.readAsString());
}