command_hooks 0.0.2 copy "command_hooks: ^0.0.2" to clipboard
command_hooks: ^0.0.2 copied to clipboard

A Flutter Hooks library providing Result-like async primitives, Commands for event handlers, and utilities for managing async operations.

0.0.2 #

Breaking Changes #

  • useCommand now returns CommandState<T> instead of a record
    • Before: final (:invoke, :current, :reset) = useCommand(...)
    • After: final cmd = useCommand(...)
    • Access members via cmd.invoke(), cmd.current, cmd.reset()
    • This change improves ergonomics when using multiple commands (no naming conflicts)

Added #

  • New CommandState<T> class with convenience getters:
    • isLoading - whether the command is currently executing
    • hasError - whether the command completed with an error
    • hasData - whether the command has completed with non-null data
    • data - the result data, if available
    • error - the error, if any
    • stackTrace - the stack trace for the error, if any

0.0.1 #

  • Initial release
  • Added useCommand and useAsyncCallbackDedup hooks for async event handlers
  • Added useObservable and useCancellableFuture hooks for reactive data
  • Added useExplicitRender utility hook
  • Added AsyncSnapshot Result-like extensions (ok, err, pending, mapOrElse)
  • Added Future utilities (fromCancellableFuture, retryFuture, asyncMap, asyncReduce)
0
likes
160
points
99
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter Hooks library providing Result-like async primitives, Commands for event handlers, and utilities for managing async operations.

Repository (GitHub)
View/report issues

Topics

#flutter #hooks #async #state-management

Documentation

API reference

License

MIT (license)

Dependencies

cancellation_token, flutter, flutter_hooks, rxdart

More

Packages that depend on command_hooks