EnvConfig<E extends Enum> class

Pairs a user-defined enum value with the asset path of its .env file.

EnvConfig is an optional convenience type. Env.init (and EnvManager.init) accept a plain Map<E, String> — you do not need EnvConfig for typical usage. It is provided for teams that prefer to declare environment descriptors in a centralised list:

const configs = [
  EnvConfig(env: Environment.dev,
            assetPath: 'assets/env/.env.dev'),
  EnvConfig(env: Environment.production,
            assetPath: 'assets/env/.env.production'),
];

await Env.init<Environment>(
  defaultEnv: Environment.production,
  configs: Map.fromEntries(
    configs.map((c) => MapEntry(c.env, c.assetPath)),
  ),
);

Constructors

EnvConfig({required E env, required String assetPath})
Creates an EnvConfig with the given env and assetPath.
const

Properties

assetPath String
The asset path to the .env file for this environment.
final
env → E
The enum value identifying this environment.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited