Conversation
showCustomSnackBar deferred the show to a post-frame callback but never scheduled a frame, so when called after an await with no pending frame the snackbar never appeared. Fixes Stacked-Org/stacked#1163 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
dialog_service.dart and example dialog_view.dart were already unformatted on main and fail the Verify Format step for every PR. No code change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Collaborator
Author
|
CI note: the Verify Format failure was pre-existing. |
Eimen2018
force-pushed
the
fix/1163-custom-snackbar-after-async-gap
branch
from
September 17, 2026 21:49
3ef0817 to
b38529d
Compare
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes Stacked-Org/stacked#1163:
showCustomSnackBarsilently did nothing when called after anawait(for example after a delayed API call) instead of from a tap handler or build.Root cause
SnackbarConfig.instantInitdefaults tofalse. On that pathshowCustomSnackBardefersgetBar.show()toWidgetsBinding.addPostFrameCallback. That callback only runs when the engine next produces a frame. After an async gap with nothing else pending, the binding is idle and no frame is ever scheduled, so the callback never fires and the snackbar never appears. The "two snackbars on a delayed re-tap" from the issue is the same bug: queued callbacks pile up and all fire when an unrelated frame finally runs.Fix
Call
binding.ensureVisualUpdate()right after registering the post-frame callback. It schedules a frame when the binding is idle and is a no-op while a frame is already underway, so the existing "defer until after the current build" behaviour ofinstantInit: falseis unchanged.Tests
test/snackbar_service_test.dart(new):showCustomSnackBarnow schedules a frame and the snackbar renders. Verified this test fails onmainwithout the fix.instantInit: true.Notes
getdependency (the removal in refactor: remove the get dependency #46 can proceed independently) and no public API change.flutter test: 3 passed.dart analyze lib test: no new issues.🤖 Generated with Claude Code