DVSecrets class

Reads secrets from the process environment.

Secrets are deliberately not part of the generated client. Only PUBLIC_-prefixed variables are compiled into env.g.dart; everything else stays in the environment of the process that runs the code. That is why a browser build has no environment to read: a secret compiled into a web bundle is a secret published to every visitor. On the web, reach secrets through a backend function instead.

Constructors

DVSecrets()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

get(String key) String
The value of key.
getOr(String key, String fallback) String
The value of key, falling back to fallback when it is absent. Use for genuinely optional configuration, never to paper over a missing secret.
has(String key) bool
Whether key resolves to a non-empty value.
maybeGet(String key) String?
The value of key, or null when nothing provides it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

configure(Map<String, String> secrets) → void
Registers secrets explicitly. Intended for tests and for hosts that load secrets from a manager rather than the environment.
reset() → void
Drops everything configure registered.