Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wasabeef/flutter_use

Play Flutter Hooks.
https://github.com/wasabeef/flutter_use

dart flutter flutter-hooks react-hooks

Last synced: about 2 months ago
JSON representation

Play Flutter Hooks.

Awesome Lists containing this project

README

        


flutter_use







flutter_lints



Inspired by react-use.










flutter pub add flutter_use



- **Sensors**
- [`useBattery`](./docs/useBattery.md) — tracks device battery state. [![battery_plus](https://img.shields.io/badge/required-battery__plus-brightgreen)](https://pub.dev/packages/battery_plus)
- [`useGeolocation`](./docs/useGeolocation.md) — tracks geo location and permission state of user's device. [![geolocator](https://img.shields.io/badge/required-geolocator-brightgreen)](https://pub.dev/packages/geolocator)
- [`useNetworkState`](./docs/useNetworkState.md) — tracks the state of apps network connection. [![connectivity_plus](https://img.shields.io/badge/required-connectivity__plus-brightgreen)](https://pub.dev/packages/connectivity_plus)
- [`useAccelerometer`](./docs/useAccelerometer.md), [`useUserAccelerometer`](./docs/useUserAccelerometer.md), [`useGyroscope`](./docs/useGyroscope.md), and [`useMagnetometer`](./docs/useMagnetometer.md) — tracks accelerometer, gyroscope, and magnetometer sensors state of user's device. [![sensors_plus](https://img.shields.io/badge/required-sensors__plus-brightgreen)](https://pub.dev/packages/sensors_plus)
- [`useOrientation`](./docs/useOrientation.md) — tracks state of device's screen orientation.
- [`useOrientationFn`](./docs/useOrientationFn.md) — calls given function changed screen orientation of user's device.




- **UI**
- [`useAudio`](./docs/useAudio.md) — plays audio and exposes its controls. [![just_audio](https://img.shields.io/badge/required-just__audio-brightgreen)](https://pub.dev/packages/just_audio)
- [`useAssetVideo`](./docs/useAssetVideo.md) and [`useNetworkVideo`](./docs/useNetworkVideo.md) — plays video, tracks its state, and exposes playback controls. [![video_player](https://img.shields.io/badge/required-video__player-brightgreen)](https://pub.dev/packages/video_player)




- **Animations**
- [`useInterval`](./docs/useInterval.md) — re-builds component on a set interval using [`Timer.periodic`](https://api.dart.dev/stable/2.14.4/dart-async/Timer/Timer.periodic.html). [![][img-demo]](https://dartpad.dev/?id=d4ce8c315a0157ad18257886d661c8b9&null_safety=true)
- [`useTimeout`](./docs/useTimeout.md) — re-builds component after a timeout. [![][img-demo]](https://dartpad.dev/?id=e1cb8d7045982ec96b0b314e9fb58202&null_safety=true)
- [`useTimeoutFn`](./docs/useTimeoutFn.md) — calls given function after a timeout. [![][img-demo]](https://dartpad.dev/?id=12449436914e1dec13c8f9c5cf63935b&null_safety=true)
- [`useUpdate`](./docs/useUpdate.md) — returns a callback, which re-builds component when called. [![][img-demo]](https://dartpad.dev/?id=27a74d481219749f532776a8e73f3464&null_safety=true)




- **Side-effects**
- [`useFutureRetry`](./docs/useFutureRetry.md) — [`useFuture`](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useFuture.html) with an additional retry method. [![][img-demo]](https://dartpad.dev/?id=ab910cc4170f5e8746229cc958ba845c&null_safety=true)
- [`useDebounce`](./docs/useDebounce.md) — debounces a function. [![][img-demo]](https://dartpad.dev/?id=977ee00fc30da8f0dd1888f6808114eb&null_safety=true)
- [`useError`](./docs/useError.md) — error dispatcher. [![][img-demo]](https://dartpad.dev/?id=8e8e4876d546dd38517cb833ee694359&null_safety=true)
- [`useException`](./docs/useException.md) — exception dispatcher. [![][img-demo]](https://dartpad.dev/?id=98580d1987dcae38ea0f27ee67a0d089&null_safety=true)




- **Lifecycles**
- [`useEffectOnce`](./docs/useEffectOnce.md) — a modified [`useEffect`](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useEffect.html) hook that only runs once. [![][img-demo]](https://dartpad.dev/?id=adec4d3a92f52bc8a40dc55ff330d2ab&null_safety=true)
- [`useLifecycles`](./docs/useLifecycles.md) — calls `mount` and `unmount` callbacks.
- [`useLogger`](./docs/useLogger.md) — logs in console as component goes through life-cycles. [![][img-demo]](https://dartpad.dev/?id=c72c9ab0fa46f93dd266f6557a29a3ed&null_safety=true)
- [`useMount`](./docs/useMount.md) — calls `mount` callbacks. [![][img-demo]](https://dartpad.dev/?id=aa25e9bc3913779fcc795bef2bdc8d39&null_safety=true)
- [`useUnmount`](./docs/useUnmount.md) — calls `unmount` callbacks. [![][img-demo]](https://dartpad.dev/?id=aa25e9bc3913779fcc795bef2bdc8d39&null_safety=true)
- [`useUpdateEffect`](./docs/useUpdateEffect.md) — run an `effect` only on updates. [![][img-demo]](https://dartpad.dev/?id=724fee007fe78419fde61f185b83095b&null_safety=true)
- [`useCustomCompareEffect`](./docs/useCustomCompareEffect.md) — run an `effect` depending on deep comparison of its dependencies. [![][img-demo]](https://dartpad.dev/?id=27146b5ca9189664e39ad4dfe9b08abe&null_safety=true)




- **State**
- [`useDefault`](./docs/useDefault.md) — returns the default value when state is `null`. [![][img-demo]](https://dartpad.dev/?id=6511219165b2e5c64ec8890b69633da6&null_safety=true)
- [`useLatest`](./docs/useLatest.md) — returns the latest state or props. [![][img-demo]](https://dartpad.dev/?id=2a76f5b16c2f27d11c023a140f38ce33&null_safety=true)
- [`usePreviousDistinct`](./docs/usePreviousDistinct.md) — like [`usePrevious`](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/usePrevious.html) but with a predicate to determine if `previous` should update. [![][img-demo]](https://dartpad.dev/?id=86e0e29f8198095dbd0d68a736c671bb&null_safety=true)
- [`useStateList`](./docs/useStateList.md) — circularly iterates over an array. [![][img-demo]](https://dartpad.dev/?id=5761442418062838b04cbe21a36be586&null_safety=true)
- [`useToggle` and `useBoolean`](./docs/useToggle.md) — tracks state of a boolean. [![][img-demo]](https://dartpad.dev/?id=7e070264db2566b3c990c403dd61c3ff&null_safety=true)
- [`useCounter` and `useNumber`](./docs/useCounter.md) — tracks state of a number. [![][img-demo]](https://dartpad.dev/?id=5ee82acd2f1947b2d0ca02da4ab327b8&null_safety=true)
- [`useList`](./docs/useList.md) — tracks state of an array. [![][img-demo]](https://dartpad.dev/?id=e04b584b8ab67492a1024ea7dd9adcbb&null_safety=true)
- [`useMap`](./docs/useMap.md) — tracks state of a map. [![][img-demo]](https://dartpad.dev/?id=325b4737e78d40463fc0f3d3cc317b35&null_safety=true)
- [`useSet`](./docs/useSet.md) — tracks state of a Set. [![][img-demo]](https://dartpad.dev/?id=3d1199828a54b19c526a26a6c0021293&null_safety=true)
- [`useTextFormValidator`](./docs/useTextFormValidator.md) — tracks state of an object. [![][img-demo]](https://dartpad.dev/?id=23dee1c153a8a9e455d463584537256e&null_safety=true)
- [`useFirstMountState`](./docs/useFirstMountState.md) — check if current build is first. [![][img-demo]](https://dartpad.dev/?id=c9b6853d726ae29dcf902efcf7e85dc6&null_safety=true)
- [`useBuildsCount`](./docs/useBuildsCount.md) — count component builds. [![][img-demo]](https://dartpad.dev/?id=d54979d95910abd48054547202e20c12&null_safety=true)




- TBD



- `useCopyToClipboard` — copies text to clipboard.
- `useEvent` — subscribe to events.
- `useScroll` — tracks a widget's scroll position.
- `useScrolling` — tracks whether widget is scrolling.
- `useFullscreen` — display an element or video full-screen.
- `useClickAway`— triggers callback when user clicks outside target area.
- `usePageLeave` — triggers when mouse leaves page boundaries.
- `usePermission` — query permission status for apps APIs.
- `useMethods` — neat alternative to `useReducer`.
- `useSetState` — creates `setState` method which works like `this.setState`.
- `usePromise` — resolves promise only while component is mounted.
- `useObservable` — tracks latest value of an `Observable`.
- `useThrottle` and `useThrottleFn` — throttles a function.







Unlicense — public domain.




[img-demo]: https://img.shields.io/badge/demo-%20%20%20%F0%9F%9A%80-green.svg