Skip to content

feat: add onLocationChanged for deep linking - #2

Draft
marcossevilla wants to merge 1 commit into
fix/117-system-navigation-push-forwardingfrom
feat/41-on-location-changed
Draft

feat: add onLocationChanged for deep linking#2
marcossevilla wants to merge 1 commit into
fix/117-system-navigation-push-forwardingfrom
feat/41-on-location-changed

Conversation

@marcossevilla

@marcossevilla marcossevilla commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Stacked on #1.

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 #1. A nested FlowBuilder derives 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.name for page locations instead of a new FlowPage/location: type, and doesn't attempt browser URL sync on web (documented as a follow-up, not required for v1).

Backward compatible: omitting onLocationChanged keeps existing behavior unchanged.

Closes felangel#41

Test plan

  • flutter test — 42/42 passing (38 from fix: forward pushRouteInformation to WidgetsBinding #1 + 4 new in the onLocationChanged group: cold-start seeding, foreground interception, backward-compat when omitted, nested FlowBuilder non-interference)
  • dart analyze — clean (only pre-existing deprecation infos)
  • Verified the nesting-detection test is load-bearing (temporarily forced root detection to always return true and confirmed the nested test fails)

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
@marcossevilla marcossevilla changed the title feat/41 on location changed feat: add onLocationChanged for deep link/location-driven flow state Aug 25, 2026
@marcossevilla marcossevilla changed the title feat: add onLocationChanged for deep link/location-driven flow state feat: add onLocationChanged for deep linking Aug 25, 2026
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.

[Proposal] Add Routing Support

1 participant