riverpod_swiss_knife 0.0.7+1 copy "riverpod_swiss_knife: ^0.0.7+1" to clipboard
riverpod_swiss_knife: ^0.0.7+1 copied to clipboard

A collection of utilities and extensions for Riverpod.

Riverpod Swiss knife #

A collection of utilities and extensions for Riverpod.

Features #

Here's what you can do with this package.

Caching strategies #

  • cacheFor: cache the value for a specified duration
  • addDisposeDelay: delay the disposal of a provider by a specified duration

Ref utilities #

  • debounceFor: debounce a provider for a specified duration
  • timeout: triggers a callback after a specified duration
  • onRepeat: triggers a callback repeatedly, with the specified interval
  • run: executes an async provider, keeping it alive until its futures completes

Invalidation strategies #

  • invalidateSelfAfter: self-invalidates after a specified duration
  • invalidatePeriodically: invalidates a provider periodically at the specified interval

Provider Listenable utilities #

  • asAsync: transforms any provider updates, by emitting AsyncValue instead
  • where: filters state notifications from an async provider using an explicit (previous, next) → bool predicate
    • notice how it's similar to .selectAsync, except .where keeps the same AsyncValue<T> type and suppresses notifications, rather than allowing mapping to a new type

Notifier utilities #

  • update: update the state based on the previous state, similarly to AsyncNotifier's update method.

Usage #

See the example folder for more details.

Important note #

Please read the API docs carefully before using any of the above utilities.

5
likes
160
points
135
downloads

Documentation

API reference

Publisher

verified publishervenir.dev

Weekly Downloads

A collection of utilities and extensions for Riverpod.

Repository
View/report issues

License

MIT (license)

Dependencies

meta, riverpod

More

Packages that depend on riverpod_swiss_knife