LDRoutePatterns class abstract final

Builds an LDScreenNameExtractor that reports the route pattern a navigation matched instead of the URL it was pushed with.

Routers that navigate by URL — GetX, go_router, Beamer, and anything else pushing '/orders/42' — put the concrete path in route.settings.name, so every order becomes its own screen. That splits one screen into thousands and puts an order id in a name that is shown in the UI. Naming the patterns your app registers collapses them back:

LDNavigatorObserver(
  screenNameExtractor: LDRoutePatterns.extractor(const [
    '/orders',
    '/orders/:id',
    '/orders/:id/receipt',
  ]),
)

A tap through that flow then reports /orders, /orders/:id, and /orders/:id/receipt, whatever ids were involved.

Pattern syntax is the one those routers already use: a :name segment matches exactly one segment, and a trailing * matches the rest of the path. The query string and fragment are always dropped, so '/search?q=shoes' cannot fragment a screen either.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

extractor(Iterable<String> patterns, {bool skipUnmatched = false}) → LDScreenNameExtractor
An extractor matching against patterns, most specific match first.