Skip to main content
This page covers the common patterns for using flutter_skin in your Flutter app, including the live update setup that pushes skin changes to your app in real time.

Basic Setup with Live Updates

This is the recommended setup. The StatefulWidget wrapper listens to onSkinChanged and rebuilds the app instantly when a new skin is published from the dashboard:
The setState(() {}) in onSkinChanged.listen is what triggers MaterialApp to rebuild with the new ThemeData. Without it, the skin updates internally but the UI doesn’t repaint.

How Live Updates Work

FlutterSkin.init() opens a persistent SSE (Server-Sent Events) connection to the FSkin backend alongside the initial skin fetch. The connection is lightweight — lighter than any analytics SDK or crash reporter.

App Lifecycle Management

The SSE connection is automatically managed based on app lifecycle. You don’t need to do anything — this is handled internally by FlutterSkin:
If a skin was published while the app was backgrounded or closed, the user gets the latest skin automatically on next launch via the normal fetch — no missed updates.

Offline Fallback

Provide a fallback skin for the first launch, before any skin has been fetched:
After the first successful fetch, the skin is cached locally. On subsequent launches — even without a network connection — the cached skin is used. The fallback only applies on the very first launch before any cache exists.

Color Tokens Reference

Upcoming

  • Typography tokens — font family, sizes, and weights
  • Spacing and radius tokens — layout and component shape
  • A/B testing — serve different skins to different user segments