WritableBeacon<T> class
A beacon that can be written to.
- Inheritance
-
- Object
- Producer<
T> - ReadableBeacon<
T> - WritableBeacon
- Available extensions
Constructors
- WritableBeacon({T? initialValue, String? name})
- @macro WritableBeacon
Properties
-
$$widgetSubscribers$$
→ Set<
int> -
The hashcode of all widgets subscribed to this beacon.
This should not be used directly.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialValue → T
-
The initial value of the beacon.
no setterinherited
- isData → bool
-
Available on ReadableBeacon<
ReturnsAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >trueif this is AsyncData. This is equivalent tobeacon.peek().isData.no setter - isDisposed → bool
-
Returns true if the beacon has been disposed.
no setterinherited
- isEmpty → bool
-
Returns true if the beacon has not been initialized.
no setterinherited
- isError → bool
-
Available on ReadableBeacon<
ReturnsAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >trueif this is AsyncError. This is equivalent tobeacon.peek().isError.no setter - isIdle → bool
-
Available on ReadableBeacon<
ReturnsAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >trueif this is AsyncIdle. This is equivalent tobeacon.peek().isIdle.no setter - isIdleOrLoading → bool
-
Available on ReadableBeacon<
ReturnsAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >trueif this is AsyncIdle or AsyncLoading. This is equivalent tobeacon.peek().isIdleOrLoading.no setter - isLoading → bool
-
Available on ReadableBeacon<
ReturnsAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >trueif this is AsyncLoading. This is equivalent tobeacon.peek().isLoading.no setter - lastData → T?
-
Available on ReadableBeacon<
Returns the last data that was successfully loaded This is useful when you want to display old data when in AsyncError or AsyncLoading state. equivalent toAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >beacon.peek().lastDatano setter - listenersCount → int
-
The number of listeners subscribed to this beacon.
no setterinherited
- name → String
-
The name of the beacon. For debugging purposes.
no setterinherited
- previousValue → T?
-
The previous value of the beacon.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
T> -
Returns a broadcast Stream that emits the current value
and all subsequent updates to the value of this beacon.
no setterinherited
- value ↔ T
-
Returns the current value and subscribes to changes in the beacon
when used within a
Beacon.effectorBeacon.derived.getter/setter pairinherited-getter
Methods
-
buffer(
int count, {String? name, bool synchronous = true}) → BufferedCountBeacon< T> -
Available on ReadableBeacon<
Returns a BufferedCountBeacon that wraps this Beacon.T> , provided by the ReadableBeaconWrapUtils extension -
bufferTime(
Duration duration, {String? name, bool synchronous = true}) → BufferedTimeBeacon< T> -
Available on ReadableBeacon<
Returns a BufferedTimeBeacon that wraps this Beacon.T> , provided by the ReadableBeaconWrapUtils extension -
call(
) → T -
Equivalent to calling value getter.
inherited
-
clearWrapped(
) → void -
Disposes all currently wrapped beacons
inherited
-
debounce(
Duration duration, {String? name, bool synchronous = true}) → DebouncedBeacon< T> -
Available on ReadableBeacon<
Returns a DebouncedBeacon that wraps this Beacon.T> , provided by the ReadableBeaconWrapUtils extension -
decrement(
) → void -
Available on WritableBeacon<
Decrements the value of this beacon.T> , provided by the IntUtils extension -
dispose(
) → void -
Clears all registered listeners and
resouces used by the beacon. You will
not be able to update or subscribe to
the beacon after it has been disposed.
override
-
filter(
bool filter(T?, T), {String? name, bool lazyBypass = true, bool synchronous = true}) → FilteredBeacon< T> -
Available on ReadableBeacon<
Returns a FilteredBeacon that wraps this Beacon.T> , provided by the ReadableBeaconWrapUtils extension -
freeze(
) → ReadableBeacon< T> -
Available on WritableBeacon<
Returns a ReadableBeacon that is not writable.T> , provided by the WritableBeaconUtils extension -
increment(
) → void -
Available on WritableBeacon<
Increments the value of this beacon.T> , provided by the IntUtils extension -
ingest(
Stream< T> source, {void then(T)?, T? initialValue}) → void -
Available on BeaconWrapper<
Injest aT, U> , provided by the WritableWrap extensionStreamand add all values emitted from it to this beacon -
map<
O> (MapFilter< T, O> mapFN, {String? name, bool synchronous = true}) → ReadableBeacon<O> -
Available on ReadableBeacon<
Returns a ReadableBeacon that wraps a Beacon and tranforms its values.T> , provided by the ReadableBeaconWrapUtils extension -
next(
{bool filter(T)?, T? fallback}) → Future< T> -
Available on ReadableBeacon<
Listens for the next value emitted by this Beacon and returns it as a Future.T> , provided by the ReadableBeaconUtils extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
observe(
BuildContext context, ObserverCallback< T> callback, {bool synchronous = false}) → void -
Available on BaseBeacon<
Observes the state of a beacon and triggers a callback with the current state.T> , provided by the WidgetUtils extension -
onDispose(
VoidCallback callback) → VoidCallback -
Registers a callback to be called when the beacon is disposed.
Returns a function that can be called to remove the callback.
inherited
-
peek(
) → T -
Return the current value of the beacon without subscribing to it.
inherited
-
reset(
{bool force = false}) → void - Set the beacon to its initial value and notify all listeners
-
set(
T newValue, {bool force = false}) → void - Sets the value of the beacon and allows a force notification
-
subscribe(
void callback(T), {bool startNow = true, bool synchronous = false}) → VoidCallback -
Subscribes to changes in the beacon
returns a function that can be called to unsubscribe
inherited
-
throttle(
Duration duration, {bool dropBlocked = true, bool synchronous = true, String? name}) → ThrottledBeacon< T> -
Available on ReadableBeacon<
Returns a ThrottledBeacon that wraps this Beacon.T> , provided by the ReadableBeaconWrapUtils extension -
toggle(
) → void -
Available on WritableBeacon<
Toggles the value of this beacon.bool> , provided by the BoolUtils extension -
toListenable(
) → ValueListenable< T> -
Available on ReadableBeacon<
Converts this to a ValueListenableT> , provided by the ReadableBeaconFlutterUtils extension -
toStream(
{bool synchronous = false}) → Stream< T> -
Returns a broadcast Stream that emits the current value
and all subsequent updates to the value of this beacon.
If
synchronousis true,autobatchingwill be disabled and all updates will be emitted immediately.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
toValueNotifier(
) → ValueNotifier< T> -
Available on WritableBeacon<
Converts this to a ValueNotifierT> , provided by the WritableBeaconFlutterUtils extension -
tryCatch(
Future< T> future(), {T? optimisticResult}) → Future<void> -
Available on WritableBeacon<
Executes the future provided and automatically sets the beacon to the appropriate state.AsyncValue< , provided by the WritableAsyncBeacon extensionT> > -
unwrapValue(
) → T -
Available on ReadableBeacon<
If this beacon's value is AsyncData, returns it's value. Otherwise throws an exception. equivalent toAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >beacon.peek().unwrap() -
unwrapValueOrNull(
) → T? -
Available on ReadableBeacon<
If this beacon's value is AsyncData, returns it's value. Otherwise returnsAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >null. equivalent tobeacon.peek().unwrapOrNull() -
watch(
BuildContext context) → T -
Available on BaseBeacon<
Watches a beacon and triggers a widget rebuild when its value changes.T> , provided by the WidgetUtils extension -
wrap<
V> (ReadableBeacon< V> target, {void then(V)?, bool disposeTogether = false, bool startNow = true, bool synchronous = true}) → void -
Available on BeaconWrapper<
Wraps aT, U> , provided by the WritableWrap extensionReadableBeaconand comsume its values
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited