Prop<T> class

Prop<T> is a wrapper that allows accessing and updating the value of a Ref<T>.

This class provides a call() method to retrieve the current value and an emit(value) method to update it.

Example Usage:

final ref = Ref<int>(10);
final prop = Prop(ref);

print(prop()); // Output: 10

prop.emit(20);
print(prop()); // Output: 20
  • call() retrieves the current value.
  • emit(value) updates the value.

Constructors

Prop.new(Ref<T> _ref)
Creates a Prop<T> with a given Ref<T>.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call() → T
Retrieves the current value of _ref.
emit(T value) → T
Updates _ref.value with a new value and returns the updated value.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited