Repository navigation
Conversation
nativeapi's WindowEvent is sealed and the dependency is ^0.5.5, so a 0.5.x release that adds a WindowEvent subclass would make the exhaustive switch in the legacy bridge a compile error for every app using it. Events without a 0.5.x counterpart (created, closed, property and occlusion changes) now go through a default branch instead of an explicit list. The branch stays reachable, so the analyzer does not flag it, and a future event is ignored instead of breaking the build. Adds a @VisibleForTesting debugBindWindow so the bridge can be driven by a simulated nativeapi.Window in tests.
This was referenced Nov 10, 2026
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.
Problem
nativeapi.WindowEventis sealed and window_manager depends onnativeapi: ^0.5.5. The bridge inpackage:window_manager/legacy.dartswitches over it exhaustively, so a nativeapi 0.5.x release that adds aWindowEventsubclass would turn that switch into a compile error for every app using the bridge, without any change on the app's side.Change
Events without a 0.5.x counterpart (created, closed, property and occlusion changes) go through a
defaultbranch instead of an explicit list. The branch stays reachable, so the analyzer does not flag it, and a future event type is ignored instead of breaking the build.Also adds
@visibleForTesting debugBindWindow(nativeapi.Window?)so tests can drive the bridge with a simulatednativeapi.Window.Tests
New
test/legacy_event_compat_test.dartwith a fakenativeapi.Window: events without a 0.5.x counterpart are dropped, and handled events around them still arrive. (A test cannot add a subclass to a sealed class, so the compile-time part is covered by the analyzer run.)dart format --set-exit-if-changed .,flutter analyze(package and example) andflutter test(package and example) pass locally (Flutter 3.47.7, Windows), and the full CI workflow passes on the identical commit in my fork.Related
Part of a set of independent PRs, each based on
mainand mergeable on its own: widgets #598, #599, #600, #601; legacy bridge #602, #603, #604 (this), #605, #606.#602 and #605 add the identical
debugBindWindowtest seam; all legacy PRs merge cleanly with this one. If #606 lands too,debugBindWindowcan delegate tobindWindow.