Agent skill

Flutter Dynamic Tabcontroller Ticker Mixin

by divinevideo in divinevideo/divine-mobile

Fix Flutter TabController crash when dynamically showing/hiding tabs.

MPL-2.0Auto-check passedMobile

Install Flutter Dynamic Tabcontroller Ticker Mixin

skills CLI
$ npx skills add divinevideo/divine-mobile --skill flutter-dynamic-tabcontroller-ticker-mixin -a claude-code

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

GitHub CLI
$ gh skill install divinevideo/divine-mobile flutter-dynamic-tabcontroller-ticker-mixin --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/divinevideo/divine-mobile.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/flutter-dynamic-tabcontroller-ticker-mixin .claude/skills/flutter-dynamic-tabcontroller-ticker-mixin && 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-dynamic-tabcontroller-ticker-mixin
GitHub stars
266
Token cost
~1.8k tokens
SKILL.md length
294 words
Files
1
Skills in repo
103
Repo updated
First seen
Licence
MPL-2.0

At a glance

Fix Flutter TabController crash when dynamically showing/hiding tabs.

  • Works in 4 steps: Change the Mixin → Track Tab Count State → Synchronously Rebuild on State Change → …
  • TabController rebuild causes SingleTickerProviderStateMixin but multiple tickers were created
  • SKILL.md covers Problem, Context / Trigger Conditions, Solution and Verification, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Flutter Dynamic Tabcontroller Ticker Mixin is an agent skill from divinevideo/divine-mobile. Fix Flutter TabController crash when dynamically showing/hiding tabs. Use when: (1) TabController rebuild causes "SingleTickerProviderStateMixin but multiple tickers were created", (2) Tabs need to appear/disappear based on feature flags or async state, (3) TabController.length changes at runtime based on provider state. The fix is to use TickerProviderStateMixin instead of SingleTickerProviderStateMixin.

Its SKILL.md is about 1.8k 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 licence is MPL-2.0.

When your agent uses it

  • TabController rebuild causes SingleTickerProviderStateMixin but multiple tickers were created
  • Tabs need to appear/disappear based on feature flags
  • TabController.length changes at runtime based on provider state

Example prompts

  • “SingleTickerProviderStateMixin but multiple tickers were created”
  • “/flutter-dynamic-tabcontroller-ticker-mixin”

Workflow steps

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

  1. Change the Mixin
  2. Track Tab Count State
  3. Synchronously Rebuild on State Change
  4. Keep Tabs and TabBarView in Sync

What it can do on your machine

Read from SKILL.md and the folder at commit 6487b05. 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

    Links to these hosts (documentation or services it may open):

    • api.flutter.dev

    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 Dynamic Tabcontroller Ticker Mixin loads about 1.8k tokens when it runs. Until then it costs about 113 tokens; SKILL.md has 294 words of instructions outside code blocks.

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

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 divinevideo/divine-mobile at commit 6487b05, republished under its MPL-2.0 licence (© divinevideo). 294 words, ~1,753 tokens.

Download SKILL.mdSave it as .claude/skills/flutter-dynamic-tabcontroller-ticker-mixin/SKILL.md (or your agent's skills folder).
name
flutter-dynamic-tabcontroller-ticker-mixin
description
Fix Flutter TabController crash when dynamically showing/hiding tabs. Use when: (1) TabController rebuild causes "SingleTickerProviderStateMixin but multiple tickers were created", (2) Tabs need to appear/disappear based on feature flags or async state, (3) TabController.length changes at runtime based on provider state. The fix is to use TickerProviderStateMixin instead of SingleTickerProviderStateMixin.
author
Claude Code
version
1.0.0
date
2026-01-26

Flutter Dynamic TabController with TickerProviderStateMixin

Problem

When building a TabBar with dynamic tabs (tabs that show/hide based on feature availability, user preferences, or async state), recreating the TabController during the widget lifecycle causes a crash because SingleTickerProviderStateMixin only allows one ticker to be created.

Context / Trigger Conditions

Error message:

_YourStateClass is a SingleTickerProviderStateMixin but multiple tickers were created.
A SingleTickerProviderStateMixin can only be used as a TickerProvider once.
If a State is used for multiple AnimationController objects, or if it is passed to other
objects and those objects might use it more than one time in total, then instead of mixing
in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.

When this happens:

  • You dispose and recreate a TabController when tab count changes
  • You have tabs that conditionally appear based on async state (e.g., Riverpod providers)
  • Feature flags control which tabs are visible
  • Tab visibility depends on API availability or user permissions

Solution

Step 1: Change the Mixin

Replace SingleTickerProviderStateMixin with TickerProviderStateMixin:

dart
// WRONG - crashes when TabController is recreated
class _MyScreenState extends State<MyScreen>
    with SingleTickerProviderStateMixin {

// CORRECT - allows multiple TabControllers over widget lifetime
class _MyScreenState extends State<MyScreen>
    with TickerProviderStateMixin {
Step 2: Track Tab Count State

Keep a state variable to track the current tab configuration:

dart
bool? _lastFeatureAvailable;
TabController? _tabController;

int get _tabCount => (_lastFeatureAvailable ?? false) ? 4 : 3;

void _initTabController() {
  _tabController?.removeListener(_onTabChanged);
  _tabController?.dispose();
  _tabController = TabController(
    length: _tabCount,
    vsync: this,
  );
  _tabController!.addListener(_onTabChanged);
}
Step 3: Synchronously Rebuild on State Change

When the condition changes, rebuild the TabController synchronously (not in postFrameCallback):

dart
@override
Widget build(BuildContext context) {
  // Watch the async state
  final featureAvailableAsync = ref.watch(featureAvailableProvider);
  final featureAvailable = featureAvailableAsync.asData?.value ?? false;

  // Rebuild TabController SYNCHRONOUSLY when state changes
  if (_lastFeatureAvailable != featureAvailable) {
    _lastFeatureAvailable = featureAvailable;
    _initTabController();  // Synchronous rebuild
  }

  // Build tabs using the SAME variable for consistency
  return TabBar(
    controller: _tabController,
    tabs: [
      const Tab(text: 'Tab 1'),
      const Tab(text: 'Tab 2'),
      if (_lastFeatureAvailable ?? false) const Tab(text: 'Optional Tab'),
      const Tab(text: 'Tab 3'),
    ],
  );
}
Step 4: Keep Tabs and TabBarView in Sync

Use the same state variable for both the tabs list and TabBarView children:

dart
// TabBar tabs
tabs: [
  const Tab(text: 'Always'),
  if (_lastFeatureAvailable ?? false) const Tab(text: 'Conditional'),
],

// TabBarView children - MUST match tabs exactly
TabBarView(
  controller: _tabController,
  children: [
    const AlwaysTab(),
    if (_lastFeatureAvailable ?? false) const ConditionalTab(),
  ],
),

Verification

After applying the fix:

  1. No crash when the async state changes
  2. Tabs appear/disappear correctly (not just grayed out)
  3. Tab selection state is preserved (clamped to valid range)
  4. No visual glitches during transition

Example

Real-world example - hiding a "Classics" tab when REST API is unavailable:

dart
class _ExploreScreenState extends ConsumerState<ExploreScreen>
    with TickerProviderStateMixin {  // NOT SingleTickerProviderStateMixin

  TabController? _tabController;
  bool? _lastClassicsAvailable;

  int get _tabCount => (_lastClassicsAvailable ?? false) ? 4 : 3;

  void _initTabController() {
    final savedTabIndex = ref.read(exploreTabIndexProvider);
    final validIndex = savedTabIndex.clamp(0, _tabCount - 1);
    _tabController?.removeListener(_onTabChanged);
    _tabController?.dispose();
    _tabController = TabController(
      length: _tabCount,
      vsync: this,
      initialIndex: validIndex,
    );
    _tabController!.addListener(_onTabChanged);
  }

  @override
  Widget build(BuildContext context) {
    final classicsAvailable =
        ref.watch(classicVinesAvailableProvider).asData?.value ?? false;

    if (_lastClassicsAvailable != classicsAvailable) {
      _lastClassicsAvailable = classicsAvailable;
      _initTabController();  // Synchronous, not postFrameCallback
    }

    return Column(
      children: [
        TabBar(
          controller: _tabController,
          tabs: [
            const Tab(text: 'New'),
            const Tab(text: 'Popular'),
            if (_lastClassicsAvailable ?? false) const Tab(text: 'Classics'),
            const Tab(text: 'Lists'),
          ],
        ),
        Expanded(
          child: TabBarView(
            controller: _tabController,
            children: [
              const NewVideosTab(),
              const PopularVideosTab(),
              if (_lastClassicsAvailable ?? false) const ClassicsTab(),
              const ListsTab(),
            ],
          ),
        ),
      ],
    );
  }
}

Notes

  • Why not postFrameCallback? Using addPostFrameCallback to rebuild the TabController causes a frame where the TabController length doesn't match the tabs list, resulting in tabs appearing "grayed out" or other visual glitches.

  • Performance: TickerProviderStateMixin has slightly more overhead than SingleTickerProviderStateMixin, but it's negligible for typical use cases.

  • Tab index preservation: When reducing tab count, clamp the current index to avoid out-of-bounds errors: savedIndex.clamp(0, newTabCount - 1).

  • Riverpod patterns: When using Riverpod async providers, remember that asyncValue.asData?.value ?? false gives you a synchronous default while loading.

References

© divinevideo, MPL-2.0. 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-dynamic-tabcontroller-ticker-mixin of divinevideo/divine-mobile.

Open the folder on GitHubat commit 6487b05

Compare with similar skills

Flutter Dynamic Tabcontroller Ticker Mixin 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 Dynamic Tabcontroller Ticker Mixin compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Flutter Dynamic Tabcontroller Ticker Mixin this skilldivinevideo/divine-mobile266—~1.8kAutomated safety check: PassMPL-2.0
Add Flutter Docusaurus Localematthiasn/lotti1.2k—~1.2kAutomated safety check: PassGPL-3.0
Tm Launcher DesignFar-Se/tabame372—~3.1kAutomated safety check: PassMIT
Flutter Initbear2u/my-skills933—~2.5kAutomated safety check: PassNone
Mobile App UI Designceorkm/mobile-app-ui-design403—~2kAutomated safety check: PassNone
Marionette Flutter Drive Appleancodepl/marionette_mcp482—~11kAutomated safety check: PassApache-2.0

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 today
    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.

    372 GitHub stars~3.1k tokensUpdated yesterday
    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
  • Mobile App UI Design

    ceorkm/mobile-app-ui-design

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

    403 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.

    482 GitHub stars~11k tokensUpdated 3 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 3 days ago
    MobileAuto-check passed

More from divinevideo/divine-mobile

All 103 skills in this repo
  • Fix ArgoCD ExternalSecret deployment failing with "namespace X is not permitted in project Y".

    266 GitHub stars~931 tokensUpdated today
    Auto-check passed
  • Art Direct

    divinevideo/divine-mobile

    Art direction for any content — reads text, PDF, Word, HTML, PPT, then proposes 2-3 creative directions with photography style, mood, and visual language.

    266 GitHub stars~4.8k tokensUpdated today
    Auto-check passed
  • Async Await Null Race Condition

    divinevideo/divine-mobile

    Fix "Null check operator used on a null value" errors when an object is set to null during an async await.

    266 GitHub stars~881 tokensUpdated today
    Auto-check passed
  • AWS V4 Signing Custom Headers Gcs

    divinevideo/divine-mobile

    Add custom metadata headers (x-amz-meta-) to AWS v4 signed requests for GCS S3-compatible API.

    266 GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Bash Herestring Newline Secrets

    divinevideo/divine-mobile

    Fix password/secret authentication failures caused by trailing newlines when creating Google Cloud secrets (or similar) with bash here-strings.

    266 GitHub stars~791 tokensUpdated today
    Auto-check passed
  • Fix silent video/media processing failures caused by URL extraction code that filters on file extensions (.mp4, .webm, .webp).

    266 GitHub stars~1.1k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Flutter Dynamic Tabcontroller Ticker Mixin

What does Flutter Dynamic Tabcontroller Ticker Mixin do?

Fix Flutter TabController crash when dynamically showing/hiding tabs. Flutter Dynamic Tabcontroller Ticker Mixin is an agent skill from divinevideo/divine-mobile. Fix Flutter TabController crash when dynamically showing/hiding tabs.

When should I use Flutter Dynamic Tabcontroller Ticker Mixin?

Flutter Dynamic Tabcontroller Ticker Mixin fits situations like: tabController rebuild causes SingleTickerProviderStateMixin but multiple tickers were created; tabs need to appear/disappear based on feature flags; tabController.length changes at runtime based on provider state.

How do I install Flutter Dynamic Tabcontroller Ticker Mixin in Claude Code?

Run `npx skills add divinevideo/divine-mobile --skill flutter-dynamic-tabcontroller-ticker-mixin -a claude-code`. Or copy the skill folder (.agents/skills/flutter-dynamic-tabcontroller-ticker-mixin in divinevideo/divine-mobile) into .claude/skills/flutter-dynamic-tabcontroller-ticker-mixin in your project. Claude Code loads it when a task matches its description.

How do I install Flutter Dynamic Tabcontroller Ticker Mixin in Codex?

Run `npx skills add divinevideo/divine-mobile --skill flutter-dynamic-tabcontroller-ticker-mixin -a codex`. Or copy the skill folder (.agents/skills/flutter-dynamic-tabcontroller-ticker-mixin in divinevideo/divine-mobile) into .agents/skills/flutter-dynamic-tabcontroller-ticker-mixin in your project. Codex loads it when a task matches its description.

Can I use Flutter Dynamic Tabcontroller Ticker Mixin 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 divinevideo/divine-mobile --skill flutter-dynamic-tabcontroller-ticker-mixin -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-dynamic-tabcontroller-ticker-mixin, .gemini/skills/flutter-dynamic-tabcontroller-ticker-mixin, .github/skills/flutter-dynamic-tabcontroller-ticker-mixin and .opencode/skills/flutter-dynamic-tabcontroller-ticker-mixin in your project.

What does Flutter Dynamic Tabcontroller Ticker Mixin need to run?

SKILL.md names no scripts, command-line tools or credentials: Flutter Dynamic Tabcontroller Ticker Mixin is instructions for the agent only.

Does Flutter Dynamic Tabcontroller Ticker Mixin access the network?

SKILL.md names 1 domain. As links in the text: api.flutter.dev. This is read from the text; nothing was executed.

Is Flutter Dynamic Tabcontroller Ticker Mixin 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 Dynamic Tabcontroller Ticker Mixin use?

Flutter Dynamic Tabcontroller Ticker Mixin is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Flutter Dynamic Tabcontroller Ticker Mixin use?

About 1.8k tokens (SKILL.md is roughly 7k 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 Dynamic Tabcontroller Ticker Mixin?

Skills that share tags, products or a category with Flutter Dynamic Tabcontroller Ticker Mixin: Add Flutter Docusaurus Locale (matthiasn/lotti, 1.2k stars), Tm Launcher Design (Far-Se/tabame, 372 stars), Flutter Init (bear2u/my-skills, 933 stars) and Mobile App UI Design (ceorkm/mobile-app-ui-design, 403 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Flutter Dynamic Tabcontroller Ticker Mixin?

divinevideo (a GitHub organization) maintains it in divinevideo/divine-mobile, which has 266 GitHub stars. The repository holds 103 skills in this directory. The repository was last updated on October 9, 2026.

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