FutureBeacon<T> class
See Beacon.future
- Inheritance
-
- Object
- Producer<
AsyncValue< T> > - ReadableBeacon<
AsyncValue< T> > - FutureBeacon
- Available extensions
Constructors
-
FutureBeacon(FutureCallback<
T> compute, {required bool shouldSleep, bool manualStart = false, String? name}) -
See
Beacon.future
Properties
-
$$widgetSubscribers$$
→ Set<
int> -
The hashcode of all widgets subscribed to this beacon.
This should not be used directly.
finalinherited
- cancelOnError → bool
-
passed to the internal stream subscription
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialValue
→ AsyncValue<
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
→ AsyncValue<
T> ? -
The previous value of the beacon.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldSleep → bool
-
Whether the beacon should sleep when there are no observers.
finalinherited
-
stream
→ Stream<
AsyncValue< T> > -
Returns a broadcast Stream that emits the current value
and all subsequent updates to the value of this beacon.
no setterinherited
-
value
→ AsyncValue<
T> -
Returns the current value and subscribes to changes in the beacon
when used within a
Beacon.effectorBeacon.derived.no setterinherited
Methods
-
call(
) → AsyncValue< T> -
Equivalent to calling value getter.
inherited
-
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.
inherited
-
guard(
) → void -
Prevents the beacon from being disposed by its dependants.
The beacon will still be disposed if its dependencies are disposed.
inherited
-
idle(
) → void -
Sets the beacon to the AsyncIdle state.
The
lastDatawill be set to the current value. The beacon will have to be started manually to resume. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
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
-
overrideWith(
FutureCallback< T> compute) → void - Replaces the current callback and resets the beacon
-
peek(
) → AsyncValue< T> -
Return the current value of the beacon without subscribing to it.
inherited
-
reset(
) → void - Resets the beacon by executing the future again.
-
start(
) → void -
Starts listening to the internal stream
if
manualStartwas set to true.inherited -
subscribe(
void callback(AsyncValue< T> ), {bool startNow = true, bool synchronous = false}) → VoidCallback -
Subscribes to changes in the beacon
returns a function that can be called to unsubscribe
inherited
-
toFuture(
{bool resetIfError = true}) → Future< T> - Exposes this as a Future that can be awaited in a future beacon. This will trigger a re-run of the derived beacon when its state changes.
-
toStream(
{bool synchronous = false}) → Stream< AsyncValue< 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
-
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() -
updateWith(
FutureCallback< T> compute, {T? optimisticResult}) → Future<void> -
Updates the beacon with the result of the
compute.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited