DebugEnvironments class

Keeps the selected environment and remembers it between app starts.

Usually used through DioDebugLogger; exposed for advanced use.

Inheritance

Properties

global → List<DebugEnvironment>
Environments set with setGlobal; used by every Dio that doesn't pass its own list.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isEmpty → bool
no setter
names → List<String>
Environment names in the order they were first registered.
no setter
onChanged ↔ void Function(String? name)?
Called after the user picks an environment (null = app default).
getter/setter pair
ready → Future<void>
Completes when the stored selection has been loaded.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selected → String?
The selected environment name, or null when the app's own base URLs are used.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
byName(String name) → List<DebugEnvironment>
All environments with name, one per distinct base URL.
dispose() → void
Discards any resources used by the object.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
register(List<DebugEnvironment> environments) → void
Registers the environments of one Dio instance.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → void
Clears everything. For tests only.
resolve(List<DebugEnvironment> group, String baseUrl) → String?
The base URL to use for a request of a Dio with the environments group.
select(String? name) → Future<void>
Selects an environment by name. null goes back to the app default.
setGlobal(List<DebugEnvironment> environments) → void
Sets the app-wide environments, available before any Dio exists.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

instance → DebugEnvironments
final

Constants

storageKey → const String