get<T> static method
get env value
Evn.get('APP_KEY');
Evn.get('APP_KEY', 'Default Value');
Evn.get<int>('PORT', 3000);
Evn.get<num>('PORT', 3000);
Evn.get<String>('APP_KEY');
Implementation
static T get<T>(String key, [dynamic defaultValue]) {
dynamic value = Env().env[key];
value ??= Platform.environment[key];
value ??= defaultValue;
if (T.toString() == 'int') {
return int.parse(value.toString()) as T;
}
if (T.toString() == 'num') {
return num.parse(value.toString()) as T;
}
if (T.toString() == 'bool') {
return bool.parse(value.toString()) as T;
}
return value;
}