---
name: flutter-web
description: Use when working on a Flutter web build - code touching dart:js_interop, package:web or dart:ui_web; tests that will not compile on the VM runner; a blank white page after a build; or QA of a running web app in a browser. Triggers on "works on mobile but not on web", a suite that breaks after a web import is added, or a screen that looks frozen in the browser.
---
You are working on a Flutter **web** build. Everything here is a lesson that
cost real hours — each one looks like an application bug and is not.
## Browser QA only counts in a visible tab
Flutter web drives its **entire** frame pipeline from `requestAnimationFrame`,
and Chrome throttles rAF to near zero in a tab that is not the active one. In a
background tab the app still runs — events are processed, network calls fire —
but it barely paints. So route transitions appear frozen for tens of seconds,
and click coordinates read off a screenshot land nowhere, because the painted
frame no longer matches the real hit-test layout.
That looks exactly like two bugs that do not exist: a slow splash screen and
broken Tab traversal.
Before blaming the app:
```js
document.visibilityState // must be "visible"
```
If it reports `hidden`, bring the browser window forward and make the tab
active. Two things stay reliable either way, and are the better evidence:
- `performance.getEntriesByType('resource')` for real timings — in one case it
showed auth resolving at 1.4s while the screen looked stuck for 20s.
- `document.activeElement`, and the hidden `` Flutter creates for the
focused text field, which proves where focus actually is.
Each CDP screenshot forces one frame, so consecutive screenshots step a stalled
transition forward — useful, and itself a hint that you are in a throttled tab.
## Browser-layer code needs the Chrome test runner
Anything touching `dart:js_interop` or `package:web` — `getUserMedia`,
`MediaRecorder`, an `