DeeplinkHandlerStrategy class abstract

Strategy for iterating through multiple deeplink handlers.

Determines the order in which handlers are called when processing a deeplink. Iteration stops at the first handler that returns a non-null result.

Two built-in strategies are provided:

To implement a custom strategy, extend this class and override apply:

class MyCustomStrategy extends DeeplinkHandlerStrategy {
  const MyCustomStrategy();

  @override
  Iterable<DeeplinkHandler> apply(Iterable<DeeplinkHandler> handlers) {
    // Return handlers in the desired order.
    return handlers.where((h) => h is MyPriorityHandler).followedBy(
      handlers.where((h) => h is! MyPriorityHandler),
    );
  }
}
Annotations
  • @experimental

Constructors

DeeplinkHandlerStrategy()
const
DeeplinkHandlerStrategy.fifo()
FIFO (First In, First Out): first registered handler is called first.
const
factory
DeeplinkHandlerStrategy.lifo()
LIFO (Last In, First Out): last registered handler is called first.
const
factory

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

apply(Iterable<DeeplinkHandler> handlers) Iterable<DeeplinkHandler>
Returns handlers in the order this strategy defines.
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