initFile method

dynamic initFile()

Implementation

initFile() async {
  switch (ext) {
    case 'json':
      try {
        final b = await fs.readAsBytes();
        if (b == null) return;
        final json = jsonDecode(
          utf8.decode(b),
        );
        d = switch (json) {
          Map m => {...m},
          List l => {'list': l},
          _ => {},
        };
      } catch (_) {}
  }
  return;
}