ProgressBeacon<T> class
A beacon that emits values periodically with progress information.
The progress is calculated as the ratio of elapsed time to totalDuration. The value emitted is determined by the onProgress callback which receives the progress (a value between 0.0 and 1.0).
- Inheritance
-
- Object
- Producer<
T> - ReadableBeacon<
T> - ProgressBeacon
- Available extensions
Constructors
- ProgressBeacon({required Duration interval, required Duration totalDuration, T onProgress(double progress)?, T onDone()?, T onStart()?, bool loop = false, T? initialValue, String? name})
- Creates a ProgressBeacon 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
- interval → Duration
-
The interval at which values are emitted.
final
- 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
- loop → bool
-
Whether to restart the progress when it's done.
final
- name → String
-
The name of the beacon. For debugging purposes.
no setterinherited
- onDone → T Function()?
-
The function that returns the desired
final value when progress reaches 100%.
final
- onProgress → T Function(double progress)?
-
The function that computes the value based on progress.
final
- onStart → T Function()?
-
The function that returns the desired
start value when the beacon is started.
If this is not null, the beacon must be started manually.
final
- previousValue → T?
-
The previous value of the beacon.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
status
→ WritableBeacon<
ProgressStatus> -
The current status of the beacon.
latefinal
-
stream
→ Stream<
T> -
Returns a broadcast Stream that emits the current value
and all subsequent updates to the value of this beacon.
no setterinherited
- totalDuration → Duration
-
The total duration over which progress is calculated.
final
- value → T
-
Returns the current value and subscribes to changes in the beacon
when used within a
Beacon.effectorBeacon.derived.no setterinherited
Methods
-
buffer(
int count, {String? name}) → ReadableBufferedBeacon< T> -
Available on ReadableBeacon<
Returns a BufferedCountBeacon that wraps this Beacon.T> , provided by the ReadableBeaconWrapUtils extension -
bufferTime(
Duration duration, {String? name}) → ReadableBufferedBeacon< 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, {bool allowFirst = false, String? name}) → ReadableBeacon< 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 allowFirst = false}) → ReadableFilteredBeacon< T> -
Available on ReadableBeacon<
Returns a FilteredBeacon that wraps this Beacon.T> , provided by the ReadableBeaconWrapUtils extension -
guard(
) → void -
Prevents the beacon from being disposed by its dependants.
The beacon will still be disposed if its dependencies are disposed.
inherited
-
map<
O> (MapFilter< T, O> mapFN, {String? name}) → 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 -
nextOrNull(
{bool filter(T)?}) → 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) → 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 emission of values.
-
peek(
) → T -
Return the current value of the beacon without subscribing to it.
inherited
-
resume(
) → void - Resumes emission of values.
-
start(
) → void - Starts emitting values periodically.
-
stop(
) → void - Stops emitting values and resets the elapsed time.
-
subscribe(
void callback(T), {bool startNow = true}) → VoidCallback -
Subscribes to changes in the beacon
returns a function that can be called to unsubscribe
inherited
-
throttle(
Duration duration, {bool dropBlocked = true, String? name}) → ReableThrottledBeacon< 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 -
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