react_hooks 1.0.1 copy "react_hooks: ^1.0.1" to clipboard
react_hooks: ^1.0.1 copied to clipboard

A Flutter package that provides React-like hooks (useState, useEffect) for state management and side effects in Flutter apps.

Changelog #

1.0.0 - 2025-09-26 #

Added #

  • Initial release
  • Implemented useState hook functionality
    • Basic state management with multiple syntax styles
    • Property access: countState.value, countState.setValue()
    • Destructuring to variables: final count = countState.value; final setCount = countState.setValue;
    • Tuple style: countState.$1, countState.$2
    • Functional updates: countState.update((prev) => prev + 1)
    • Convenience methods: boolState.toggle()
  • Implemented useEffect hook functionality
    • Side effect handling and lifecycle management
    • Dependency array support: [], [dep1, dep2], null
    • Cleanup function support
  • Implemented useMemo and useCallback hooks
    • Performance optimization, caching computation results and callback functions
  • Implemented useContext for state sharing
    • Context-based state management across widget tree
    • Provider and HookProvider components
    • Automatic dependency injection
  • Implemented convenient useState variants
    • useBool() - Specialized for boolean values, supports toggle()
    • useTextEditingController() - For TextField management
  • HookWidget base class and HookBuilder component
  • Complete type definitions and documentation
  • Example application demonstrating multiple syntax styles

Features #

  • πŸš€ React-like state management with multiple syntax style support
  • ⚑ Side effects and lifecycle management
  • 🎯 Complete type safety
  • πŸ”„ Functional update support
  • 🧹 Automatic cleanup mechanism
  • 🎨 Flexible API design adapting to different development habits
  • πŸ’‘ Convenient specialized hooks for improved development efficiency
  • 🌐 Context state sharing capabilities

Technical Implementation #

  • ChangeNotifier-based state management
  • Hook context management ensuring hook call order
  • Microtask-scheduled side effect execution
  • Dependency comparison algorithm for performance optimization
  • InheritedWidget-based context propagation
1
likes
145
points
160
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that provides React-like hooks (useState, useEffect) for state management and side effects in Flutter apps.

Repository (GitHub)
View/report issues

Topics

#hooks #state-management #react #flutter #widget

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on react_hooks