feat: add onLocationChanged for deep linking - #2
Draft
marcossevilla wants to merge 1 commit into
Draft
Conversation
Adds an optional onLocationChanged callback that derives flow state from the current RouteInformation, both at cold start (the platform's default route) and at runtime (a system pushRouteInformation call, e.g. a deep link received while the app is in the foreground). Only the outermost (root) FlowBuilder - one with no ancestor FlowBuilder, detected via a private _FlowScope marker - reacts to system-level deep links, routed through the pushRouteInformation forwarding path fixed in the prior commit. A nested FlowBuilder derives its own initial state from the location its parent hands it when constructing its page. Backward compatible: omitting onLocationChanged keeps existing behavior unchanged. Closes felangel#41
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.
Stacked on #1.
Adds an optional
onLocationChangedcallback that derives flow state from the currentRouteInformation, both at cold start (the platform's default route) and at runtime (a systempushRouteInformationcall, e.g. a deep link received while the app is in the foreground).Only the outermost (root)
FlowBuilder— one with no ancestorFlowBuilder, detected via a private_FlowScopemarker — reacts to system-level deep links, routed through thepushRouteInformationforwarding path fixed in #1. A nestedFlowBuilderderives its own initial state from the location its parent hands it when constructing its page.Deliberately narrower than the abandoned WIP in felangel#99: reuses
Page.name/RouteSettings.namefor page locations instead of a newFlowPage/location:type, and doesn't attempt browser URL sync on web (documented as a follow-up, not required for v1).Backward compatible: omitting
onLocationChangedkeeps existing behavior unchanged.Closes felangel#41
Test plan
flutter test— 42/42 passing (38 from fix: forward pushRouteInformation to WidgetsBinding #1 + 4 new in theonLocationChangedgroup: cold-start seeding, foreground interception, backward-compat when omitted, nested FlowBuilder non-interference)dart analyze— clean (only pre-existing deprecation infos)