loadJsonFromdir method

Future<GlobalConfigs> loadJsonFromdir(
  1. String dir, {
  2. String? path,
})

Load your GlobalConfigs from a JSON file into the current configs

Load your configs into a specific path by path It will create new key if the path doesn't exist

await GlobalConfigs().loadJsonFromDir(dir, 'assets/cofig.json');

Implementation

Future<GlobalConfigs> loadJsonFromdir(String dir, {String? path}) async {
  String content = await rootBundle.loadString(dir);
  Map<String, dynamic> res = json.decode(content);
  path == null ? configs.addAll(res) : set(path, res);

  return _singleton;
}