command_hooks 0.0.2
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 #
useCommandnow returnsCommandState<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)
- Before:
Added #
- New
CommandState<T>class with convenience getters:isLoading- whether the command is currently executinghasError- whether the command completed with an errorhasData- whether the command has completed with non-null datadata- the result data, if availableerror- the error, if anystackTrace- the stack trace for the error, if any
0.0.1 #
- Initial release
- Added
useCommandanduseAsyncCallbackDeduphooks for async event handlers - Added
useObservableanduseCancellableFuturehooks for reactive data - Added
useExplicitRenderutility hook - Added
AsyncSnapshotResult-like extensions (ok,err,pending,mapOrElse) - Added Future utilities (
fromCancellableFuture,retryFuture,asyncMap,asyncReduce)