openJson function

JsonMap openJson(
  1. String filepath
)

Reads filepath as a json Map. If file doesn't exists, returns empty Map.

Implementation

JsonMap openJson(String filepath) {
  final str = openString(filepath);
  if (str.isEmpty) {
    trace('file "$filepath" doesnt exist. Empty json returned');
    return Map<String, String>.identity();
  }
  return jsonDecode(str) as JsonMap;
}