BookmarkToggle class

Toggle helper. Optimistically flips local state, calls the datasource, and on failure re-fetches the canonical truth.

Consumers should ref.read(bookmarkToggleProvider.notifier).toggle(...) then await ref.read(bookmarkToggleProvider.future) if they need confirmation. The notifier itself does not expose mutation state — keep widget feedback subtle (the toggled icon flip is the feedback).

Inheritance
Annotations

Constructors

BookmarkToggle()

Properties

future → Future<void>
Obtains a Future that resolves with the first state value that is not AsyncLoading.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
ref → Ref
The Ref associated with this notifier.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state ↔ AsyncValue<void>
The value currently exposed by this notifier.
getter/setter pairinherited

Methods

build() → Future<void>
listenSelf(void listener(AsyncValue<void>? previous, AsyncValue<void> next), {void onError(Object error, StackTrace stackTrace)?}) → RemoveListener
Listens to changes on the value exposed by this provider.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
runBuild() → void
Executes Notifier.build.
inherited
toggle({required BookmarkKind kind, required String targetId}) → Future<void>
Toggle the bookmark for targetId of the given kind. After the write succeeds, invalidates bookmarksProvider and the matching isBookmarkedProvider so dependent UI refreshes.
toString() → String
A string representation of this object.
inherited
update(FutureOr<void> cb(void previousState), {FutureOr<void> onError(Object err, StackTrace stackTrace)?}) → Future<void>
A function to update state from its previous value, while abstracting loading/error cases for state.
inherited
updateShouldNotify(AsyncValue<void> previous, AsyncValue<void> next) → bool
A method invoked when the state exposed by this Notifier changes. It compares the previous and new value, and return whether listeners should be notified.
inherited

Operators

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