addRoute method Null safety

void addRoute(
  1. int pointer,
  2. PointerRoute route,
  3. [Matrix4? transform]
)

Adds a route to the routing table.

Whenever this object routes a PointerEvent corresponding to pointer, call route.

Routes added reentrantly within PointerRouter.route will take effect when routing the next event.

Implementation

void addRoute(int pointer, PointerRoute route, [Matrix4? transform]) {
  final Map<PointerRoute, Matrix4?> routes = _routeMap.putIfAbsent(
    pointer,
    () => <PointerRoute, Matrix4?>{},
  );
  assert(!routes.containsKey(route));
  routes[route] = transform;
}