Why bloc.add(...) Isn't What You Think: Synchronous Event Fast-Paths and 0ms Form Bindings
Why classic BLoC's StreamController forces an asynchronous microtask tax, how BlocSignal executes synchronous event handlers inline on the exact same call stack, and why this is the only way to build 120 FPS Generative UI form bindings.
First seen by Oriel on .
AI summary
The article explains how BlocSignal preserves the BLoC API while dispatching synchronous handlers inline, enabling immediate state updates and reactive form bindings without microtask delays.
- BlocSignal.add() invokes handlers on the caller’s stack and checks whether their FutureOr<void> result is a Future, retaining asynchronous handling for network work.
- Synchronous handlers update state before add() returns, so callers can read the new state immediately and tests can assert results without waiting for stream events.
- The article attributes stale reads, broken call-stack context, and input lag in classic package:bloc to asynchronous StreamController event and state delivery.
- For A2UI forms, synchronous updates mutate a2ui_core DataModel signals in a batch, triggering bound GenericBinder values and CheckRule validation expressions immediately.
- Event transformers must avoid unconditional async wrappers, which can defer completion and leave reentrancy flags set while back-to-back events arrive.
#bloc #dart #flutter #generative ui
Generated by gpt-5.6-sol. Check the original for details.
Metric trends
Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained
Reactions
Total public reactions reported by the source; distinct from points and likes.
- DEV Community: 21, latest observation ; +13 over observed period since
Comments
Comment count reported by the source.
- DEV Community: 7, latest observation ; +5 over observed period since
Aliases
| Source | External ID | URL |
|---|---|---|
| DEV Community | 4917886 | https://dev.to/gde/why-blocadd-isnt-what-you-think-synchronous-event-fast-paths-and-0ms-form-bindings-6o Read discussion |