flutter_use

所属分类:Dart语言编程
开发工具:Dart
文件大小:0KB
下载次数:0
上传日期:2023-08-25 10:10:28
上 传 者sh-1993
说明:  玩Flutter Hooks。,
(Play Flutter Hooks.,)

文件列表:
.editorconfig (188, 2023-08-25)
.husky/ (0, 2023-08-25)
.husky/pre-commit (92, 2023-08-25)
.node-version (7, 2023-08-25)
.prettierignore (38, 2023-08-25)
.tool-versions (14, 2023-08-25)
.vscode/ (0, 2023-08-25)
.vscode/launch.json (1416, 2023-08-25)
LICENSE (1211, 2023-08-25)
analysis_options.yaml (154, 2023-08-25)
art/ (0, 2023-08-25)
art/flutter_use_logo.png (29215, 2023-08-25)
docs/ (0, 2023-08-25)
docs/useAccelerometer.md (913, 2023-08-25)
docs/useAssetVideo.md (661, 2023-08-25)
docs/useAudio.md (578, 2023-08-25)
docs/useBattery.md (1410, 2023-08-25)
docs/useBuildsCount.md (691, 2023-08-25)
docs/useCounter.md (1823, 2023-08-25)
docs/useCustomCompareEffect.md (1343, 2023-08-25)
docs/useDebounce.md (1267, 2023-08-25)
docs/useDefault.md (944, 2023-08-25)
docs/useEffectOnce.md (586, 2023-08-25)
docs/useError.md (787, 2023-08-25)
docs/useException.md (835, 2023-08-25)
docs/useFirstMountState.md (761, 2023-08-25)
docs/useFutureRetry.md (895, 2023-08-25)
docs/useGeolocation.md (2806, 2023-08-25)
docs/useGyroscope.md (847, 2023-08-25)
docs/useInterval.md (1037, 2023-08-25)
docs/useLatest.md (1387, 2023-08-25)
docs/useLifecycles.md (847, 2023-08-25)
docs/useList.md (2025, 2023-08-25)
... ...

flutter_use

flutter_lints
Inspired by react-use.



flutter pub add flutter_use

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

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

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

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

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

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

近期下载者

相关文件


收藏者