Code Room
Vibe codingHardvc-g251
Subject Ai code reviewLevel Senior–Staff~19 minCommon in Concurrency interviewsIndustries Software development

Question

An AI wrote this Flutter code to parse and process a large analytics payload, claiming it 'runs in the background with async'. The UI still freezes for ~600ms when it runs and the frame counter drops to zero during the parse. Why doesn't `async` help here, and how would you fix it?

dart
Future<List<Event>> processPayload(String raw) async {  final json = jsonDecode(raw);                 // big payload  final events = <Event>[];  for (final e in json['events']) {    events.add(_transform(e));                   // CPU-heavy per item  }  return events;}
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.