flutter-concurrency

Installation
Summary

Background JSON parsing and state management for jank-free Flutter UI rendering.

  • Provides decision tree for choosing between manual serialization (dart:convert) and code generation (json_serializable) based on model complexity
  • Supports three concurrency strategies: main-thread async/await for small payloads, short-lived Isolate.run() for heavy one-off computations, and long-lived isolates with ReceivePort/SendPort for continuous two-way communication
  • Includes platform-aware fallback: uses compute() for Flutter Web since dart:isolate threading is unsupported
  • Demonstrates integration with FutureBuilder for responsive UI state binding and enforces key constraints like no UI access in isolates and immutable message passing
SKILL.md

Flutter Concurrency and Data Management

Goal

Implements advanced Flutter data handling, including background JSON serialization using Isolates, asynchronous state management, and platform-aware concurrency to ensure jank-free 60fps+ UI rendering. Assumes a standard Flutter environment (Dart 2.19+) with access to dart:convert, dart:isolate, and standard state management paradigms.

Decision Logic

Use the following decision tree to determine the correct serialization and concurrency approach before writing code:

  1. Serialization Strategy:
    • Condition: Is the JSON model simple, flat, and rarely changed?
      • Action: Use Manual Serialization (dart:convert).
    • Condition: Is the JSON model complex, nested, or part of a large-scale application?
      • Action: Use Code Generation (json_serializable and build_runner).
  2. Concurrency Strategy:
    • Condition: Is the data payload small and parsing takes < 16ms?
      • Action: Run on the Main UI Isolate using standard async/await.
    • Condition: Is the data payload large (e.g., > 1MB JSON) or computationally expensive?
      • Action: Offload to a Background Isolate using Isolate.run().
    • Condition: Does the background task require continuous, two-way communication over time?
      • Action: Implement a Long-lived Isolate using ReceivePort and SendPort.
Related skills
Installs
997
Repository
flutter/skills
GitHub Stars
1.9K
First Seen
Mar 4, 2026