Computed<T> class
Auto compute values from some observable by async update function
- Inheritance
-
- Object
- ObservableBase<
T> - Computed
- Implementers
Constructors
Properties
-
calculator
→ FutureOr<
T> Function() -
Function used to calculate value
final
- dependCount → int
-
Number of observable which this object depend on
no setter
- error → String?
-
Error message if value invalid, otherwise is null
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListener → bool
-
Check there are listeners on this observable
no setterinherited
- hasValidator → bool
-
Check has using validate value
no setterinherited
- isPaused → bool
-
Current status rebuild value is pause or not
no setter
- modified → bool
-
Check value has updated
no setterinherited
- oldValue → T
-
The old value if has change
no setteroverride
- onError → (void Function(Object error, StackTrace stack)?)
-
Function called if there are error in procession calculator
final
- peek → T
-
The current value but ignore check depend on in Computed context
no setteroverride
- rateLimit ↔ int
-
Only notify change and rebuild after a number period (millisecond)
getter/setter pair
- rebuildCount → int
-
Number times of calculator was called
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
T> -
Create a broadcast stream to listen value changes.
no setterinherited
-
subcriptions
→ List<
Subscription> -
The current subscription listen on to update computed
no setter
- valid → bool
-
Validate status
no setterinherited
- validStatus → ValidateStatus
-
Get current status of validating process
no setterinherited
- value → T
-
The current value, if value called in a computed context,
it will set Computed is depend on this
no setterinherited
Methods
-
call(
) → T -
inherited
-
changed(
Function callback) → Subscription -
Listen on value changed then run callback
override
-
dispose(
) → void -
Remember close a computed if you don't need it to avoid it auto rebuild
override
-
listen(
Function callback) → Subscription -
Listen on value changed then run callback,
it also run callback in first time
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
) → void -
Notify to observers are listen on this observable
inherited
-
pause(
) → void - Temporary pause rebuild value if there are an observable changed
-
resume(
) → void - Resume and rebuild value after paused
-
setError(
String? msg) → void -
Manual set error, used to update error message by validate outsite
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
ignoreDependencies<
T> (T callback()) → T - Ignore dependency all observables in callback for current Computed
-
task<
T> (List< ObservableBase> depends, T callback()) → Computed<T> - Run a task depends on specific observables
-
version(
List< ObservableBase> depends) → Computed<int> - Create a computed used to listen on specific observable