PeriodicBeacon<T> class
A beacon that emits values periodically.
- Inheritance
-
- Object
- Producer<
T> - ReadableBeacon<
T> - PeriodicBeacon
- Available extensions
Constructors
- PeriodicBeacon(Duration _period, T _compute(int count), {T? initialValue, String? name})
- Creates a PeriodicBeacon that emits values periodically.
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> >true
if 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> >true
if this is AsyncError. This is equivalent tobeacon.peek().isError
.no setter - isIdle → bool
-
Available on ReadableBeacon<
ReturnsAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >true
if this is AsyncIdle. This is equivalent tobeacon.peek().isIdle
.no setter - isIdleOrLoading → bool
-
Available on ReadableBeacon<
ReturnsAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >true
if this is AsyncIdle or AsyncLoading. This is equivalent tobeacon.peek().isIdleOrLoading
.no setter - isLoading → bool
-
Available on ReadableBeacon<
ReturnsAsyncValue< , provided by the ReadableAsyncBeaconUtils extensionT> >true
if 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().lastData
no 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.effect
orBeacon.derived
.no setterinherited
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
-
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 -
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 -
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
-
pause(
) → void - Pauses emition of values.
-
peek(
) → T -
Return the current value of the beacon without subscribing to it.
inherited
-
resume(
) → void - Resumes emition of values.
-
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 -
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
synchronous
is true,autobatching
will 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()
-
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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited