get<T> method

  1. @override
T get<T>(
  1. EnvSchema variable
)
override

Implementation

@override
T get<T>(EnvSchema variable) {
  final result = _values.entries
      .firstWhereOrNull((element) => element.key == variable.key);

  if (variable.required && result == null) {
    throw Exception('Environment variable ${variable.key} not found');
  }

  return result?.value as T;
}