DianaConfig class
Configuration store backed by flattened dot-separated keys, with environment-variable overrides.
Sources, highest precedence first:
- Environment variables (
server.port←SERVER_PORT) - The YAML file loaded by DianaConfig.load (nested maps flattened to dot keys)
Constructors
-
DianaConfig(Map<
String, Object?> values, {Map<String, String> ? environment, List<String> activeProfiles = const []}) -
Creates a config from already-flattened dot-keys
(e.g.
{'server.port': 8080}). Passenvironmentto enable env overrides (tests can inject a fake map). - DianaConfig.empty()
-
An empty configuration.
const
Properties
-
activeProfiles
→ List<
String> -
Profiles applied by load (empty for hand-built configs).
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
-
contains(
String key) → bool -
Whether
keyis present in any configuration source. -
get<
T> (String key, {T? defaultValue}) → T -
Returns the value for
keycoerced toT(String,int,double,boolornum). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
section(
String prefix) → Map< String, Object?> -
The flattened keys under
prefix., with the prefix stripped and environment overrides applied. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
envNameFor(
String key) → String -
The environment variable that overrides
key: upper-cased with dots and dashes replaced by underscores (server.port→SERVER_PORT). -
load(
String path, {Map< String, String> ? environment}) → Future<DianaConfig> -
Loads
path(YAML), applies profile overlays and overlays Platform.environment. A missing file yields an env-only configuration, so containerized deployments can run on environment variables alone.