bereke1t2/kelal-studio/flutter-state-management
Claude Code and agent skill by bereke1t2/kelal-studio
- community
Checking that the SKILL.md file is still in the repository.
Bloc vs Cubit selection and bloc_concurrency event-transformer rules for the Kelal Studio Flutter app, aimed squarely at preventing race conditions (double-submit, stale async results, out-of-order writes). Use whenever adding a new Bloc/Cubit, a new event handler, or touching anything that fires an async operation from user input.
Install
npx vskill@latest install bereke1t2/kelal-studio/flutter-state-managementSKILL.md
The same SKILL.md was published earlier as bereke1t2/kelal-studio/flutter-state-management.
Flutter State Management
Bloc vs Cubit
- Cubit: trivial, direct-method-call UI state with no meaningful
"event" semantics — a text field's obscure/reveal toggle, an expanded/collapsed flag. No bloc_concurrency concerns because there's nothing async to race.
- Bloc: anything that calls a use case, i.e. anything that touches
domain/. Default to Bloc for feature logic; reach for Cubit only when you're confident there's no async operation to sequence.
Don't use Cubit "because it's less boilerplate" for something that fires a network call — that's exactly the case bloc_concurrency exists for, and Cubit doesn't have an equivalent transformer mechanism.
bloc_concurrency — pick one deliberately for every on<Event> handler
The default transformer (concurrent(), i.e. no transformer: argument) runs every incoming event's handler in parallel with no ordering guarantee. Never leave a handler on this default without having consciously ruled out a race — that's the single most common way this codebase would grow a real bug that only shows up under load or on a slow network, not in a quick manual test.
| Transformer | Use for | Why | |
|---|---|---|---|
droppable() | Submit-style actions: login, generate text/image/video, export, any quota-consuming call | Ignores new events while one's in flight — the structural fix for "double-tap submits twice" and (for generation calls specifically) for double-charging a scarce, per-user quota (PRD §6.14 treats quota as a financial control, not a UX nicety). | |
restartable() | Live-recompute actions: canvas preview updates as a slider/drag moves, search-as-you-type | Cancels the in-flight handler and starts over on the newest event — only the latest input matters, and you don't want three stale preview repaints landing out of order after the user has moved on. Pairs with core/render_engine's decode-once/repaint-many strategy: the recompute is cheap repaint, not image redecode, so restarting it is cheap. | |
sequential() | Ordered local writes: draft autosave, any sequence of local-storage mutations that must apply in the order they were issued | Guarantees one event fully completes before the next starts, in order — never concurrent() for anything writing to drift/secure storage, or two near-simultaneous autosaves can interleave and corrupt state. | |
concurrent() (explicit) | Truly independent, order-doesn't-matter events (rare) | Only use this by writing transformer: concurrent() explicitly, so it's visibly a decision in code review — not by omitting the argument. |
When adding a handler, ask: can two of these events be in flight at once, and if so, what happens? If the answer isn't obviously "nothing bad," pick a transformer from the table above — don't guess, and don't skip the question because "it probably won't happen in practice."
hydrated_bloc
Use only for small, non-sensitive UI preferences that should survive app restart (e.g. last-selected platform in the composer, language toggle default) — never for drafts (those go through drift, per PRD §6.10's explicit local-only/no-sync decision and its autosave/eviction requirements) and never for anything a SecureTokenStorage-class secret belongs in.
Testing
Every Bloc gets a bloc_test suite asserting the exact emitted state sequence, including at least one test that exercises the chosen transformer's actual behavior (e.g. firing two events back-to-back and asserting the second was dropped/restarted/serialized as intended) — not just the happy-path single-event case. See flutter-testing skill.
Security
- Security scanPassed, 98 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingmobile/.claude/skills/flutter-state-management/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bereke1t2/kelal-studio/flutter-state-management)