flutter_spyglass library

Classes

Dependency<T extends Object>
An immutable object describing a dependency. It can be registered in Deps by using Deps.add.
DependencyChanged
Event emitted by Deps when a dependency value is changed, i.e. as a result of the Dependency.create or Dependency.update callback.
DependencyRegistered
Event emitted by Deps when a dependency is registered. It does not mean its value can be read by Deps.get if the dependency is asynchronous. When an async dependency is resolved it will be followed by a DependencyChanged event.
DependencyUnregistered
Event emitted by Deps when a dependency is unregistered.
Deps
A box that contains dependencies. Deps can also form a tree-like hierarchy to allow for scoping and overriding dependencies. Reading values from a deps object that it doesn't contain but its ancestors will return the value from the nearest ancestor.
DepsEvent
Event emitted by Deps when a dependency is registered, unregistered, or changed.
DepsProvider
Register on mount; Unregister on unmount.

Extensions

DepsContext on BuildContext
Shortcuts for obtaining Deps values from BuildContext.
DepsWatchMany on Deps

Properties

deps Deps
Alias for globalDeps.
no setter
globalDeps Deps
no setter

Functions

useDependency<T extends Object>() → T
Watch the specified dependency.
useDeps() Deps
Obtain the nearest Deps scope.
useRegisterDeps(List<Dependency<Object>> dependencies, [List<Object?> keys = const []]) → void
Register dependencies on mount; Unregister on unmount. What DepsProvider does with its DepsProvider.register prop but in a hook form.

Typedefs

DependencyKey = Type
Unregister = void Function()
Callback to unregister a dependency. It will be disposed of automatically.