loadEnv function
The env for migrations: the .env file and the real environment.
Same rule as Env.get() of dox_core: a real environment variable wins
over the .env file. An empty value, or the text null, counts as
missing. environment and dir are for tests.
Implementation
Map<String, String> loadEnv({Map<String, String>? environment, String? dir}) {
environment ??= Platform.environment;
Map<String, String> data = <String, String>{};
File envFile = File('${dir ?? Directory.current.path}/.env');
if (envFile.existsSync()) data.addAll(parseEnv(envFile.readAsStringSync()));
data.addAll(environment);
data.removeWhere(_missing);
return data;
}