flutter_hooks
A flutter implementation of React hooks. It adds a new kind of widget with enhanced code reuse.
0.21.3
335K downloads/mo
#644 most downloaded on pub.dev
rrousselGit/flutter_hooks
What this package is like to depend on
Last release 1 years ago
19 Aug 2025
Release timing varies
gaps range from 8 days to 7 months
Most releases are documented
notes for 41 of 47 stable releases
1 version withdrawn
withdrawn after publishing
8 years old
62 releases · first in 2018
0 releases in the last 12 months
see the full history below
Release timeline
62 releases · Dec 2018 to Aug 2025Releases
latest 60 of 62-
0.21.312 Aug 2025Release notes
Open source →- Deprecated
useExpansionTileControllerin favor ofuseExpansibleController. - Added
useCupertinoTabControllerthanks to @Erengun - Added
useSnapshotControllerthanks to @benthillerkus - Added
descendantsAreTraversabletouseFocusNodethanks to @gabber235
- Deprecated
-
0.21.3+119 Aug 2025 -
0.21.223 Feb 2025Release notes
Open source →- Add
useCarouselController(thanks to @riscait) - Add
useTreeSliverController(thanks to @benthillerkus) - Added
useOverlayPortalController(thanks to @offich) - Add animationDuration property to useTabController hook (thanks to @d-polikhranidi)
- Add
-
0.21.1-pre.401 Aug 2024 pre-release -
0.21.1-pre.330 Jul 2024 pre-release -
0.21.1-pre.222 Jul 2024 pre-releaseRelease notes
Open source →- Added
onAttachandonDetachtouseScrollControllerandusePageController(thanks to @whynotmake-it)
- Added
-
0.21.1-pre.108 Jul 2024 pre-releaseRelease notes
Open source →- Added
useDraggableScrollableController(thanks to @dickermoshe) - Fix TickerMode not getting muted by hooks (thanks to @dev-tatsuya)
- Added
-
0.21.1-pre.025 Mar 2024 pre-release -
0.21.022 Mar 2024 withdrawnRelease notes
Open source →- Renamed
useMaterialStatesControllertouseWidgetStatesControllerto follow the rename in Flutter.
- Renamed
-
0.20.505 Feb 2024Release notes
Open source →- Deprecate the
useIsMountedhook as you should useBuildContext.mountedinstead if you're on Flutter 3.7.0 or greater
- Deprecate the
-
0.20.429 Dec 2023Release notes
Open source →- Added
useDebounced(thanks to @itisnajim) - Removed
@visibleForTestingonHookMixin
- Added
-
0.20.310 Oct 2023Release notes
Open source →- Added
useExpansionTileController(thanks to @droidbg) - Added
useMaterialStatesController(thanks to @AdamHavlicek)
- Added
-
0.20.202 Oct 2023Release notes
Open source →- Fixed key matching algorithm incorrectly not checking all keys if a 0 or a NaN is present (thanks to @AlexDochioiu)
-
0.20.129 Aug 2023 -
0.20.025 Jul 2023Release notes
Open source →- Breaking:
keyscomparison has changed under the following conditions:- Change from
double.nantodouble.nanpreserves the state. - Change from
0.0to-0.0or vice versa does NOT preserve the state.
- Change from
- Added
useOnStreamChange(thanks to @jezsung)
- Breaking:
-
0.19.010 Jul 2023Release notes
Open source →- Added
useSearchController(thanks to @snapsl) - Keys on
useCallbackare now optional, to matchuseMemoized(thanks to @jezsung) - Update
usePlatformBrightnessto stop relying on deprecated code
- Added
-
0.18.619 Feb 2023Release notes
Open source →- Added korean translation (thanks to @sejun2)
- Add
useFocusScopeNodehook (thanks to @iamsahilsonawane)
-
0.18.517 Jun 2022Release notes
Open source →- Added
useListenableSelector, similar touseListenable, for listening to aListenablebut rebuilding the widget only if a certain data has changed (thanks to @ronnieeeeee) - Added
useAutomaticKeepAlive(thanks to @DevNico) - Added
usePlatformBrightnessanduseOnPlatformBrightnessChangeto interact with platformBrightness(thanks to @AhmedLSayed9)
- Added
-
0.18.5+124 Jun 2022 -
0.18.412 May 2022 -
0.18.307 Apr 2022 -
0.18.229 Dec 2021 -
0.18.2+106 Feb 2022 -
0.18.110 Nov 2021Release notes
Open source →- Added
useTransformationController, to create aTransformationController(thanks to @shrouxm) - Added
useAppLifecycleStateanduseOnAppLifecycleStateChangeto interact withAppLifecycleState(thanks to @francipvb)
- Added
-
0.18.030 Jun 2021Release notes
Open source →-
Breaking:
useRefnow receive an initial value as parameter. To migrate, you can change:ObjectRef<int> ref = useRef<int>();to:
ObjectRef<int?> ref = useRef<int?>(null); -
Updated
useStream/useFutureto match the behavior ofStreamBuilder/FutureBuilderregarding initial values. -
Added a
reverseDurationparameter touseAnimationController
-
-
0.17.013 May 2021Release notes
Open source →useFuture/useStream'sAsynsSnapshotnow correctly expose the StackTrace when there is an error.- added
useRefanduseCallback, similar to the React equivalents. initialDataofuseStreamanduseFutureis now optional.
-
0.16.017 Feb 2021 -
0.16.0-nullsafety.027 Jan 2021 pre-releaseRelease notes
Open source →Migrated flutter_hooks to null-safety (special thanks to @DevNico for the help!)
-
0.15.020 Nov 2020 -
0.14.129 Sep 2020Release notes
Open source →-
Increased the minimum version of the Flutter SDK required to match changes on
useFocusNodeThe minimum required is now 1.20.0 (the stable channel is at 1.20.4)
-
-
0.14.006 Sep 2020Release notes
Open source →- added all
FocusNodeparameters touseFocusNode - Fixed a bug where on hot-reload, a
HookWidgetcould potentially not rebuild - Allow hooks to integrate with the devtool using the
DiagnosticableAPI, and implement it for all built-in hooks.
- added all
-
0.13.222 Aug 2020Nothing published for this version
-
0.13.112 Aug 2020 -
0.13.003 Aug 2020Release notes
Open source →- Added
useIsMountedto determine whether a widget was destroyed or not (thanks to @davidmartos96)
- Added
-
0.12.013 Jul 2020Release notes
Open source →- Added
useScrollControllerto create aScrollController - added
useTabControllerto create aTabController(thanks to @Albert221)
- Added
-
0.11.004 Jul 2020Release notes
Open source →Breaking change:
- Removed
HookState.didBuild. If you still need it, useaddPostFrameCallbackorFuture.microtask.
Non-breaking changes:
-
Fix a bug where the order in which hooks are disposed is incorrect.
-
It is now allowed to rebuild a
HookWidgetwith more/less hooks than previously. Example:Widget build(context) { useSomething(); if (condition) { return Container(); } useSomething() return Container(); } -
Deprecated
Hook.usein favor of a new short-handuse. Before:Hook.use(MyHook());After:
use(MyHook());
- Removed
-
0.10.023 Jun 2020Release notes
Open source →Breaking change:
-
The order in which hooks are disposed has been reversed.
Consider:
useSomething(); useSomethingElse();Before, the
useSomethingwas disposed beforeuseSomethingElse. Now,useSomethingElseis disposed before theuseSomething.The reason for this change is for cases like:
// Creates an AnimationController final animationController = useAnimationController(); // Immediately listen to the AnimationController useListenable(animationController);Before, when the widget was disposed, this caused an exception as
useListenableunsubscribed to theAnimationControllerafter itsdisposemethod was called.
Non-breaking changes:
- Added a way for hooks to potentially abort a widget rebuild.
- Added
StatefulHookWidget, aStatefulWidgetthat can use hooks inside itsbuildmethod.
-
-
0.10.0-dev+112 Jun 2020 pre-releaseNothing published for this version
-
0.10.0-dev+220 Jun 2020 pre-releaseNothing published for this version
-
0.9.011 Apr 2020 -
0.8.021 Feb 2020 -
0.8.0+131 Mar 2020 -
0.7.009 Nov 2019 -
0.6.108 Oct 2019 -
0.6.010 Jul 2019 -
0.5.013 May 2019Nothing published for this version
-
0.4.002 May 2019Release notes
Open source →- Make hooks compatible with newer flutter version. (see https://groups.google.com/forum/#!topic/flutter-announce/hp1RNIgej38)
-
0.3.1-dev10 Apr 2019 pre-releaseNothing published for this version
-
0.3.020 Apr 2019Release notes
Open source →- NEW:
usePrevious, a hook that returns the previous argument is received. - NEW: it is now impossible to call
inheritFromWidgetOfExactTypeinsideinitHookof hooks. This forces authors to handle value updates. - FIX: use List<Object> instead of List<dynamic> for keys. This fixes
implicit-dynamicrule mistakenly reporting errors. - NEW: Hooks are now visible on
HookElementthroughdebugHooksin development, for testing purposes. - NEW: If a widget throws on the first build or after a hot-reload, next rebuilds can still add/edit hooks until one
buildfinishes entirely. - NEW: new life-cycle available on
HookState:didBuild. This life-cycle is called synchronously right afterbuildmethod ofHookWidgetfinished. - NEW: new
reassemblelife-cycle onHookState. It is equivalent toState.reassembleof statefulwidgets. - NEW:
useStreamanduseFuturenow have an optionalpreserveStateflag. This toggle how these hooks behave when changing the stream/future: If true (default) they keep the previous value, else they reset to initialState.
- NEW:
-
0.3.0-dev.419 Feb 2019 pre-releaseNothing published for this version
-
0.3.0-dev.304 Feb 2019 pre-releaseNothing published for this version
-
0.3.0-dev.203 Feb 2019 pre-releaseNothing published for this version
-
0.3.0-dev.101 Feb 2019 pre-releaseNothing published for this version
-
0.3.0-dev01 Feb 2019 pre-releaseNothing published for this version
-
0.2.106 Jan 2019Release notes
Open source →- NEW:
useValueNotifier, which creates aValueNotifiersimilarly touseState. But without listening it. This can be useful to have a more granular rebuild when combined touseValueListenable. - NEW:
useContext, which exposes theBuildContextof the currently buildingHookWidget.
- NEW:
-
0.2.028 Dec 2018Release notes
Open source →- Made all existing hooks as static functions, and removed
HookContext. The migration is as followed:
Widget build(HookContext context) { final state = context.useState(0); }becomes:
Widget build(BuildContext context) { final state = useState(0); }- Introduced keys for hooks and applied them to hooks where it makes sense.
- Added
useReducerfor complex state. It is similar touseStatebut is being managed by aReducerand can only be changed by dispatching an action. - fixes a bug where hot-reload without using hooks thrown an exception
- Made all existing hooks as static functions, and removed
-
0.1.024 Dec 2018Release notes
Open source →useMemoizedcallback doesn't take the previous value anymore (to match React API) UseuseValueChangedinstead.- Introduced
useEffectanduseStreamController - fixed a bug where hot-reload while reordering/adding hooks did not work properly
- improved readme
-
0.0.121 Dec 2018Release notes
Open source →Added a few common hooks:
useStreamuseFutureuseAnimationControlleruseSingleTickerProvideruseListenableuseValueListenableuseAnimation
-
0.0.1+124 Dec 2018Nothing published for this version
-
0.0.1+224 Dec 2018Nothing published for this version