load method
Implementation
Future<Environment> load () async {
File file = File(path.join(Directory.current.path, '.env'));
if (!file.existsSync()) {
throw NotExist(cause: 'The .env file does not exist, please create one.');
}
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;
}