init method

Future<bool> init([
  1. bool inInterface = true
])
override

Implementation

Future<bool> init([bool inInterface = true]) async {
  var docs = await Directory(directory)
      .list()
      .where((event) => event.path.endsWith(".json"))
      .toList();

  var colsFtrs =
      docs.map((e) async => json.decode(await File(e.path).readAsString()));
  var cols = await Future.wait(colsFtrs);
  var i = 0;
  while (i < cols.length) {
    data[docs[i].path.split("/").last.replaceAll(".json", "")] =
        (cols[i] as Map).cast<String, Map<String, dynamic>>();
    i++;
  }
  return true;
}