flutter_hooks 0.13.2
flutter_hooks: ^0.13.2 copied to clipboard
A flutter implementation of React hooks. It adds a new kind of widget with enhanced code reuse.
0.13.2 #
- Fixed a bug where on hot-reload, a
HookWidgetcould potentailly not rebuild
0.13.1 #
useIsMountednow returns a function instead of a callable class.
0.13.0 #
- Added
useIsMountedto determine whether a widget was destroyed or not (thanks to @davidmartos96)
0.12.0 #
- Added
useScrollControllerto create aScrollController - added
useTabControllerto create aTabController(thanks to @Albert221)
0.11.0 #
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());
0.10.0 #
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(); // Immediatly 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.9.0 #
- Added a
deactivatelife-cycle toHookState
0.8.0+1 #
- Fixed link to "Existing hooks" in
README.md.
0.8.0: #
Added useFocusNode
0.7.0: #
- Added
useTextEditingController, thanks to simolus3!
0.6.1: #
- Added
useReassemblehook, thanks to @SahandAkbarzadeh
0.6.0: #
- Make hooks compatible with newer flutter stable version 1.7.8-hotfix.2.
0.4.0: #
- Make hooks compatible with newer flutter version. (see https://groups.google.com/forum/#!topic/flutter-announce/hp1RNIgej38)
0.3.0: #
- 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