PeriodicBeacon<T> class

A beacon that emits values periodically.

Inheritance
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<AsyncValue<T>>, provided by the ReadableAsyncBeaconUtils extension

Returns true if this is AsyncData. This is equivalent to beacon.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<AsyncValue<T>>, provided by the ReadableAsyncBeaconUtils extension

Returns true if this is AsyncError. This is equivalent to beacon.peek().isError.
no setter
isIdle bool

Available on ReadableBeacon<AsyncValue<T>>, provided by the ReadableAsyncBeaconUtils extension

Returns true if this is AsyncIdle. This is equivalent to beacon.peek().isIdle.
no setter
isIdleOrLoading bool

Available on ReadableBeacon<AsyncValue<T>>, provided by the ReadableAsyncBeaconUtils extension

Returns true if this is AsyncIdle or AsyncLoading. This is equivalent to beacon.peek().isIdleOrLoading.
no setter
isLoading bool

Available on ReadableBeacon<AsyncValue<T>>, provided by the ReadableAsyncBeaconUtils extension

Returns true if this is AsyncLoading. This is equivalent to beacon.peek().isLoading.
no setter
lastData → T?

Available on ReadableBeacon<AsyncValue<T>>, provided by the ReadableAsyncBeaconUtils extension

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 to 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 or Beacon.derived.
no setterinherited

Methods

buffer(int count, {String? name, bool synchronous = true}) BufferedCountBeacon<T>

Available on ReadableBeacon<T>, provided by the ReadableBeaconWrapUtils extension

Returns a BufferedCountBeacon that wraps this Beacon.
bufferTime(Duration duration, {String? name, bool synchronous = true}) BufferedTimeBeacon<T>

Available on ReadableBeacon<T>, provided by the ReadableBeaconWrapUtils extension

Returns a BufferedTimeBeacon that wraps this Beacon.
call() → T
Equivalent to calling value getter.
inherited
debounce(Duration duration, {String? name, bool synchronous = true}) DebouncedBeacon<T>

Available on ReadableBeacon<T>, provided by the ReadableBeaconWrapUtils extension

Returns a DebouncedBeacon that wraps this Beacon.
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<T>, provided by the ReadableBeaconWrapUtils extension

Returns a FilteredBeacon that wraps this Beacon.
map<O>(MapFilter<T, O> mapFN, {String? name, bool synchronous = true}) ReadableBeacon<O>

Available on ReadableBeacon<T>, provided by the ReadableBeaconWrapUtils extension

Returns a ReadableBeacon that wraps a Beacon and tranforms its values.
next({bool filter(T)?, T? fallback}) Future<T>

Available on ReadableBeacon<T>, provided by the ReadableBeaconUtils extension

Listens for the next value emitted by this Beacon and returns it as a Future.
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<T>, provided by the WidgetUtils extension

Observes the state of a beacon and triggers a callback with the current state.
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<T>, provided by the ReadableBeaconWrapUtils extension

Returns a ThrottledBeacon that wraps this Beacon.
toListenable() ValueListenable<T>

Available on ReadableBeacon<T>, provided by the ReadableBeaconFlutterUtils extension

Converts this to a ValueListenable
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<AsyncValue<T>>, provided by the ReadableAsyncBeaconUtils extension

If this beacon's value is AsyncData, returns it's value. Otherwise throws an exception. equivalent to beacon.peek().unwrap()
unwrapValueOrNull() → T?

Available on ReadableBeacon<AsyncValue<T>>, provided by the ReadableAsyncBeaconUtils extension

If this beacon's value is AsyncData, returns it's value. Otherwise returns null. equivalent to beacon.peek().unwrapOrNull()
watch(BuildContext context) → T

Available on BaseBeacon<T>, provided by the WidgetUtils extension

Watches a beacon and triggers a widget rebuild when its value changes.

Operators

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