setup static method

Future<void> setup({
  1. String? configFilePath,
})

Implementation

static Future<void> setup({String? configFilePath}) async {
  configFilePath =
      configFilePath ?? Resources.getResourcePath('resources/env.env');
  try {
    String raw = await rootBundle.loadString(configFilePath);
    if (raw.isNotEmpty && raw.contains("=")) {
      List<String> columns = LineSplitter().convert(raw);
      for (String column in columns) {
        List<String> list = column.split("=");
        String configListData = Field.getString(list[1], "");
        if (configListData.startsWith("[") && configListData.endsWith("]")) {
          _data[list[0]] = jsonDecode(configListData);
        } else {
          _data[list[0]] = list[1];
        }
      }
    }
  } catch (e) {
    throw e;
  }
  _validate(configFilePath, "CACHE_KEY");
  _validate(configFilePath, "JSON_FILES");
}