LevitState<T> class
A functional state provider definition.
LevitState acts as a factory for state instances. When accessed, it creates a scope-local instance that manages its own lifecycle and reactive value.
// Example usage:
final counter = LevitState((ref) {
final count = ref.autoDispose(0.lx);
return count;
});
- Available extensions
Constructors
- LevitState(T _builder(LevitRef ref))
- Creates a new LevitState definition.
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
-
createComputed(
LevitRef ref, String ownerPath) → LxReactive - Creates its scope-local LxReactive instance.
-
delete(
{String? tag, bool force = false}) → bool -
Available on LevitState<
Removes this provider instance from the active LevitScope.T> , provided by the LevitStateExtension extension -
deleteIn(
LevitScope scope, {String? tag, bool force = false}) → bool -
Internal helper to delete this state from a specific
scope. -
find(
{String? tag}) → T -
Available on LevitState<
Resolves the current value of this provider from the active LevitScope.T> , provided by the LevitStateExtension extension -
findAsync(
{String? tag}) → Future< T> -
Available on LevitState<
Asynchronously resolves the value of this provider.T> , provided by the LevitStateExtension extension -
findAsyncIn(
LevitScope scope, {String? tag}) → Future< T> -
Internal helper to resolve this state asynchronously within a specific
scope. -
findIn(
LevitScope scope, {String? tag}) → T -
Internal helper to resolve this state within a specific
scope. -
getComputedValue(
LxReactive computed) → T -
Extracts the current value from the
computedinstance. -
isInstantiatedIn(
LevitScope scope, {String? tag}) → bool -
Internal helper to check if this state is instantiated in a specific
scope. -
isRegisteredIn(
LevitScope scope, {String? tag}) → bool -
Internal helper to check if this state is registered in a specific
scope. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
async<
T> (Future< T> builder(LevitRef ref)) → LevitAsyncState<T> - Creates an asynchronous LevitState definition.