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

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 null if 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, mirroring observable(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 callback to future value changes without going through an Observer widget. If immediate is true, callback also fires once immediately with the current value. If this observable is already closed, returns an already-canceled (inert) subscription and never registers a listener — immediate still 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/Effect is currently tracking (if any). Sugar for untracked(() => 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 to value = newValue. Provided as a regular method (rather than only the value = setter) for call sites that need a tear-off (e.g. passing it directly as an onChanged callback), and to unambiguously assign null to an Observable<T?> — unlike call, which treats a null argument as "no argument".
inherited
toString() String
A string representation of this object.
inherited

Operators

operator +(int other) int
Returns a new value incremented by other without assigning it.
operator -(int other) int
Returns a new value decremented by other without assigning it.
operator ==(Object other) bool
The equality operator.
inherited