load method Null safety

Future<Environment> load()

Implementation

Future<Environment> load () async {
  File file = File(join(Directory.current.path, '.env'));
  if (!await file.exists()) {
    await createEnvironmentFile();
    exit(0);
  }

  List<String> content = await file.readAsLines(encoding: utf8);

  for (String line in content) {
    if (line.isNotEmpty) {
      List<String> content = line.split(':');
      String key = content.removeAt(0).trim();
      String value = content.join(':').trim();

      _cache.putIfAbsent(key, () => value);
    }
  }

  return this;
}