Agent skill

Flutter Managing State

by btwld in btwld/superdeck

Manages application and ephemeral state in a Flutter app. An agent skill from btwld/superdeck.

BSD-3-ClauseAuto-check passedMobile

Install Flutter Managing State

skills CLI
$ npx skills add btwld/superdeck --skill flutter-managing-state -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install btwld/superdeck flutter-managing-state --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/btwld/superdeck.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/flutter-managing-state .claude/skills/flutter-managing-state && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
flutter-managing-state
GitHub stars
129
Token cost
~2.2k tokens
SKILL.md length
782 words
Files
1
Skills in repo
23
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Manages application and ephemeral state in a Flutter app. An agent skill from btwld/superdeck.

  • Works in 5 steps: Define the Model (Repository) → Create the ViewModel (ChangeNotifier) → Inject the ViewModel into the Widget Tree → …
  • Sharing data between widgets
  • SKILL.md covers SuperDeck state conventions, Contents, Core Concepts and Architecture and Data Flow, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Flutter Managing State is an agent skill from btwld/superdeck. Manages application and ephemeral state in a Flutter app. Use when sharing data between widgets or handling complex UI state transitions.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile, covering Cross-platform mobile apps. It works with Flutter. The repository describes itself as: Presentation slides for Flutter with Flutter. The licence is BSD-3-Clause.

When your agent uses it

  • Sharing data between widgets
  • Handling complex UI state transitions

Example prompts

  • “Use the flutter-managing-state skill to manage application and ephemeral state in a Flutter app. An agent skill from btwld/superdeck”
  • “/flutter-managing-state”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Define the Model (Repository)
  2. Create the ViewModel (ChangeNotifier)
  3. Inject the ViewModel into the Widget Tree
  4. Consume the State in the View
  5. Validate the implementation

What it can do on your machine

Read from SKILL.md and the folder at commit 815a746. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are dart).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Flutter Managing State loads about 2.2k tokens when it runs. Until then it costs about 40 tokens; SKILL.md has 782 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~40
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from btwld/superdeck at commit 815a746, republished under its BSD-3-Clause licence (© btwld). 782 words, ~2,199 tokens.

Download SKILL.mdSave it as .claude/skills/flutter-managing-state/SKILL.md (or your agent's skills folder).
name
flutter-managing-state
description
Manages application and ephemeral state in a Flutter app. Use when sharing data between widgets or handling complex UI state transitions.
metadata.model
models/gemini-3.1-pro-preview
metadata.last_modified
Thu, 12 Mar 2026 22:18:06 GMT

Managing State in Flutter

SuperDeck state conventions

Preserve the existing Signals-based state model: DeckController manages presentations, and the Playground conversation view model uses Signals. Inspect the feature's current dependency injection and reactive subscriptions before editing. Provider may supply existing dependencies; its presence does not require migrating reactive state to ChangeNotifier. The MVVM/Provider examples below are alternatives for projects that already use that pattern, not a migration instruction for SuperDeck.

Contents

Core Concepts

Flutter's UI is declarative; it is built to reflect the current state of the app (UI = f(state)). When state changes, trigger a rebuild of the UI that depends on that state.

Distinguish between two primary types of state to determine your management strategy:

  • Ephemeral State (Local State): State contained neatly within a single widget (e.g., current page in a PageView, current selected tab, animation progress). Manage this using a StatefulWidget and setState().
  • App State (Shared State): State shared across multiple parts of the app and maintained between user sessions (e.g., user preferences, login info, shopping cart contents). Manage this using advanced approaches like InheritedWidget, the provider package, and the MVVM architecture.

Architecture and Data Flow

Implement the Model-View-ViewModel (MVVM) design pattern combined with Unidirectional Data Flow (UDF) for scalable app state management.

  • Unidirectional Data Flow (UDF): Enforce a strict flow where state flows down from the data layer, through the logic layer, to the UI layer. Events from user interactions flow up from the UI layer, to the logic layer, to the data layer.
  • Single Source of Truth (SSOT): Ensure data changes always happen in the data layer (Repositories). The SSOT class must be the only class capable of modifying its respective data.
  • Model (Data Layer): Handle low-level tasks like HTTP requests, data caching, and system resources using Repository classes.
  • ViewModel (Logic Layer): Manage the UI state. Convert app data from the Model into UI State. Extend ChangeNotifier and call notifyListeners() to trigger UI rebuilds when data changes.
  • View (UI Layer): Display the state provided by the ViewModel. Keep views lean; they should contain minimal logic (only routing, animations, or simple UI conditionals).

Workflow: Selecting a State Management Approach

Evaluate the scope of the state to determine the correct implementation strategy.

  • If managing Ephemeral State (single widget scope):
    1. Subclass StatefulWidget and State.
    2. Store mutable state as private fields within the State class.
    3. Mutate state exclusively inside a setState() callback to mark the widget as dirty and schedule a rebuild.
  • If managing App State (shared across widgets):
    1. Implement the MVVM pattern.
    2. Use the provider package (a wrapper around InheritedWidget) to inject state into the widget tree.
    3. Use ChangeNotifier to emit state updates.
Show full SKILL.md (325 more words)Show less

Workflow: Implementing MVVM with Provider

Follow this sequential workflow to implement app-level state management using MVVM and provider.

Task Progress:

  • 1. Define the Model (Repository).
  • 2. Create the ViewModel (ChangeNotifier).
  • 3. Inject the ViewModel into the Widget Tree.
  • 4. Consume the State in the View.
  • 5. Validate the implementation.
1. Define the Model (Repository)

Create a repository class to act as the Single Source of Truth (SSOT) for the specific data domain. Handle all external API calls or database queries here.

2. Create the ViewModel (ChangeNotifier)

Create a ViewModel class that extends ChangeNotifier.

  • Pass the Repository into the ViewModel via dependency injection.
  • Define properties for the UI state (e.g., isLoading, data, errorMessage).
  • Implement methods to handle UI events. Inside these methods, mutate the state and call notifyListeners() to trigger UI rebuilds.
3. Inject the ViewModel into the Widget Tree

Use ChangeNotifierProvider from the provider package to provide the ViewModel to the widget subtree that requires it. Place the provider as low in the widget tree as possible to avoid polluting the scope.

4. Consume the State in the View

Access the ViewModel in your StatelessWidget or StatefulWidget.

  • Use Consumer<MyViewModel> to rebuild specific parts of the UI when notifyListeners() is called.
  • Use context.read<MyViewModel>() (or Provider.of<MyViewModel>(context, listen: false)) inside event handlers (like onPressed) to call ViewModel methods without triggering a rebuild of the calling widget.
5. Validate the implementation

Run the following feedback loop to ensure data flows correctly:

  1. Trigger a user action in the View.
  2. Verify the ViewModel receives the event and calls the Repository.
  3. Verify the Repository updates the SSOT and returns data.
  4. Verify the ViewModel updates its state and calls notifyListeners().
  5. Verify the View rebuilds with the new state. Run validator -> review errors -> fix missing notifyListeners() calls or incorrect Provider scopes.

Examples

Ephemeral State Implementation (setState)

Use this pattern strictly for local, UI-only state.

dart
class EphemeralCounter extends StatefulWidget {
  const EphemeralCounter({super.key});

  @override
  State<EphemeralCounter> createState() => _EphemeralCounterState();
}

class _EphemeralCounterState extends State<EphemeralCounter> {
  int _counter = 0; // Local state

  void _increment() {
    setState(() {
      _counter++; // Mutate state and schedule rebuild
    });
  }

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: _increment,
      child: Text('Count: $_counter'),
    );
  }
}
App State Implementation (MVVM + Provider)

Use this pattern for shared data and complex business logic.

dart
// 1. Model (Repository)
class CartRepository {
  Future<void> saveItemToCart(String item) async {
    // Simulate network/database call
    await Future.delayed(const Duration(milliseconds: 500));
  }
}

// 2. ViewModel (ChangeNotifier)
class CartViewModel extends ChangeNotifier {
  final CartRepository repository;
  
  CartViewModel({required this.repository});

  final List<String> _items = [];
  bool isLoading = false;
  String? errorMessage;

  List<String> get items => List.unmodifiable(_items);

  Future<void> addItem(String item) async {
    isLoading = true;
    errorMessage = null;
    notifyListeners(); // Trigger loading UI

    try {
      await repository.saveItemToCart(item);
      _items.add(item);
    } catch (e) {
      errorMessage = 'Failed to add item';
    } finally {
      isLoading = false;
      notifyListeners(); // Trigger success/error UI
    }
  }
}

// 3. Injection & 4. View (UI)
class CartApp extends StatelessWidget {
  const CartApp({super.key});

  @override
  Widget build(BuildContext context) {
    // Inject ViewModel
    return ChangeNotifierProvider(
      create: (_) => CartViewModel(repository: CartRepository()),
      child: const CartScreen(),
    );
  }
}

class CartScreen extends StatelessWidget {
  const CartScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Consumer<CartViewModel>(
        builder: (context, viewModel, child) {
          if (viewModel.isLoading) {
            return const CircularProgressIndicator();
          }
          if (viewModel.errorMessage != null) {
            return Text(viewModel.errorMessage!);
          }
          return ListView.builder(
            itemCount: viewModel.items.length,
            itemBuilder: (_, index) => Text(viewModel.items[index]),
          );
        },
      ),
      floatingActionButton: FloatingActionButton(
        // Use read() to access methods without listening for rebuilds
        onPressed: () => context.read<CartViewModel>().addItem('New Item'),
        child: const Icon(Icons.add),
      ),
    );
  }
}

© btwld, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/flutter-managing-state of btwld/superdeck.

Open the folder on GitHubat commit 815a746

Compare with similar skills

Flutter Managing State next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Flutter Managing State compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Flutter Managing State this skillbtwld/superdeck129—~2.2kAutomated safety check: PassBSD-3-Clause
Add Flutter Docusaurus Localematthiasn/lotti1.2k—~1.2kAutomated safety check: PassGPL-3.0
Tm Launcher DesignFar-Se/tabame371—~3.1kAutomated safety check: PassMIT
Mobile App UI Designceorkm/mobile-app-ui-design400—~2kAutomated safety check: PassNone
Marionette Flutter Drive Appleancodepl/marionette_mcp473—~11kAutomated safety check: PassApache-2.0
Flutter ScreenshotJustLookAtNow/pt_mate503—~511Automated safety check: PassMIT

Similar skills

  • Add, complete, or audit a locale across a Flutter application's ARB catalogs and a localized Docusaurus manual, including generated localization code, locale selectors, native platform declarations…

    1.2k GitHub stars~1.2k tokensUpdated yesterday
    MobileAuto-check passed
  • Tm Launcher Design

    Far-Se/tabame

    Create or revise Tabame's Flutter launcher designs: frames, search bars, result rows, palettes, typography, and action dialogs.

    371 GitHub stars~3.1k tokensUpdated yesterday
    MobileAuto-check passed
  • Mobile App UI Design

    ceorkm/mobile-app-ui-design

    Design high-quality mobile app UI/UX screens, flows, and components.

    400 GitHub stars~2k tokensUpdated 3 mo ago
    MobileAuto-check passed
  • Marionette Flutter Drive App

    leancodepl/marionette_mcp

    Set up and drive a running Flutter app (debug or profile) with Marionette — an AI agent's hands and eyes for the app.

    473 GitHub stars~11k tokensUpdated 2 days ago
    MobileAuto-check passed
  • Flutter Screenshot

    JustLookAtNow/pt_mate

    Capture and show two Flutter UI screenshots for this project: one landscape/large-screen preview and one portrait/mobile preview, without using Flutter Web.

    503 GitHub stars~511 tokensUpdated 2 days ago
    MobileAuto-check passed
  • Flutter Init

    bear2u/my-skills

    A skill your agent uses when user wants to create a new Flutter project (Todo/Habit/Note/Expense/Custom domain) with Clean Architecture, Riverpod 3.0, Drift, and modern Flutter stack

    933 GitHub stars~2.5k tokensUpdated 3 mo ago
    MobileAuto-check passed

More from btwld/superdeck

All 23 skills in this repo
  • Create, review, or edit SuperDeck Markdown presentations and Flutter presentation apps.

    129 GitHub stars~649 tokensUpdated 10 days ago
    Auto-check passed
  • Adds home screen widgets to a Flutter app for Android and iOS.

    129 GitHub stars~2.2k tokensUpdated 10 days ago
    Auto-check passed
  • Flutter Animating Apps

    btwld/superdeck

    Implements animated effects, transitions, and motion in a Flutter app.

    129 GitHub stars~1.9k tokensUpdated 10 days ago
    Auto-check passed
  • Architects a Flutter application using the recommended layered approach (UI, Logic, Data).

    129 GitHub stars~1.8k tokensUpdated 10 days ago
    Auto-check passed
  • Flutter Building Forms

    btwld/superdeck

    Builds Flutter forms with validation and user input handling.

    129 GitHub stars~1.4k tokensUpdated 10 days ago
    Auto-check passed
  • Builds Flutter layouts using the constraint system and layout widgets.

    129 GitHub stars~1.5k tokensUpdated 10 days ago
    Auto-check passed

Works with

Categories

Questions about Flutter Managing State

What does Flutter Managing State do?

Manages application and ephemeral state in a Flutter app. An agent skill from btwld/superdeck. Flutter Managing State is an agent skill from btwld/superdeck. Manages application and ephemeral state in a Flutter app.

When should I use Flutter Managing State?

Flutter Managing State fits situations like: sharing data between widgets; handling complex UI state transitions.

How do I install Flutter Managing State in Claude Code?

Run `npx skills add btwld/superdeck --skill flutter-managing-state -a claude-code`. Or copy the skill folder (.agents/skills/flutter-managing-state in btwld/superdeck) into .claude/skills/flutter-managing-state in your project. Claude Code loads it when a task matches its description.

How do I install Flutter Managing State in Codex?

Run `npx skills add btwld/superdeck --skill flutter-managing-state -a codex`. Or copy the skill folder (.agents/skills/flutter-managing-state in btwld/superdeck) into .agents/skills/flutter-managing-state in your project. Codex loads it when a task matches its description.

Can I use Flutter Managing State in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add btwld/superdeck --skill flutter-managing-state -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/flutter-managing-state, .gemini/skills/flutter-managing-state, .github/skills/flutter-managing-state and .opencode/skills/flutter-managing-state in your project.

What does Flutter Managing State need to run?

SKILL.md names no scripts, command-line tools or credentials: Flutter Managing State is instructions for the agent only.

Does Flutter Managing State access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Flutter Managing State safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Flutter Managing State use?

Flutter Managing State is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Flutter Managing State use?

About 2.2k tokens (SKILL.md is roughly 8.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Flutter Managing State?

Skills that share tags, products or a category with Flutter Managing State: Add Flutter Docusaurus Locale (matthiasn/lotti, 1.2k stars), Tm Launcher Design (Far-Se/tabame, 371 stars), Mobile App UI Design (ceorkm/mobile-app-ui-design, 400 stars) and Marionette Flutter Drive App (leancodepl/marionette_mcp, 473 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Flutter Managing State?

btwld (a GitHub organization) maintains it in btwld/superdeck, which has 129 GitHub stars. The repository holds 23 skills in this directory. The repository was last updated on September 28, 2026.

Source: btwld/superdeck on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.