rrousselgit/flutter_hooks

React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a...

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 21 minutes ago
Added to GitGenius on September 20th, 2026
Created on November 30th, 2018
Open Issues & Pull Requests: 32 (+0)
GitHub issues: Enabled
Number of forks: 198
Total Stargazers: 3,331 (+0)
Total Subscribers: 32 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 13
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 756 days
Stale 30+ days: 12
Stale 90+ days: 12

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • enhancement (21)
  • needs triage (10)
  • bug (7)
  • question (5)
  • breaking (2)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Flutter Hooks is a Dart package that brings React-style hooks to Flutter, providing a new way to manage widget lifecycles as an alternative to StatefulWidget.

The core problem it addresses is code reuse across widgets. StatefulWidget makes it difficult to share logic like initialization and disposal between different widgets, forcing developers to reimplement similar patterns repeatedly. Mixins offer a partial solution but have limitations: each mixin can only be used once per class, and naming conflicts between mixins can cause compilation failures or unexpected behavior. Flutter Hooks solves this by introducing composable hook functions that encapsulate stateful logic. These hooks are stored in the widget's Element as a list rather than a single State object, allowing multiple independent hooks to coexist. When a hook is called, it returns the hook at that position in the list, preserving state across rebuilds.

Developers should adopt this tool if they find themselves duplicating lifecycle logic across multiple widgets or want to extract and share stateful patterns as reusable functions. It works well for projects where code sharing between widgets is a priority and where the team is comfortable with a different mental model than traditional StatefulWidget. The package includes built-in hooks like useAnimationController that handle common patterns, reducing boilerplate. The tool requires widgets to mix in Hooks and follows specific rules: hooks must be prefixed with use, called unconditionally, and never wrapped in conditions, since their identity depends on call order.

The project maintains documentation in multiple languages and demonstrates active engagement with the community. Development shows consistent attention to the codebase with regular updates addressing edge cases and improvements. The maintainers have established clear patterns and conventions for hook usage, reflected in the comprehensive rules documentation. The project includes a substantial collection of example hooks and maintains compatibility with Flutter's hot-reload feature.