package:fluiver, Flutter SDK gap-fillers; check before hand-rolling. Use when a grid sits in a ListView/Column (not shrinkWrap GridView), the keyboard covers a sheet/form/input bar, a screen without AppBar needs status-bar colour/icons, outside taps should unfocus, taps/search/autosave need debounce/throttle, a stale async response could overwrite a newer one, a widget ticks per frame, an expanding tile must stay in view; or for an LRU cache, bulk dispose, enum byNameOrNull, intersperse, slid...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Fluiver Usage?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/esenmx-fluiver-usage)
---
name: fluiver-usage
description: package:fluiver, Flutter SDK gap-fillers; check before hand-rolling. Use when a grid sits in a ListView/Column (not shrinkWrap GridView), the keyboard covers a sheet/form/input bar, a screen without AppBar needs status-bar colour/icons, outside taps should unfocus, taps/search/autosave need debounce/throttle, a stale async response could overwrite a newer one, a widget ticks per frame, an expanding tile must stay in view; or for an LRU cache, bulk dispose, enum byNameOrNull, intersperse, sliding windows, Map filters, isToday/age, Color darker/lighter/contrast, scroll-to-top, timeoutOrNull, caret-safe setText, platformDispatch, connectivity probe, fast hash.
---
# fluiver-usage
`import 'package:fluiver/fluiver.dart';` No overlap with `package:collection`, `package:async`, `flutter_hooks`; prefer those first.
## Widgets
- `Grid(gridDelegate:, children:)`, `Grid.count(crossAxisCount:)`, `Grid.extent(maxCrossAxisExtent:)`: `GridView` layout as one `RenderBox`, inline in `ListView`/`Column` at `Column` cost. Replaces `GridView(shrinkWrap: true)` + `NeverScrollableScrollPhysics` (no viewport or per-cell wrappers; intrinsics/dry layout work). Builds every cell: grid that scrolls itself or needs lazy building -> `GridView`/`SliverGrid`. All ctors take `direction:`, `padding:`. `ArgumentError`: `.count`/`.extent` non-positive count/ratio/max extent, negative/non-finite spacing/`mainAxisExtent`; negative `padding` (on build). Unbounded cross axis (vertical `Grid` in a `Row`) -> `FlutterError`. Bounded overflow clips (debug: striped indicator).
- `TickerBuilder(builder: (context, Duration elapsed, Widget? child) => ..., child:, onTick:, enabled:)`: rebuilds per frame; static subtree in `child:` (built once, passed back like `AnimatedBuilder`). `elapsed` = running time since first frame (`enabled: false` time excluded; ancestor `TickerMode` mute counts). `onTick` for per-frame side effects. `enabled: false` stops frames, freezes `elapsed` (finished countdowns). Don't wrap in `AnimatedBuilder`.
- `ScrollTrackingExpandable(isExpanded:, child:, duration:, curve:, scrollOffset:)`: expanding keeps the growing bottom edge visible in the nearest `Scrollable`; collapse never scrolls; collapsed child offstage (unfocusable, out of semantics, tickers muted). Prefer over `AnimatedSize`/`ExpansionTile` low in scrollables. Negative `duration` -> `ArgumentError` on build.
- `UnfocusOnTapOutside(child:, enabled:)`: unfocuses text fields on outside touch tap-up. Unlike a `GestureDetector` it never swallows taps, adds no screen-wide semantics button, and ignores scroll/drag/cancelled swipe, long press (>= `kLongPressTimeout`) and a touch that stops a fling/`animateTo`. Wrap `MaterialApp`/`CupertinoApp` (covers routes, dialogs, sheets) or one form; nested `enabled: false` opts a subtree out. Buttons that keep the keyboard open (chat Send) go in `TextFieldTapRegion`; fields can still override `onTapOutside`/`onTapUpOutside`. Independent of `ScrollViewKeyboardDismissBehavior.onDrag`.
## Insets (keyboard, status bar, home indicator)
- `ViewInsetsPadding(child:)`: pads by unconsumed keyboard insets, removes them below; pads 0 in a resizing `Scaffold` body, `Dialog`, or nested. Use for modal sheet content (`showModalBottomSheet(isScrollControlled: true, builder: (_) => ViewInsetsPadding(child: SafeArea(top: false, child: form)))`; without `isScrollControlled` the sheet caps at 9/16 of the screen and a taller form overflows, reported only in debug), a `Scaffold(resizeToAvoidBottomInset: false)` body, an input bar `bottomNavigationBar: ViewInsetsPadding(child: bar)` (+ `extendBody: true` to scroll behind). Not in a resizing `Scaffold`'s `bottomSheet` (already lifted, pads twice), nor a `resizeToAvoidBottomInset: false` body above a `bottomNavigationBar` (pads bar height twice; add `extendBody: true` with `SafeArea` inside, or let it resize). `SafeArea(maintainBottomViewPadding: true)` goes inside it. `StateError` without `MediaQuery`.
- Never `Padding(bottom: MediaQuery.viewInsetsOf(context).bottom)` with the context that builds the `Scaffold` (double gap), never `viewInsets + viewPadding` (34px gap).
- `StatusBarHeader(color:, child:)`: header without `AppBar`. Opaque `color` behind the status bar, fills parent width, `child` below status bar and side cutouts, icons contrast `color` (iOS + Android). First in a `Column` of an `appBar`-less `Scaffold` body, or first sliver via `SliverToBoxAdapter` (preferred: a `ListView` below it in a `Column` still pads the status bar). `StateError` under `SafeArea`/`AppBar`, in `ListView`/modal sheet, or without `MediaQuery`; `FlutterError` at unbounded width (`Row` without `Expanded`); `ArgumentError` if translucent (gradient/image: `AnnotatedRegion` + `DecoratedBox` + `SafeArea(bottom: false)`).
- `StatusBarIcons.light`/`.dark`: light/dark status icons on both platforms, = M3 `AppBar` default, nav bar untouched. For `AppBar(systemOverlayStyle:)` and `AnnotatedRegion(value:)` (page root without `AppBar`, hero). Not `SystemUiOverlayStyle.light`/`.dark` (black Android nav bar, light nav icons), not `statusBarIconBrightness` alone (iOS reads `statusBarBrightness`, the background).
## Debounce / Throttle
`Debounce`, `ThrottleFirst`, `ThrottleLast`, `ThrottleLatest` take a `Duration` (negative -> `ArgumentError`), are callable (`d(() => ...)`), and throw `StateError` on a call or `dispose()` after `dispose()`. Own them in the widget, never a notifier (a `HookWidget` debouncing a value: `flutter_hooks`' `useDebounced`). `Debounce`/`ThrottleLast`/`ThrottleLatest` (not `ThrottleFirst`) also have `flush()` (runs the pending task now; no-op if none), `cancel()` (drops it), `isPending`. `dispose()` drops a waiting task: `d..flush()..dispose()` when the last call must run (autosave, scroll save).
|Variant|Fires|
|-|-|
|`Debounce`|after calls stop (autosave; search-as-you-type only with `LatestOnly`)|
|`ThrottleFirst`|first call wins, drops rest (submit/nav anti rage-click)|
|`ThrottleLast`|drops intermediates, keeps last (scroll save, slider end)|
|`ThrottleLatest`|first call immediately, then latest per window end (live preview)|
`LatestOnly()`: for any request re-triggerable before it answers (search-as-you-type, filter, refresh); debounce alone still lets a slow old response overwrite a newer one. `final hits = await latest(() => api.search(q)); if (hits != null) setState(...)`. `null` = superseded or `latest.dispose()` ran (call it in `State.dispose`; no stale `setState`). Stale errors are dropped, the newest call's error throws: `try`/`catch` inside the debounced closure (else unhandled). Non-nullable results only; the work itself is not cancelled; a call after `dispose()` -> `StateError`. Never hand-roll a call counter.
## Listeners (outside widgets)
`LocaleListener`, `BrightnessListener`: for providers/services without a `BuildContext` (in widgets: `flutter_hooks`' `useOnPlatformBrightnessChange`; no locale hook, use `WidgetsBindingObserver`). Register on construction like `AppLifecycleListener`; `dispose()` stops (second call -> `StateError`). Seed from the platform dispatcher:
```dart @example /test/doc/skill.dart#locale-listener
final locales = ValueNotifier<List<Locale>?>(
WidgetsBinding.instance.platformDispatcher.locales,
);
final listener = LocaleListener((next) => locales.value = next);
// Riverpod: `state = next` in build(), ref.onDispose(listener.dispose).
```
## Extensions
- **DateTime**: getters `isToday`, `isTomorrow`, `isYesterday`, `inThisYear`, `dateOnly` (midnight, keeps UTC unlike `DateUtils.dateOnly`); `isWithinFromNow(Duration)` (negative -> `ArgumentError`); `age({at})` (full years from stored calendar fields, no TZ conversion; `at` defaults to local now; `.toLocal()` UTC-stored local dates first). No arithmetic helpers: calendar days via `d.copyWith(day: d.day + n)` (keeps UTC), not `add(Duration(days: n))` (n x 24h, hour shifts across DST); `copyWith(month: m + 1)` overflows (Jan 31 -> Mar 3).
- **TimeOfDay**: `tod.onDate(date)` -> `DateTime` on that day (`TimeOfDay` from `package:material_ui/material_ui.dart`). Pass the day explicitly for deterministic tests.
- **Enum**: `with EnumIndexComparable<MyEnum>` adds `<`/`<=`/`>`/`>=`/`compareTo` by index. `MyEnum.values.byNameOrNull(name)` -> nullable for untrusted input (SDK `byName` throws; no `asNameMap()` allocation); chain `?? .fallback`.
- **Iterable**: `intersperse((i) => sep)` (`i` = separator index, 0 between the first two; `collection` has none); `slidingWindows(size, {step})` (Kotlin `windowed`; **drops a partial trailing window**; `collection.slices` is non-overlapping); `size`/`step` < 1 -> `RangeError`.
- **Map**: `where((k, v) => ...)` -> `Map`; `whereKeyType<T>()`, `whereValueType<T>()` (narrowed static type); `entryOf(key)` -> `MapEntry?`, null **only when absent** (present-with-null != missing).
- **Object.into** (`T extends Object`, Kotlin `let`): transform and return; `?.into(...)` null-aware (`env['PORT']?.into(int.parse)`). Skip for side effects, multi-line bodies, chains > 3.
- **Color** (HSL): `darker([amount])`, `lighter([amount])` (lightness fraction, not percent; default 0.1; `RangeError` outside `[0, 1]`); getter `contrastText` (higher-contrast black/white). All three: `ArgumentError` if any channel is outside `[0, 1]` (gamut-map extended sRGB first).
- **ScrollController**: getters `atTop`, `atBottom` (every attached view at the edge); `animateToTop({duration, curve})`, `animateToBottom(...)` (`ArgumentError` unless `duration` > 0). All throw `StateError` when unattached (check `hasClients`).
- **Future**: `timeoutOrNull(Duration)` -> `Future<T?>`, null on timeout **only** (errors still throw); non-nullable `Future<T>` only; negative -> `ArgumentError`.
- **TextEditingController**: `setTextAndCaret(text, {caret})` sets text + a valid caret, focused or not (`.text =` leaves offset -1: focused fields jump to the end on mobile/multiline or select all on single-line desktop); `caret` outside `0..text.length` -> `RangeError`.
## Helpers
|API|Contract|
|-|-|
|`FastHash.fnv1a(String)` -> `int`|FNV-1a-64 over UTF-16BE code units (!= UTF-8 FNV-1a). **`UnsupportedError` on JS web**; VM/Wasm fine. Non-cryptographic.|
|`NetworkProbe.checkConnection({host, port, timeout})`|`false` on `SocketException` (incl. connect timeout). Defaults `1.0.0.1:53`, 3s; `host` is a literal IP. Negative `timeout` -> `ArgumentError`. Web -> `UnsupportedError`.|
|`NetworkProbe.isBrowserOnline()`|Web `navigator.onLine` (`false` = known offline); non-web -> `UnsupportedError`.|
|`platformDispatch<T>({android, ios, macos, web, ...})`|Per-platform value (lowercase params); `UnsupportedError` when the current platform's callback is omitted.|
|`TextFieldBuilders.disabledCounter`|`TextField(buildCounter: TextFieldBuilders.disabledCounter)` hides the counter.|
|`LRUCache<K, V>(maxEntries:)`|`maxEntries` <= 0 -> `ArgumentError`. O(1) get/put, promotes to MRU; per isolate. Async: `LRUCache<K, Future<V>>` + `putIfAbsent(key, load)` dedupes concurrent misses. `peek(key)` reads without promoting; `keys`/`values`/`entries` are snapshots.|
|`DisposableBag()`|`..add(fn)`/`..addAll([...])`; `dispose()` runs all once (re-calls return the same future), then throws `DisposableBagException` if any failed; `add` after settle or `dispose()` from its own disposer -> `StateError`. Async disposers start in registration order and are awaited together (dependent steps in one closure). Pair with `ref.onDispose(bag.dispose)`.|