SingleValue<T> class

Simple observable mobx boxed value that can be updated. This class provides a simpler way to update, instead of having to wrap mutations in runInAction, eg

# The normal mobx way
final observable = Observable("Eric");
runInAction(() {
  observable.value = "Eric Martineau";
});

# Using SingleValue
final observable = SingleValue("Eric");
observable.update("Eric Martineau");
Inheritance

Constructors

SingleValue(T? value, [String? name])
SingleValue.empty()
SingleValue.ofValueNotifier(ValueNotifier<T> notifier, {bool sync = false})

Properties

context → ReactiveContext
Override this method to use a custom context.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
internalTracked TrackedValue<T?>
getter/setter pairinherited
isNull bool
Whether or not the underlying value is null
no setterinherited
key Key?
no setterinherited
log → Logger
finalinherited
name String?
A name - can be useful to generate a key based on tracking this value. Not required
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T?
no setterinherited

Methods

disposeAll() Future
inherited
get() → T?
inherited
modify(Mutator<T?> mutator) FutureOr<T?>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerDisposer(Disposer callback) → void
inherited
registerStream(Stream? stream) → void
inherited
registerSubscription(StreamSubscription? subscription) → void
inherited
removeDisposer(FutureOr dispose()) → void
inherited
toString() String
A string representation of this object.
inherited
toValueNotifier({bool sync = false}) ValueNotifier<T?>
Would love extension functions for this
inherited
update(T? value, {bool force = false}) → void
inherited

Operators

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