Our Flutter admin console loaded its main dashboard screen with 40 HTTP requests. On office Wi-Fi nobody noticed. On a 4G connection in a warehouse, the screen took long enough that staff started double-tapping and filing "it's broken" reports. Fixing Flutter admin console performance turned out to be less about Flutter and more about the shape of our REST API, which had been designed around database tables rather than around screens.
This post covers what the chatty design looked like, the aggregation endpoint that replaced it, the caching trade-offs, and one failure mode that cost us a day: partial responses hiding a downstream timeout.
Why table-shaped REST endpoints fall apart on mobile
The original API was tidy. /orders, /customers, /products, /staff, each with predictable CRUD. A single order row on the dashboard, though, needed the order, its line items, the customer, the assigned staff member, and the status history. Multiply by a list of ten orders and add summary widgets, and you reach 40 requests quickly.
On a desktop browser with HTTP/2 and a low-latency connection, this is survivable. On mobile networks the cost is not bandwidth, it is round trips. Each request pays for latency, TLS session overhead when connections get recycled, and radio wake-ups. Dart's Future.wait parallelizes the calls, but the client still pays for the slowest one, and a dependent chain (fetch orders, then fetch customers by ID) serializes anyway.
The second cost is on the client. Each widget owned its own fetch, so the screen rendered as a staggered series of spinners, and state management had to reconcile 40 independently arriving responses. Most of our bugs in that screen were race conditions between them.
The backend-for-frontend aggregation endpoint
The fix was a thin backend-for-frontend layer: one endpoint per screen, returning exactly what that screen renders. Not a generic GraphQL gateway, just a handler that owns a screen's data contract.
GET /bff/dashboard
{
"summary": { "open": 12, "overdue": 3 },
"orders": [ { "id": "...", "customerName": "...", "assignee": {...}, "status": "..." } ],
"meta": { "generatedAt": "...", "partial": false, "failed": [] }
}
Inside the handler, the server fans out to the existing services concurrently and joins results, with database access colocated so the joins happen over a local network instead of a cellular one. The Flutter side collapsed into a single repository call and one state object. We ended up with three requests per screen: the aggregate, a session/config check, and a lazily loaded secondary panel below the fold.
Design rules that held up:
- One BFF handler per screen, not per entity. If two screens share 90% of a payload, share the internal function, not the endpoint.
- Keep domain logic out of it. The BFF composes; the underlying services decide. Otherwise you have built a second backend.
- Version by screen contract. Older app builds stay in the field, so additive changes only, and old fields linger until usage drops.
Caching and invalidation: where it gets uncomfortable
Once the data is aggregated, caching is tempting, and it is also where aggregation bites. A cached dashboard payload mixes data with different freshness needs. Order status changes in seconds; the staff roster changes weekly.
We cache at the component level inside the BFF, not at the response level. Slow-changing pieces get a short TTL, fast-changing ones are fetched live. On the client we use stale-while-revalidate: render the last payload immediately, refresh in the background, and mark the screen visibly stale if the refresh fails.
The trade-off is invalidation. Event-driven invalidation (bust the cache when an order changes) is precise but couples write paths to cache keys, and we missed a path once, leaving a stale count on screen. TTLs are blunt but forgiving. For an admin console where a few seconds of staleness is acceptable, we picked short TTLs and accepted the imprecision. For anything touching money or stock counts, we skip the cache.
The failure mode: partial responses that masked a timeout
To keep the dashboard usable when one dependency was slow, we made the BFF return partial results: if the staff service timed out, return orders without assignee names. Sensible resilience, in theory.
In practice, a downstream service began timing out intermittently, and the BFF dutifully returned HTTP 200 with missing data. Dashboards showed blank assignees. Monitoring stayed green because status codes were fine. Users assumed the data was simply empty. It took a day to connect the reports to a timeout in a dependency.
What we changed:
- Explicit partial markers. The
meta.failedarray names which sections degraded, and the client renders an inline "couldn't load assignees" state with retry, never a silent blank. - Metrics on degradation, not just errors. We alert on the partial-response rate per section, since a 200 no longer means healthy.
- Per-dependency timeout budgets. Each fan-out call gets a deadline shorter than the overall request budget, so one slow service cannot consume the whole response time.
- Critical vs optional sections. Some data, like the order list itself, fails the whole request. Only decorative data degrades.
The lesson generalizes: graceful degradation without visibility is just data corruption with better manners.
What we would tell a team starting this today
Measure requests per screen before you optimize anything. If a screen needs more than a handful, the endpoints are probably modeled around your schema instead of your UI. Build the aggregate for your worst screen first, instrument partial responses from day one, and resist the urge to cache the whole payload.
orithLabs builds Flutter apps, backends, and admin consoles with this kind of production detail in mind, and we also review existing codebases where API shape, caching, or silent failure modes are causing trouble. If your app is chattier than it should be, we are happy to look at it and tell you plainly what we see.