Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cursorindexingignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Don't index SpecStory auto-save files, but allow explicit context inclusion via @ references
.specstory/**
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ node_modules/
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3

# SpecStory
.specstory/

2 changes: 2 additions & 0 deletions .specstory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SpecStory explanation file
/.what-is-this.md
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
<br />
</div>


<div align="center">
<br />
<pre>flutter pub add <a href="https://pub.dev/packages/flutter_use">flutter_use</a></pre>
<br />
</div>


- **Sensors**
- [`useBattery`](./docs/useBattery.md) &mdash; 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) &mdash; tracks geo location and permission state of user's device. [![geolocator](https://img.shields.io/badge/required-geolocator-brightgreen)](https://pub.dev/packages/geolocator)
Expand Down Expand Up @@ -57,7 +55,7 @@
- [`useLifecycles`](./docs/useLifecycles.md) &mdash; calls `mount` and `unmount` callbacks.
- [`useLogger`](./docs/useLogger.md) &mdash; logs in console as component goes through life-cycles. [![][img-demo]](https://dartpad.dev/?id=c72c9ab0fa46f93dd266f6557a29a3ed&null_safety=true)
- [`useMount`](./docs/useMount.md) &mdash; calls `mount` callbacks. [![][img-demo]](https://dartpad.dev/?id=aa25e9bc3913779fcc795bef2bdc8d39&null_safety=true)
- [`useUnmount`](./docs/useUnmount.md) &mdash; calls `unmount` callbacks. [![][img-demo]](https://dartpad.dev/?id=aa25e9bc3913779fcc795bef2bdc8d39&null_safety=true)
- [`useUnmount`](./docs/useUnmount.md) &mdash; calls `unmount` callbacks. [![][img-demo]](https://dartpad.dev/?id=aa25e9bc3913779fcc795bef2bdc8d39&null_safety=true)
- [`useUpdateEffect`](./docs/useUpdateEffect.md) &mdash; run an `effect` only on updates. [![][img-demo]](https://dartpad.dev/?id=724fee007fe78419fde61f185b83095b&null_safety=true)
- [`useCustomCompareEffect`](./docs/useCustomCompareEffect.md) &mdash; run an `effect` depending on deep comparison of its dependencies. [![][img-demo]](https://dartpad.dev/?id=27146b5ca9189664e39ad4dfe9b08abe&null_safety=true)
<br/>
Expand All @@ -68,7 +66,7 @@
- [`usePreviousDistinct`](./docs/usePreviousDistinct.md) &mdash; 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) &mdash; circularly iterates over an array. [![][img-demo]](https://dartpad.dev/?id=5761442418062838b04cbe21a36be586&null_safety=true)
- [`useToggle` and `useBoolean`](./docs/useToggle.md) &mdash; tracks state of a boolean. [![][img-demo]](https://dartpad.dev/?id=7e070264db2566b3c990c403dd61c3ff&null_safety=true)
- [`useCounter` and `useNumber`](./docs/useCounter.md) &mdash; tracks state of a number. [![][img-demo]](https://dartpad.dev/?id=5ee82acd2f1947b2d0ca02da4ab327b8&null_safety=true)
- [`useCounter` and `useNumber`](./docs/useCounter.md) &mdash; tracks state of a number. [![][img-demo]](https://dartpad.dev/?id=5ee82acd2f1947b2d0ca02da4ab327b8&null_safety=true)
- [`useList`](./docs/useList.md) &mdash; tracks state of an array. [![][img-demo]](https://dartpad.dev/?id=e04b584b8ab67492a1024ea7dd9adcbb&null_safety=true)
- [`useMap`](./docs/useMap.md) &mdash; tracks state of a map. [![][img-demo]](https://dartpad.dev/?id=325b4737e78d40463fc0f3d3cc317b35&null_safety=true)
- [`useSet`](./docs/useSet.md) &mdash; tracks state of a Set. [![][img-demo]](https://dartpad.dev/?id=3d1199828a54b19c526a26a6c0021293&null_safety=true)
Expand All @@ -78,7 +76,7 @@
<br/>
<br/>
- <details><summary><b>TBD</b></summary><div>

- `useCopyToClipboard` &mdash; copies text to clipboard.
- `useEvent` &mdash; subscribe to events.
- `useScroll` &mdash; tracks a widget's scroll position.
Expand All @@ -92,9 +90,8 @@
- `usePromise` &mdash; resolves promise only while component is mounted.
- `useObservable` &mdash; tracks latest value of an `Observable`.
- `useThrottle` and `useThrottleFn` &mdash; throttles a function.

</div></details>

</div></details>

<br />
<br />
Expand All @@ -107,5 +104,4 @@
<br />
<br />


[img-demo]: https://img.shields.io/badge/demo-%20%20%20%F0%9F%9A%80-green.svg
2 changes: 1 addition & 1 deletion docs/useAccelerometer.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depends on [sensors_plus](https://pub.dev/packages/sensors_plus).

```yaml
dependencies:
flutter_use_sensors: ^0.0.2
flutter_use_sensors:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useAssetVideo.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depends on [video_player](https://pub.dev/packages/video_player).

```yaml
dependencies:
flutter_use_video: ^0.0.2
flutter_use_video:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useAudio.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depends on [just_audio](https://pub.dev/packages/just_audio).

```yaml
dependencies:
flutter_use_audio: ^0.0.2
flutter_use_audio:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useBattery.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depends on [battery_plus](https://pub.dev/packages/battery_plus).

```yaml
dependencies:
flutter_use_battery: ^0.0.2
flutter_use_battery:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useBuildsCount.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tracks component's builds count including the first build.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useCounter.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Flutter state hook that tracks a numeric value.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
3 changes: 1 addition & 2 deletions docs/useCustomCompareEffect.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ A modified useEffect hook that accepts a comparator which is used for comparison

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
collection: # If you use DeepCollectionEquality.
```

## Usage

[![](https://img.shields.io/badge/demo-%20%20%20%F0%9F%9A%80-green.svg)](https://dartpad.dev/?id=27146b5ca9189664e39ad4dfe9b08abe&null_safety=true)
Expand Down
2 changes: 1 addition & 1 deletion docs/useDebounce.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The third argument is the array of values that the debounce depends on, in the s

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useDefault.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flutter state hook that returns the default value when state is null or undefine

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useEffectOnce.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flutter lifecycle hook that runs an effect only once.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useError.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flutter side-effect hook that returns an error dispatcher.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useException.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flutter side-effect hook that returns an exception dispatcher.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useFirstMountState.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Returns `true` if component is just mounted (on first build) and `false` otherwi

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useFutureRetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Uses `useFuture` with an additional retry method to easily retry/refresh the fut

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useGeolocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depends on [geolocator](https://pub.dev/packages/geolocator).

```yaml
dependencies:
flutter_use_geolocation: ^0.0.2
flutter_use_geolocation:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useGyroscope.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depends on [sensors_plus](https://pub.dev/packages/sensors_plus).

```yaml
dependencies:
flutter_use_sensors: ^0.0.2
flutter_use_sensors:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useInterval.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A declarative interval hook based on [Dan Abramov's article on overreacted.io](h

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useLatest.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This is mostly useful to get access to the latest value of some props or state i

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useLifecycles.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ If you want to use hook that app lifecycles, recommended use to flutter_hooks v0

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useList.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ We can ensure that actions object and actions itself will not mutate or change b

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useLogger.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flutter lifecycle hook that console logs parameters as component transitions thr

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useMagnetometer.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depends on [sensors_plus](https://pub.dev/packages/sensors_plus).

```yaml
dependencies:
flutter_use_sensors: ^0.0.2
flutter_use_sensors:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useMap.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flutter state hook that tracks a value of a Map.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useMount.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flutter lifecycle hook that calls a function after the component is mounted. Use

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useNetworkState.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depends on [connectivity_plus](https://pub.dev/packages/connectivity_plus).

```yaml
dependencies:
flutter_use_network_state: ^0.0.2
flutter_use_network_state:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useNetworkVideo.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depends on [video_player](https://pub.dev/packages/video_player).

```yaml
dependencies:
flutter_use_video: ^0.0.2
flutter_use_video:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useOrientation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tracks screen orientation of user's device.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useOrientationFn.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Calls given function changed screen orientation of user's device.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/usePreviousDistinct.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Just like `usePrevious` but it will only update once the value actually changes.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useSet.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flutter state hook that tracks a Set.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useStateList.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Supports forward and backward iterations and arbitrary position set.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useTextFormValidator.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Each time given state changes - validator function is invoked.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useTimeout.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Provides handles to cancel and/or reset the timeout.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useTimeoutFn.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Several thing about it's work:

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/useToggle.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Flutter state hook that tracks value of a boolean.

```yaml
dependencies:
flutter_use: ^0.0.2
flutter_use:
```

## Usage
Expand Down
Loading