Link.split constructor

Link.split(
  1. bool test(
    1. Request request
    ),
  2. Link left, [
  3. Link right = const PassthroughLink()
])

Create a Link which routes to the left link if test returns true. Otherwise it routes to the right link, which defaults to passthrough.

Implementation

factory Link.split(
  bool Function(Request request) test,
  Link left, [
  Link right = const PassthroughLink(),
]) =>
    _RouterLink((Request request) => test(request) ? left : right);