Skip to content
Back to skills

Flutter Concurrency

ASecurity

Your app is freezing because large JSON parsing is CPU-bound work, and by default that work runs on Flutter's main isolate. When the main isolate spends too long decoding JSON, it blocks the event loop and the UI cannot paint frames, which shows up as jank or a full freeze. The fix is to move the parsing work off the main isolate. For a one-off heavy computation like decoding a large JSON payload, `Isolate.run()` is the right choice. Use this shape: ```dart import 'dart:convert'; import 'dart...

  • 584 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 5, 2026
developmentgo

Security analysis

A100/100

Pro scans all 13 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill flutter-concurrency --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Flutter Concurrency?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Flutter Concurrency
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-flutter-concurrency-agent-skills-standard/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-flutter-concurrency-agent-skills-standard)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
Your app is freezing because large JSON parsing is CPU-bound work, and by default that work runs on Flutter's main isolate. When the main isolate spends too long decoding JSON, it blocks the event loop and the UI cannot paint frames, which shows up as jank or a full freeze.

The fix is to move the parsing work off the main isolate. For a one-off heavy computation like decoding a large JSON payload, `Isolate.run()` is the right choice.

Use this shape:

```dart
import 'dart:convert';
import 'dart:isolate';

List<dynamic> _decodeJson(String rawJson) {
  return jsonDecode(rawJson) as List<dynamic>;
}

Future<List<dynamic>> parseLargeJson(String rawJson) async {
  return await Isolate.run(() => _decodeJson(rawJson));
}
```

Why this works:

- `async`/`await` alone would not fix the freeze, because it helps with non-blocking I/O, not heavy CPU work.
- `Isolate.run()` creates a background isolate for this one task, returns the result, and shuts down automatically.
- Keeping the decode function top-level or static is the safe pattern for isolate work.

A typical usage flow is:

1. Fetch or read the JSON string normally.
2. Pass the raw string into `parseLargeJson(...)`.
3. `await` the parsed result back on the main isolate.
4. Update UI after the computation finishes.

Example:

```dart
Future<void> loadItems() async {
  final rawJson = await rootBundle.loadString('assets/large.json');
  final items = await parseLargeJson(rawJson);
  // setState / update notifier with items
}
```

Important constraints:

- Pass data in and out through function arguments and return values. Isolates do not share mutable memory.
- Keep the isolate entry logic focused on the heavy computation itself.
- Reserve `Isolate.spawn()` for long-lived workers that need ongoing background communication; it is more setup than you need for one large decode.

If your JSON is especially large, this is one of the clearest cases where parsing on the main isolate is an anti-pattern. Offloading it with `Isolate.run()` is the standard fix.

Files in this skill

  • eval-1.baseline.md1.9 KB
  • eval-1.with-skill.md2 KB
  • eval-2.baseline.md2.1 KB
  • eval-2.with-skill.md2.7 KB
  • eval-3.baseline.md1.8 KB
  • eval-3.with-skill.md2.3 KB
  • trigger-1.md164 B
  • trigger-2.md147 B
  • trigger-3.md162 B
  • trigger-4.md145 B
  • trigger-5.md152 B
  • trigger-6.md146 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.