PreconditionsRepository class
Repository of all preconditions of your app. You will typically need just one singleton instance of PreconditionsRepository. It is a mutable ChangeNotifier, which you can integrate with all sort of state management tools.
See package README for usage example.
- Inheritance
-
- Object
- ChangeNotifier
- PreconditionsRepository
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isRunning → bool
-
Use this flag to render CircularProgressIndicator or similar feedback to user.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
debugPrecondition(
PreconditionId id, [Map< PreconditionId, bool> ? _doneMap]) → void -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
evaluatePrecondition(
Precondition p, {bool ignoreCache = false}) → Future< Precondition> -
Runs single precondition test. If the test is already running
it won't be started again and you will receive the result of already running evaluation. If the test has dependencies,
they will be evaluated first. If they fail, your test won't be run at all and it's result will be
PreconditionStatus.Failed()
. -
evaluatePreconditionById(
PreconditionId id, {bool ignoreCache = false}) → Future< Precondition> -
Runs single precondition test. If the test is already running
it won't be started again and you will receive the result of already running evaluation. If the test has dependencies,
they will be evaluated first. If they fail, your test won't be run at all and it's result will be
PreconditionStatus.Failed()
. -
evaluatePreconditions(
{bool ignoreCache = false}) → Future< Iterable< Precondition> > - Run evaluation of all preconditions registered in this repository. Run order respects dependencies but when possible, tests are evaluated in parallel.
-
getAllPreconditions(
) → Iterable< Precondition> - Returns all known preconditions in this repository.
-
getFailedPreconditions(
) → Iterable< Precondition> - Returns all known preconditions in this repository which has other Precondition.status then PreconditionStatus.satisfied().
-
getPrecondition(
PreconditionId id) → Precondition? - Returns desired precondition or null, if it's not registered by registerPrecondition() or registerAggregatePrecondition()
-
hasAnyUnsatisfiedPreconditions(
) → bool - Is there any precondition in this repository in other Precondition.status then PreconditionStatus.satisfied()?
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
registerAggregatePrecondition(
PreconditionId id, Iterable< _Dependency> dependsOn, {dynamic resolveTimeout = const Duration(seconds: 10), dynamic staySatisfiedCacheDuration = Duration.zero, dynamic stayFailedCacheDuration = Duration.zero}) → Precondition -
Very similar to registerPrecondition, but the test it itself is always successful and the result of this
precondition depends solely on "parent" preconditions defined in
dependsOn
. -
registerPrecondition(
PreconditionId id, PreconditionFunction preconditionFunction, {String? description, Iterable< _Dependency> dependsOn = const [], dynamic resolveTimeout = const Duration(seconds: 10), dynamic staySatisfiedCacheDuration = Duration.zero, dynamic stayFailedCacheDuration = Duration.zero, InitPreconditionFunction? initFunction}) → Precondition - Use this method to register your PreconditionFunction with given unique id.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited