Ten kits, one per hard screen: a streaming AI chat, a voice assistant, streaming Markdown, six paywall layouts, an offline sync queue, first-run onboarding, a multi-step form engine, a command palette, a booking calendar and a kanban board. Each is a runnable Flutter app built on the SDK with no third-party packages, with one exception: the AI chat kit pins intl, which Flutter's own localization stack already depends on. Together they carry 1,676 tests, and flutter analyze is clean on Flutter 3.50.0 / Dart 3.14.0.
I did not write this to announce them. I wrote it because the same six things broke in kit after kit, in ways a test written by the person who wrote the bug will never catch, and the fixes are the same every time. If you build any of these screens, these are the parts that will cost you an afternoon.
1. 3.0× text is a layout breakpoint, not a font setting
Every kit has a 320 dp × TextScaler.linear(3.0) case in its suite, tested with a devicePixelRatio of 3 and a fake notch — a 320 dp phone where every character is three times its normal height. At that setting one line of body text takes up most of a row. Layouts that look roomy at 1.0× become a stack of three competing boxes.
The mistake I made first was to size things by device width. Width is not the constraint; the constraint is what a row has left once its text has grown. So the breakpoints in the code are on the scale factor:
final bool stacked = MediaQuery.textScalerOf(context).scale(1) >= 1.45; Above 1.45× the paywall's period toggle and tier cards stop sitting side by side and become a column; below it they stay in a row. 1.45 is not a magic number from a spec — it is the point where the two-column arrangement of a $29.99 price and a "save 40%" chip stops fitting at 320 dp.
Three smaller rules that did most of the work:
- Prices go through a single
FittedBox. A price is the one string you cannot shorten, translate or wrap, so it gets the whole line and scales down instead. - Buttons keep
maxLines: 1and shrink rather than wrap to two lines, which changes their height and shifts everything below them. - The command palette stops pretending to be a desktop sheet. Its footer drops its explanatory text when
constraints.maxWidth < 400, the shortcut chip in each row getsmaxWidth: 88, and the sheet's height is(size.height - 24).clamp(240, maxHeight)— at 320 dp with a keyboard open there is not much sheet left, and a fixed height either overflows or hides the last row under the keyboard.
The test matrix that keeps this honest runs each paywall template at 320 dp × 2.0×, then all six together at 320 dp × 3.0×. The second pass is the one that matters: a single template can scale down its own pieces, but the failures I saw came from two independently fitted widgets competing for the same row.
2. Lowercasing is not a length-preserving operation
Search is where Unicode quietly hands you wrong answers. Two places in the same kanban kit disagreed about the same string, and both were individually reasonable:
// filtering: fold the haystack, search the folded string final String haystack = card.searchableText.toLowerCase(); if (!haystack.contains(needle)) return false; // highlighting: case-insensitive regex over the original string final RegExp pattern = RegExp(RegExp.escape(needle), caseSensitive: false); 'İstanbul release' is the smallest repro I know. 'İ'.toLowerCase() is 'i', so the filter matches the query istanbul and the card appears in the list. The regex engine's case folding is not the same operation, so highlightSpans('İstanbul release') returns []: the card is in the results with no highlighted text at all. Measured on Dart 3.14:
match: true spans: [] The same pair also disagrees the other way: 'Straße fix' does not match the query strasse, because 'ß'.toLowerCase() is still 'ß' and there is no full case folding in String.toLowerCase.
The palette kit dodges half of this by only returning highlight spans when the folded string has the same length as the original:
final bool sameLength = lowerText.length == text.length; ... sameLength ? <MatchSpan>[MatchSpan(boundary, boundary + token.length)] : <MatchSpan>[], That is a guard, not a fix. When folding preserves length it is exact; when it does not, the row renders unhighlighted instead of slicing a span one character past the end of the title. The real fix, which is in the next version, is to fold character by character and keep a map from each folded code unit back to its source index, then merge adjacent spans that land on the same original character. On current Dart, 'İ' happens to fold to a single code unit, so the length guard almost never fires — which is exactly why a bug like this survives until someone ships in a locale where it does.
3. An async answer is only valid for the value it was computed from — and that is not enough
The multi-step form kit validates fields against a server. The obvious guard, and the one everybody writes, is "compare the value when the answer arrives":
final Object? checked = _values[id]; _asyncPending.add(id); try { final String? asyncError = await field.asyncRule!(checked, _values); if (!_sameValue(_values[id], checked)) { // The user typed again while the server was answering; this verdict // belongs to a value that is no longer on screen. return; } That is necessary and insufficient. Three holes:
- A→B→A. Type
B, delete it, retypeAwhile the request forAis still in flight. The answer that comes back is compared againstAand accepted — but it was computed before the intermediate value existed, and for a rule like "this username was free" that is the wrong answer with the right shape. - The rule sees live state.
asyncRuleisFuture<String?> Function(Object? value, Map<String, Object?> values)and it is handed the live_valuesmap. A postal-code rule that looks at the country field computes against today's country, and the result is then stored as if it belonged to whatever the country was when the check started. - The dropped answer is never rescheduled. If a re-check is requested while a request for the same field is pending, the scheduler returns early on
if (_asyncPending.contains(id)) return;— and when the stale answer arrives it is discarded. The field ends up with no verdict at all, which reads as "clean" in the UI.
Comparing values cannot fix this, because equality is exactly the thing that lies. What works is a revision counter: bump a form-level counter on every change, take a number when a check starts, drop the answer if the number moved. That also gives you a place to hang "which fields does this rule depend on" and to re-run a check after the change that invalidated it. That is the 1.1 design; 1.0 ships the comparison and the honest note in the README.
One more trap in the same file, worth a line: Set<String> does not have value equality in Dart, so the "did the value change" helper carries a special case for sets, otherwise every multi-select field would look edited forever.
4. An ordered list needs keys that can always be split — and an index that means what it says
The kanban engine orders cards with fractional keys, not floats: base-62 strings that sort with String.compareTo and can always be split, so dropping a card between two others never rewrites the keys around it.
RankKey.between(null, null); // '0V' the first key RankKey.between('0V', null); // '0W' appended after RankKey.between('0V', '0W'); // '0VV' dropped in between RankKey.between(null, '0V'); // '0F' prepended One rule makes the maths hold: a generated key never ends in 0, because a trailing zero leaves no room below it — between rejects such a key instead of returning something that sorts on the wrong side. Equal or reversed bounds throw rather than guess.
The comment on the class used to promise that "a thousand cards still sort on three characters". I measured it while writing the docs:
appends: 1,000 -> 11 characters ('zzzzzzzzzn') Keys grow about one character every 31 appends at the start, then every 61. Appending a thousand cards to one lane is not a realistic demo, but a bulk import will do it, and it is why the kit exposes RankKey.sequence(n) — a rebalance that rewrites a lane to short keys. It is not scheduled automatically, because a rebalance rewrites the whole lane while undo is recorded per drop.
The more expensive bug was not the keys. It was the drop index.
- The model. A lane's rank order is
a b c d. - The view. The board filters cards; only
bandccarry the active label, so the list on screen is[b, c]. - What the drop slot sends.
xdragged to the bottom of that visible list sends the integer2. - What the engine does. It resolves
2againsta b c dand inserts before the card at index 2, givinga b x c d— visible order[b, x, c].
So the card lands one slot short of where the pointer was. There is no guard: dragging is enabled in every sort mode. The fix is to make the payload the ids of the two neighbouring visible cards instead of an integer, and to refuse same-lane reordering in a sorted view, where "between these two cards" has no rank meaning at all.
5. The wall clock is not the timeline
The booking kit never does arithmetic on a local DateTime. That is not fussiness: a local DateTime is parsed in the device's current zone, which is not the venue's zone, and adding an hour across a DST transition silently gives you an instant an hour away from what the calendar shows.
Instead it works in wall time (WallDate + WallTime, no offset) and converts at the edges:
final int before = offsetMinutesAt(naive.subtract(const Duration(hours: 26))); final int after = offsetMinutesAt(naive.add(const Duration(hours: 26))); // try both candidate offsets, keep the ones that round-trip ... if (valid.isNotEmpty) { valid.sort(); return valid.first; } // inside a gap: the earlier offset puts the reading on the far side return naive.subtract(Duration(minutes: before)); A wall reading that happens twice (clocks going back) resolves to the earlier instant; a reading that never happens (clocks going forward) resolves to the instant just after the gap, and the engine tells the caller it moved. Measured against Europe/London:
| Wall-clock booking | Timeline duration |
|---|---|
| 2026-03-29 00:30 + 90 min | 30 minutes (01:30 does not exist) |
| 2026-10-25 00:30 + 90 min | 150 minutes (01:30 happens twice) |
Which is why the kit keeps two durations apart: the wall duration the customer asks for, and the elapsed time the calendar grid needs. A 90-minute slot that crosses the spring transition occupies 30 minutes of your day and still says 90 minutes on the receipt.
The honest limitation: the built-in table has ten zones and their 2025–2027 transitions, not the IANA database. The seam is offsetMinutesAt, so a production shop plugs the timezone package in there and the rest of the engine does not change.
6. Offline queues: mint the idempotency key at intent time
The sync kit stores an intent per edit, and the idempotency key is generated when the intent is created — not when the request goes out — then persisted with it. That is what makes a retry after a timeout safe: the same key, the same payload, the server replays the stored result instead of creating a second record.
Which forces the second rule: only an intent that has never been sent may be merged.
// Only an operation that has never been sent may be merged. Mutating an // operation that already reached the server would reuse an idempotency key // with a different payload. final int index = _operations.lastIndexWhere( (SyncOperation op) => op.entity == entity && op.entityId == resolvedId && op.status == SyncOpStatus.pending && op.attempts == 0, ); Typing in a field that is already queued collapses into the queued intent; typing after a failed send does not, because the server may have seen the first payload. Deletes follow the same hierarchy: a delete that lands on a never-sent create cancels it, a delete that lands on a never-sent update replaces it, and a delete that lands behind an in-flight update waits for it.
The part that took two attempts is version passing. When the server acknowledges a write, its new version is adopted by the later, never-sent operations on the same entity, so a delete no longer reports a conflict for a record the user just deleted. Operations that have already been attempted keep their original base version, so real conflicts still surface.
And the limit: save() writes the whole persisted state in one call, which lets an app put it in the same transaction as its own row — but the kit cannot enforce that, and its in-memory demo store means the tests cannot catch the version where you write the two separately. That is a README warning, not an assertion.
7. Streaming UI has two states that look like one
The Markdown kit distinguishes incomplete from isStreaming, and it has to:
-
incompleteis a property of the parse: an unclosed code fence yields a code block marked incomplete instead of a paragraph that eats the rest of the message. -
isStreamingis a property of the transport: bytes are still arriving.
Conflate them and you get a "Streaming" label that stays on screen after the user presses stop, because the block is still incomplete but nothing is streaming. The label belongs to the transport; the block rendering belongs to the parse.
The typewriter has a related conflict. It reveals text at roughly reading speed, but if the backlog would take longer than 0.9 seconds it speeds up:
final double rate = backlogSeconds > maxBacklogSeconds ? remaining / maxBacklogSeconds : charsPerSecond; That is right for reading and wrong for speech: if the same text is also being spoken by a TTS engine, accelerating makes the screen run ahead of the audio. The controller is driven by its own Ticker only, with no pause, resume or external clock — so the fix is either gating input by TTS boundaries or adding a syncTo(Duration) position hook, not another parameter on the ticker.
In the voice kit the same "two states" problem appears in the transcript. Speech recognition emits partial results, and appending each one gives you a transcript of half-sentences. The transcript upserts instead: if the last utterance has the same role and is still partial, replace it; otherwise append. Cheap, and it removes a whole class of duplicates.
8. What zero dependencies bought, and what it cost
Ten kits with no third-party packages means no abandoned plugin, no major-version bump, no transitive package in your supply chain, and suites that finish in seconds rather than minutes. It also means writing the parts you'd otherwise import: a Markdown parser for a streaming subset, a small time-zone table behind a seam, the paywall's price formatting on integer minor units.
The design that makes it usable is the seam. Every kit that needs a backend exposes exactly one interface — StreamTransport for Markdown, SyncTransport for the queue, PaywallRepository for purchases, onSend for the chat kit, offsetMinutesAt for time zones — and the UI does not change when you point it at your own endpoint. The demos make no network calls and need no keys, which is the only reason a test suite can cover them honestly.
| # | Kit | Tests | The hard part |
|---|---|---|---|
| 01 | AI Starter Kit | 31 | streaming chat + the paywall behind it, one controller |
| 02 | VoiceMode Kit | 70 | full-screen voice states, barge-in, partial transcripts |
| 03 | StreamKit | 81 | streaming Markdown that does not jump |
| 04 | PaywallFlow Kit | 177 | six paywall layouts, one purchase state machine |
| 05 | SyncSpool Kit | 104 | offline queue that survives restarts |
| 06 | FirstRun Kit | 179 | onboarding, permission priming, spotlight tour |
| 07 | FormCraft Kit | 282 | multi-step forms, async validation, draft resume |
| 08 | PaletteKit | 192 | fuzzy ranking and highlighting over Unicode |
| 09 | SlotForge Kit | 271 | booking slots across DST |
| 10 | BoardForge Kit | 289 | fractional ordering, atomic moves, batch undo |
1,676 tests between them, none of them golden-file tests: every one drives a real widget tree or a real engine object and asserts behaviour.
The ten kits
All ten are on GitHub as public showcase repositories — README, screenshots and the full feature tour, no source:
- AI Starter Kit — https://github.com/StephenColor/flutter-ai-starter-kit
- VoiceMode Kit — https://github.com/StephenColor/flutter-voice-mode-kit
- StreamKit — https://github.com/StephenColor/flutter-streaming-markdown-kit
- PaywallFlow Kit — https://github.com/StephenColor/flutter-paywall-flow-kit
- SyncSpool Kit — https://github.com/StephenColor/flutter-syncspool-kit
- FirstRun Kit https://github.com/StephenColor/flutter-firstrun-kit
- FormCraft Kit — https://github.com/StephenColor/flutter-formcraft-kit
- PaletteKit — https://github.com/StephenColor/flutter-palette-kit
- SlotForge Kit — https://github.com/StephenColor/flutter-slotforge-kit
- BoardForge Kit — https://github.com/StephenColor/flutter-boardforge-kit
The source ships on Gumroad: each kit is $2.90, and the ten together are $14.90 as a single download with one licence file per kit — Flutter Production Suite. Individual kits: AI Starter, VoiceMode, StreamKit, PaywallFlow, SyncSpool, FirstRun, FormCraft, PaletteKit, SlotForge, BoardForge.
If you only take one thing from this: the bugs above were all found by tests at 320 dp and 3.0× text, or by writing the probe that measured the assumption in the comment. Neither is in the default widget test.

