DeepLinkHandler<T extends Object?> class abstract

Abstract base class for handling deep links with custom logic.

Extend this class to create custom deep link handlers that can perform complex operations beyond simple navigation, such as:

  • Saving referral codes
  • Processing promotional links
  • Handling authentication flows
  • Executing business logic before navigation

Example:

// In your app, create a base type:
abstract class AppDeepLinkHandler extends DeepLinkHandler<DeferredAction<dynamic>> {}

// Then use it for all handlers:
class ReferralDeepLinkHandler extends AppDeepLinkHandler {
  const ReferralDeepLinkHandler();

  @override
  bool canHandle(Uri uri) => true; // RouteInfo already filtered by path

  @override
  DeferredAction<dynamic>? createAction(Uri uri, RouteInfo route) {
    final code = uri.pathSegments.last;
    return SaveReferralCodeAction(code: code);
  }
}
Annotations

Constructors

DeepLinkHandler()
Creates a constant deep link handler.
const

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

canHandle(Uri uri) → bool
Determines if this handler can process the given URI.
createAction(Uri uri, RouteInfo route) → T?
Creates an action for processing the deep link.
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