loadEnvironment method
void
loadEnvironment()
Implementation
void loadEnvironment() {
final dir = Directory.current;
final elements = dir.listSync();
final environments = elements
.where((element) =>
element is File && element.uri.pathSegments.last.contains('.env'))
.toList();
final orderedFiles = orderEnvFiles(environments);
if (orderedFiles.isNotEmpty) {
final environment = orderedFiles.first;
final lines = File.fromUri(environment.uri).readAsLinesSync();
for (final line
in lines.nonNulls.where((element) => element.isNotEmpty)) {
final [key, value] = line.split('=');
_values[key] = value;
}
}
_values.addEntries(Platform.environment.entries);
}