ObservableInt class
An Observable specialized for int, adding numeric operators.
Um Observable especializado para int, adicionando operadores
numéricos.
Example / Exemplo:
final count = 0.obs;
count++;
count += 5;
- Inheritance
-
- Object
- Observable<
int> - ObservableInt
Constructors
- ObservableInt(int initialValue, {String? name})
-
Creates an ObservableInt holding
initialValue.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether this observable currently has at least one listener attached
(an Observer tracking it, or a manual listen/addListener call).
no setterinherited
- isClosed → bool
-
Whether close has already been called on this observable.
no setterinherited
- previousValue → int?
-
The value this observable held immediately before its most recent
notified change, or
nullif it has never changed since creation. Only updated by an actual value change (the value setter when the new value differs); refresh does not touch it, since the value itself did not change.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ int
-
The current value of the object.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object notifies its listeners.
inherited
-
call(
[int? newValue]) → int -
Shorthand for assigning
newValue, mirroringobservable(newValue).inherited -
close(
) → void -
Disposes this observable: removes all listeners and marks it
isClosed. Subsequent writes are ignored with a debug warning.
inherited
-
listen(
ObserverCallback< int> callback, {bool immediate = false, bool when(int value)?}) → ObservableSubscription -
Subscribes
callbackto future value changes without going through an Observer widget. Ifimmediateistrue,callbackalso fires once immediately with the current value. If this observable is already closed, returns an already-canceled (inert) subscription and never registers a listener —immediatestill fires once, since reading the last value is harmless.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Notifies every current listener. Exposed for subclasses (e.g.
collections) that mutate internal state through means other than the
value setter.
inherited
-
peek(
) → int -
Reads value without registering it as a dependency of whatever
Observer/
Computed/Effectis currently tracking (if any). Sugar foruntracked(() => observable.value).inherited -
refresh(
) → void -
Forces listener notification without changing value. Use this after
mutating a referenced object's internal state in place.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that the
object notifies.
inherited
-
setValue(
int newValue) → void -
Assigns
newValue, equivalent tovalue = newValue. Provided as a regular method (rather than only thevalue =setter) for call sites that need a tear-off (e.g. passing it directly as anonChangedcallback), and to unambiguously assignnullto anObservable<T?>— unlike call, which treats anullargument as "no argument".inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator +(
int other) → int -
Returns a new value incremented by
otherwithout assigning it. -
operator -(
int other) → int -
Returns a new value decremented by
otherwithout assigning it. -
operator ==(
Object other) → bool -
The equality operator.
inherited