Precondition class
PreconditionsRepository creates this object from PreconditionFunction which you register in PreconditionsRepository.registerPrecondition(). Think of it as a handle to your precondition. It is a mutable ChangeNotifier, but is modified only through methods of PreconditionsRepository and from your point of view is read-only. It's possible to integrate it with your state management tool, for example:
Precondition pHandle = repository.registerPrecondition( ... );
// ...
AnimatedBuilder(
animation: pHandle,
builder: (context, _) => pHandle.build(context),
);
- Inheritance
-
- Object
- ChangeNotifier
- Precondition
Properties
- description → String?
-
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- id → PreconditionId
-
Identification of this precondition. Supply your own or it will be assigned by the repository.
final
- initFunction → InitPreconditionFunction?
-
final
- isFailed → bool
-
Convenient discriminator.
no setter
- isNotSatisfied → bool
-
Convenient discriminator. Please note, that it's not the same as 'isFailed'.
no setter
- isRunning → bool
-
Is running right now.
no setter
- isSatisfied → bool
-
Convenient discriminator.
no setter
- isUnknown → bool
-
Convenient discriminator.
no setter
- lastEvaluation → DateTime?
-
Last evaluation run was finished at ...
no setter
- needsInitialization → bool
-
no setter
- resolveTimeout → Duration
-
Specify a timeout for your PreconditionFunction. After this period test is
evaluated as "failed". Default value is 10 seconds. Because all test are executed simultaneously,
we can say that "evaluation" method in PreconditionsRepository will run for maximum duration
equal to maximum timeout among all executed tests.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → PreconditionStatus
-
Current (equals last) result of evaluation, which happened at lastEvaluation.
no setter
- stayFailedCacheDuration → Duration
-
For how long should we cache negative (failed and error) test results.
Might be usefull in cases when the test itself is expensive,
failed results don't spontaneously change that often etc.
final
- staySatisfiedCacheDuration → Duration
-
For how long should we cache positive test results.
Might be usefull in cases when the test itself is expensive,
positive results don't spontaneously change that often etc.
final
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
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.
override
-
toStringDebug(
) → String
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override