[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9168":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},9168,"flutter_hooks","rrousselGit\u002Fflutter_hooks","rrousselGit","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 complete replacement for StatefulWidget.","",null,"Dart",3325,193,31,26,0,1,6,59.96,"MIT License",false,"master",true,[25,26,27,28,29,30],"code-reuse","dart","flutter","hacktoberfest","hook","widget","2026-06-12 04:00:43","[English](https:\u002F\u002Fgithub.com\u002FrrousselGit\u002Fflutter_hooks\u002Fblob\u002Fmaster\u002FREADME.md) | [Português](https:\u002F\u002Fgithub.com\u002FrrousselGit\u002Fflutter_hooks\u002Fblob\u002Fmaster\u002Fpackages\u002Fflutter_hooks\u002Fresources\u002Ftranslations\u002Fpt_br\u002FREADME.md) | [한국어](https:\u002F\u002Fgithub.com\u002FrrousselGit\u002Fflutter_hooks\u002Fblob\u002Fmaster\u002Fpackages\u002Fflutter_hooks\u002Fresources\u002Ftranslations\u002Fko_kr\u002FREADME.md) | [简体中文](https:\u002F\u002Fgithub.com\u002FrrousselGit\u002Fflutter_hooks\u002Fblob\u002Fmaster\u002Fpackages\u002Fflutter_hooks\u002Fresources\u002Ftranslations\u002Fzh_cn\u002FREADME.md) | [日本語](https:\u002F\u002Fgithub.com\u002FrrousselGit\u002Fflutter_hooks\u002Fblob\u002Fmaster\u002Fpackages\u002Fflutter_hooks\u002Fresources\u002Ftranslations\u002Fja_jp\u002FREADME.md)\n\n[![Build](https:\u002F\u002Fgithub.com\u002FrrousselGit\u002Fflutter_hooks\u002Fworkflows\u002FBuild\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FrrousselGit\u002Fflutter_hooks\u002Factions?query=workflow%3ABuild) [![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002FrrousselGit\u002Fflutter_hooks\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002FrrousselGit\u002Fflutter_hooks) [![pub package](https:\u002F\u002Fimg.shields.io\u002Fpub\u002Fv\u002Fflutter_hooks.svg)](https:\u002F\u002Fpub.dev\u002Fpackages\u002Fflutter_hooks) [![pub package](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAwesome-Flutter-blue.svg?longCache=true&style=flat-square)](https:\u002F\u002Fgithub.com\u002FSolido\u002Fawesome-flutter)\n\u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FGSt793j6eT\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F765557403865186374.svg?logo=discord&color=blue\" alt=\"Discord\">\u003C\u002Fa>\n\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002FrrousselGit\u002Fflutter_hooks\u002Fmaster\u002Fpackages\u002Fflutter_hooks\u002Fflutter-hook.svg?sanitize=true\" width=\"200\">\n\n# Flutter Hooks\n\nA Flutter implementation of React hooks: https:\u002F\u002Fmedium.com\u002F@dan_abramov\u002Fmaking-sense-of-react-hooks-fdbde8803889\n\nHooks are a new kind of object that manage the life-cycle of a `Widget`. They exist\nfor one reason: increase the code-sharing _between_ widgets by removing duplicates.\n\n## Motivation\n\n`StatefulWidget` suffers from a big problem: it is very difficult to reuse the\nlogic of say `initState` or `dispose`. An obvious example is `AnimationController`:\n\n```dart\nclass Example extends StatefulWidget {\n  const Example({super.key, required this.duration});\n\n  final Duration duration;\n\n  @override\n  _ExampleState createState() => _ExampleState();\n}\n\nclass _ExampleState extends State\u003CExample> with SingleTickerProviderStateMixin {\n  late final AnimationController _controller;\n\n  @override\n  void initState() {\n    super.initState();\n    _controller = AnimationController(vsync: this, duration: widget.duration);\n  }\n\n  @override\n  void didUpdateWidget(Example oldWidget) {\n    super.didUpdateWidget(oldWidget);\n    if (widget.duration != oldWidget.duration) {\n      _controller.duration = widget.duration;\n    }\n  }\n\n  @override\n  void dispose() {\n    _controller.dispose();\n    super.dispose();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Container();\n  }\n}\n```\n\nAll widgets that desire to use an `AnimationController` will have to reimplement\nalmost all of this logic from scratch, which is of course undesired.\n\nDart mixins can partially solve this issue, but they suffer from other problems:\n\n- A given mixin can only be used once per class.\n- Mixins and the class share the same object.\\\n  This means that if two mixins define a variable under the same name, the result\n  may vary between compilation fails to unknown behavior.\n\n---\n\nThis library proposes a third solution:\n\n```dart\nclass Example extends HookWidget {\n  const Example({super.key, required this.duration});\n\n  final Duration duration;\n\n  @override\n  Widget build(BuildContext context) {\n    final controller = useAnimationController(duration: duration);\n    return Container();\n  }\n}\n```\n\nThis code is functionally equivalent to the previous example. It still disposes the\n`AnimationController` and still updates its `duration` when `Example.duration` changes.\nBut you're probably thinking:\n\n> Where did all the logic go?\n\nThat logic has been moved into `useAnimationController`, a function included directly in\nthis library (see [Existing hooks](https:\u002F\u002Fgithub.com\u002FrrousselGit\u002Fflutter_hooks#existing-hooks)) - It is what we call a _Hook_.\n\nHooks are a new kind of object with some specificities:\n\n- They can only be used in the `build` method of a widget that mix-in `Hooks`.\n- The same hook can be reused arbitrarily many times.\n  The following code defines two independent `AnimationController`, and they are\n  correctly preserved when the widget rebuild.\n\n  ```dart\n  Widget build(BuildContext context) {\n    final controller = useAnimationController();\n    final controller2 = useAnimationController();\n    return Container();\n  }\n  ```\n\n- Hooks are entirely independent of each other and from the widget.\\\n  This means that they can easily be extracted into a package and published on\n  [pub](https:\u002F\u002Fpub.dev\u002F) for others to use.\n\n## Principle\n\nSimilar to `State`, hooks are stored in the `Element` of a `Widget`. However, instead\nof having one `State`, the `Element` stores a `List\u003CHook>`. Then in order to use a `Hook`,\none must call `Hook.use`.\n\nThe hook returned by `use` is based on the number of times it has been called.\nThe first call returns the first hook; the second call returns the second hook,\nthe third call returns the third hook and so on.\n\nIf this idea is still unclear, a naive implementation of hooks could look as follows:\n\n```dart\nclass HookElement extends Element {\n  List\u003CHookState> _hooks;\n  int _hookIndex;\n\n  T use\u003CT>(Hook\u003CT> hook) => _hooks[_hookIndex++].build(this);\n\n  @override\n  performRebuild() {\n    _hookIndex = 0;\n    super.performRebuild();\n  }\n}\n```\n\nFor more explanation of how hooks are implemented, here's a great article about\nhow it was done in React: https:\u002F\u002Fmedium.com\u002F@ryardley\u002Freact-hooks-not-magic-just-arrays-cd4f1857236e\n\n## Rules\n\nDue to hooks being obtained from their index, some rules must be respected:\n\n### DO always prefix your hooks with `use`:\n\n```dart\nWidget build(BuildContext context) {\n  \u002F\u002F starts with `use`, good name\n  useMyHook();\n  \u002F\u002F doesn't start with `use`, could confuse people into thinking that this isn't a hook\n  myHook();\n  \u002F\u002F ....\n}\n```\n\n### DO call hooks unconditionally\n\n```dart\nWidget build(BuildContext context) {\n  useMyHook();\n  \u002F\u002F ....\n}\n```\n\n### DON'T wrap `use` into a condition\n\n```dart\nWidget build(BuildContext context) {\n  if (condition) {\n    useMyHook();\n  }\n  \u002F\u002F ....\n}\n```\n\n---\n\n### About hot-reload\n\nSince hooks are obtained from their index, one may think that hot-reloads while refactoring will break the application.\n\nBut worry not, a `HookWidget` overrides the default hot-reload behavior to work with hooks. Still, there are some situations in which the state of a Hook may be reset.\n\nConsider the following list of hooks:\n\n```dart\nuseA();\nuseB(0);\nuseC();\n```\n\nThen consider that we edited the parameter of `HookB` after performing a hot-reload:\n\n```dart\nuseA();\nuseB(42);\nuseC();\n```\n\nHere everything works fine and all hooks maintain their state.\n\nNow consider that we removed `HookB`. We now have:\n\n```dart\nuseA();\nuseC();\n```\n\nIn this situation, `HookA` maintains its state but `HookC` gets hard reset.\nThis happens because, when a hot-reload is performed after refactoring, all hooks _after_ the first line impacted are disposed of.\nSo, since `HookC` was placed _after_ `HookB`, it will be disposed.\n\n## How to create a hook\n\nThere are two ways to create a hook:\n\n- A function\n\n  Functions are by far the most common way to write hooks. Thanks to hooks being\n  composable by nature, a function will be able to combine other hooks to create\n  a more complex custom hook. By convention, these functions will be prefixed by `use`.\n\n  The following code defines a custom hook that creates a variable and logs its value\n  to the console whenever the value changes:\n\n  ```dart\n  ValueNotifier\u003CT> useLoggedState\u003CT>([T initialData]) {\n    final result = useState\u003CT>(initialData);\n    useValueChanged(result.value, (_, __) {\n      print(result.value);\n    });\n    return result;\n  }\n  ```\n\n- A class\n\n  When a hook becomes too complex, it is possible to convert it into a class that extends `Hook` - which can then be used using `Hook.use`.\\\n  As a class, the hook will look very similar to a `State` class and have access to widget\n  life-cycle and methods such as `initHook`, `dispose` and `setState`.\n\n  It is usually good practice to hide the class under a function as such:\n\n  ```dart\n  Result useMyHook() {\n    return use(const _TimeAlive());\n  }\n  ```\n\n  The following code defines a hook that prints the total time a `State` has been alive on its dispose.\n\n  ```dart\n  class _TimeAlive extends Hook\u003Cvoid> {\n    const _TimeAlive();\n\n    @override\n    _TimeAliveState createState() => _TimeAliveState();\n  }\n\n  class _TimeAliveState extends HookState\u003Cvoid, _TimeAlive> {\n    DateTime start;\n\n    @override\n    void initHook() {\n      super.initHook();\n      start = DateTime.now();\n    }\n\n    @override\n    void build(BuildContext context) {}\n\n    @override\n    void dispose() {\n      print(DateTime.now().difference(start));\n      super.dispose();\n    }\n  }\n  ```\n\n## Existing hooks\n\nFlutter_Hooks already comes with a list of reusable hooks which are divided into different kinds:\n\n### Primitives\n\nA set of low-level hooks that interact with the different life-cycles of a widget\n\n| Name                                                                                                     | Description                                                         |\n| -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |\n| [useEffect](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseEffect.html)             | Useful for side-effects and optionally canceling them.              |\n| [useState](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseState.html)               | Creates a variable and subscribes to it.                            |\n| [useMemoized](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseMemoized.html)         | Caches the instance of a complex object.                            |\n| [useRef](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseRef.html)                   | Creates an object that contains a single mutable property.          |\n| [useCallback](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseCallback.html)         | Caches a function instance.                                         |\n| [useContext](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseContext.html)           | Obtains the `BuildContext` of the building `HookWidget`.            |\n| [useValueChanged](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseValueChanged.html) | Watches a value and triggers a callback whenever its value changed. |\n\n### Object-binding\n\nThis category of hooks the manipulation of existing Flutter\u002FDart objects with hooks.\nThey will take care of creating\u002Fupdating\u002Fdisposing an object.\n\n#### dart:async related hooks:\n\n| Name                                                                                                             | Description                                                                         |\n| ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |\n| [useStream](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseStream.html)                     | Subscribes to a `Stream` and returns its current state as an `AsyncSnapshot`.       |\n| [useStreamController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseStreamController.html) | Creates a `StreamController` which will automatically be disposed.                  |\n| [useOnStreamChange](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseOnStreamChange.html)     | Subscribes to a `Stream`, registers handlers, and returns the `StreamSubscription`. |\n| [useFuture](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseFuture.html)                     | Subscribes to a `Future` and returns its current state as an `AsyncSnapshot`.       |\n\n#### Animation related hooks:\n\n| Name                                                                                                                     | Description                                                            |\n| ------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |\n| [useSingleTickerProvider](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseSingleTickerProvider.html) | Creates a single usage `TickerProvider`.                               |\n| [useAnimationController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseAnimationController.html)   | Creates an `AnimationController` which will be automatically disposed. |\n| [useAnimation](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseAnimation.html)                       | Subscribes to an `Animation` and returns its value.                    |\n\n#### Listenable related hooks:\n\n| Name                                                                                                                 | Description                                                                                         |\n| -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |\n| [useListenable](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseListenable.html)                 | Subscribes to a `Listenable` and marks the widget as needing build whenever the listener is called. |\n| [useListenableSelector](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseListenableSelector.html) | Similar to `useListenable`, but allows filtering UI rebuilds                                        |\n| [useValueNotifier](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseValueNotifier.html)           | Creates a `ValueNotifier` which will be automatically disposed.                                     |\n| [useValueListenable](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseValueListenable.html)       | Subscribes to a `ValueListenable` and return its value.                                             |\n| [useOnListenableChange](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseOnListenableChange.html) | Adds a given listener callback to a `Listenable` which will be automatically removed.               |\n\n#### Misc hooks:\n\nA series of hooks with no particular theme.\n\n| Name                                                                                                                                   | Description                                                                                                                                                              |\n| -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| [useReducer](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseReducer.html)                                         | An alternative to `useState` for more complex states.                                                                                                                    |\n| [usePrevious](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FusePrevious.html)                                       | Returns the previous argument called to [usePrevious].                                                                                                                   |\n| [useTextEditingController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseTextEditingController-constant.html)    | Creates a `TextEditingController`.                                                                                                                                       |\n| [useFocusNode](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseFocusNode.html)                                     | Creates a `FocusNode`.                                                                                                                                                   |\n| [useTabController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseTabController.html)                             | Creates and disposes a `TabController`.                                                                                                                                  |\n| [useScrollController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseScrollController.html)                       | Creates and disposes a `ScrollController`.                                                                                                                               |\n| [usePageController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FusePageController.html)                           | Creates and disposes a `PageController`.                                                                                                                                 |\n| [useFixedExtentScrollController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseFixedExtentScrollController.html) | Creates and disposes a `FixedExtentScrollController`.                                                                                                                    |\n| [useAppLifecycleState](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseAppLifecycleState.html)                     | Returns the current `AppLifecycleState` and rebuilds the widget on change.                                                                                               |\n| [useOnAppLifecycleStateChange](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseOnAppLifecycleStateChange.html)     | Listens to `AppLifecycleState` changes and triggers a callback on change.                                                                                                |\n| [useTransformationController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseTransformationController.html)       | Creates and disposes a `TransformationController`.                                                                                                                       |\n| [useIsMounted](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseIsMounted.html)                                     | An equivalent to `State.mounted` for hooks.                                                                                                                              |\n| [useAutomaticKeepAlive](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseAutomaticKeepAlive.html)                   | An equivalent to the `AutomaticKeepAlive` widget for hooks.                                                                                                              |\n| [useOnPlatformBrightnessChange](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseOnPlatformBrightnessChange.html)   | Listens to platform `Brightness` changes and triggers a callback on change.                                                                                              |\n| [useSearchController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseSearchController.html)                       | Creates and disposes a `SearchController`.                                                                                                                               |\n| [useWidgetStatesController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseWidgetStatesController.html)           | Creates and disposes a `WidgetStatesController`.                                                                                                                         |\n| [useExpansibleController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseExpansibleController.html)               | Creates a `ExpansibleController`.                                                                                                                                        |\n| [useDebounced](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseDebounced.html)                                     | Returns a debounced version of the provided value, triggering widget updates accordingly after a specified timeout duration                                              |\n| [useDraggableScrollableController](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fwidgets\u002FDraggableScrollableController-class.html)                   | Creates a `DraggableScrollableController`.                                                                                                                               |\n| [useCarouselController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseCarouselController.html)                   | Creates and disposes a **`CarouselController`**.                                                                                                                         |\n| [useTreeSliverController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseTreeSliverController.html)               | Creates a `TreeSliverController`.                                                                                                                                        |\n| [useOverlayPortalController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseOverlayPortalController.html)         | Creates and manages an `OverlayPortalController` for controlling the visibility of overlay content. The controller will be automatically disposed when no longer needed. |\n| [useSnapshotController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseSnapshotController.html)                   | Creates and manages a `SnapshotController`                                                                                                                               |\n| [useCupertinoController](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fflutter_hooks\u002Flatest\u002Fflutter_hooks\u002FuseCupertinoController.html)                 | Creates and manages a `CupertinoController`                                                                                                                              |\n\n## Contributions\n\nContributions are welcomed!\n\nIf you feel that a hook is missing, feel free to open a pull-request.\n\nFor a custom-hook to be merged, you will need to do the following:\n\n- Describe the use-case.\n\n  Open an issue explaining why we need this hook, how to use it, ...\n  This is important as a hook will not get merged if the hook doesn't appeal to\n  a large number of people.\n\n  If your hook is rejected, don't worry! A rejection doesn't mean that it won't\n  be merged later in the future if more people show interest in it.\n  In the mean-time, feel free to publish your hook as a package on https:\u002F\u002Fpub.dev.\n\n- Write tests for your hook\n\n  A hook will not be merged unless fully tested to avoid inadvertently breaking it\n  in the future.\n\n- Add it to the README and write documentation for it.\n\n## Sponsors\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fraw.githubusercontent.com\u002FrrousselGit\u002Ffreezed\u002Fmaster\u002Fsponsorkit\u002Fsponsors.svg\">\n    \u003Cimg src='https:\u002F\u002Fraw.githubusercontent.com\u002FrrousselGit\u002Ffreezed\u002Fmaster\u002Fsponsorkit\u002Fsponsors.svg'\u002F>\n  \u003C\u002Fa>\n\u003C\u002Fp>\n","flutter_hooks 是一个为 Flutter 引入类似 React Hooks 机制的库，旨在通过生命周期管理对象来提高组件间的代码复用性，并作为 StatefulWidget 的完全替代方案。其核心功能是允许开发者以更简洁、可重用的方式处理状态和副作用，从而简化复杂 UI 的开发过程。技术上，它利用 Dart 语言特性实现了对 Widget 生命周期的细粒度控制，使得逻辑可以被轻松地在不同组件间共享。适用于需要增强代码复用性和维护性的 Flutter 应用场景，尤其是当项目中存在大量相似但不完全相同的逻辑时，使用 flutter_hooks 可以显著减少冗余代码并提高开发效率。",2,"2026-06-11 03:21:32","top_language"]