addRouting<T> method

void addRouting<T>(
  1. PapilioRoutingConfiguration<T> getRoutingFunctions(
    1. IocContainer container
    )
)

Adds a PapilioRouterDelegate to the IocContainer so that you can use it in your MaterialApp. This is the main method for wiring up your Papilio app

Implementation

void addRouting<T>(
  PapilioRoutingConfiguration<T> Function(IocContainer container)
      getRoutingFunctions,
) {
  addSingleton(getRoutingFunctions);

  _addDelegate<T>();

  addSingleton((container) {
    final routingFunctions = container.get<PapilioRoutingConfiguration<T>>();

    return PapilioRouteInformationParser<T>(
      routingFunctions.parseRouteInformation,
      routingFunctions.restoreRouteInformation,
    );
  });
}