disco library

Disco is a Flutter library offering convenient, scoped providers for dependency injection that are independent of any specific state management solution.

Classes

ArgProvider<T extends Object, A>
A Provider that needs to be given an initial argument before it can be used.
ArgProviderOverride<T extends Object, A>
Override that, if inserted into the widget tree, takes precedence over _argProvider.
DiscoConfig
The global preferences for the Disco package.
InstantiableArgProvider<T extends Object, A>
An instance of this class is needed to insert an ArgProvider into the widget tree. This ensures that an initial argument is always present and, thus, the ArgProvider can be correctly created.
InstantiableProvider
Either a Provider or an InstantiableArgProvider (i.e. an ArgProvider with its argument).
Override
Either a ProviderOverride or an ArgProviderOverride.
Provider<T extends Object>
A Provider that manages the lifecycle of the value it provides by delegating to a pair of _createValue and _disposeValue.
ProviderOverride<T extends Object>
Override that, if inserted into the widget tree, takes precedence over _provider.
ProviderScope
Provides the passed providers to descendants (i.e. what is in child).
ProviderScopeOverride
Allows to override specific providers for testing purposes. The same providers that are also created in a ProviderScope widget are ignored.
ProviderScopePortal
Makes the providers of the mainContext (i.e. the context belonging to the main tree) available in a new widget tree.

Typedefs

CreateArgProviderValueFn<T, A> = T Function(BuildContext context, A arg)
A function that creates an object of type T with an argument of type A.
CreateProviderValueFn<T> = T Function(BuildContext context)
A function that creates an object of type T.
DisposeProviderValueFn<T> = void Function(T value)
A function that disposes an object of type T.

Exceptions / Errors

ArgProviderWithoutScopeError
Error thrown when the ArgProvider was never attached to a ProviderScope.
MultipleProviderOfSameInstance
Error thrown when multiple providers of the same instance are created together.
MultipleProviderOverrideOfSameProviderInstance
Error thrown when multiple provider overrides of the same provider instance are created together.
MultipleProviderScopeOverrideError
Error thrown when there are multiple ProviderScopeOverride widgets in the widget tree.
ProviderWithoutScopeError
Error thrown when the Provider was never attached to a ProviderScope.