Skip to content

Fix boot overlay '!_dirty' assertion in debug mode with zero fade duration#6666

Merged
FeodorFitsner merged 2 commits into
flet-0.86from
fix-boot-overlay-dirty-assert
Jul 10, 2026
Merged

Fix boot overlay '!_dirty' assertion in debug mode with zero fade duration#6666
FeodorFitsner merged 2 commits into
flet-0.86from
fix-boot-overlay-dirty-assert

Conversation

@FeodorFitsner

@FeodorFitsner FeodorFitsner commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problem

Running an app built from the flet build template in debug mode (e.g. flet debug android) throws when the app becomes ready:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════
'package:flutter/src/widgets/framework.dart': Failed assertion: line 5538 pos 12: '!_dirty': is not true.
The relevant error-causing widget was:
  _BootOverlay

Cause

With the default boot_screen.fade_out_duration of 0, _BootOverlay's AnimatedOpacity gets a Duration.zero animation when boot status turns done. The underlying AnimationController completes synchronously, firing onEnd — and its setState(() => _removed = true) — in the middle of the overlay's own rebuild, tripping the framework's assert(!_dirty).

Debug-mode only: the assertion is compiled out of release builds, so packaged apps were unaffected.

Fix

When no fade is configured, _onStatus now removes the overlay in a single state update (_fadingOut + _removed together) instead of going through the zero-duration animation. Non-zero fade durations still take the animated onEnd path as before.

Verified on an Android emulator with flet debug android — the assertion no longer fires and the boot overlay is dismissed as expected.

Summary by Sourcery

Resolve a debug-only boot overlay assertion triggered in apps built from the flet build template when the app becomes ready.

Bug Fixes:

  • Prevent the _BootOverlay from tripping a '!_dirty' framework assertion in debug mode when boot_screen.fade_out_duration is zero by skipping the zero-duration fade animation and removing the overlay in a single state update when no fade is configured.

Documentation:

  • Document the boot overlay debug-mode assertion fix in the changelog, clarifying the conditions and impact of the issue.

…ation

With the default boot_screen.fade_out_duration of 0, _BootOverlay's
AnimatedOpacity completed synchronously when boot status turned done,
firing onEnd (and its setState) in the middle of the overlay's own
rebuild and tripping the framework's assert(!_dirty) in debug mode.
Remove the overlay in a single state update when no fade is configured;
non-zero fade durations still take the animated path.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8fd424d
Status: ✅  Deploy successful!
Preview URL: https://04600076.flet-website-v2.pages.dev
Branch Preview URL: https://fix-boot-overlay-dirty-asser.flet-website-v2.pages.dev

View logs

@FeodorFitsner FeodorFitsner merged commit 2123828 into flet-0.86 Jul 10, 2026
17 of 29 checks passed
@FeodorFitsner FeodorFitsner deleted the fix-boot-overlay-dirty-assert branch July 10, 2026 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant