flutter-caching

Installation
Summary

Comprehensive caching and performance optimization for Flutter apps across multiple data types and platforms.

  • Provides decision logic to select appropriate caching mechanisms: in-memory, shared_preferences for key-value pairs, SQLite for relational data, file system for large blobs, and image caching for network images
  • Includes stream-based offline-first repository pattern that yields cached data first, then fetches and updates from the network
  • Covers Android FlutterEngine pre-warming and caching to reduce Flutter initialization latency in hybrid apps
  • Optimizes widget rendering, image caching, and scrolling performance using ScrollCacheExtent objects and strict GPU memory constraints
  • Enforces SQL injection prevention via parameterized queries and validates performance anti-patterns like unnecessary saveLayer() calls and widget equality overrides
SKILL.md

flutter-caching-and-performance

Goal

Implements advanced caching, offline-first data persistence, and performance optimization strategies in Flutter applications. Evaluates application requirements to select and integrate the appropriate local caching mechanism (in-memory, persistent, file system, or on-device databases). Configures Android-specific FlutterEngine caching to minimize initialization latency. Optimizes widget rendering, image caching, and scrolling performance while adhering to current Flutter API standards and avoiding expensive rendering operations.

Instructions

1. Evaluate and Select Caching Strategy (Decision Logic)

Analyze the user's data retention requirements using the following decision tree to select the appropriate caching mechanism:

  • Is the data temporary and only needed for the current session?
    • Yes: Use In-memory caching.
  • Is the data small, simple key-value pairs (e.g., user preferences)?
    • Yes: Use shared_preferences.
  • Is the data large, relational, or requires complex querying?
    • Yes: Use On-device databases (e.g., sqflite). Proceed to Step 3.
  • Is the data large binary files, custom documents, or JSON blobs?
    • Yes: Use File system caching (path_provider). Proceed to Step 2.
  • Is the data network images?
    • Yes: Use Image caching (cached_network_image or custom ImageCache). Proceed to Step 6.
  • Is the goal to reduce Android Flutter UI warm-up time?
Related skills
Installs
1.0K
Repository
flutter/skills
GitHub Stars
1.9K
First Seen
Mar 4, 2026