filterEndpoint method

void filterEndpoint(
  1. String endpoint, {
  2. Handler behavior = EventSubscription._defaultBehaviorImpl,
})

filters an endpoint to be consumed with special behavior. if endpoint ends in '*', all URIs starting with endpoint are consumed by this filter.

Implementation

void filterEndpoint(String endpoint,
    {Handler behavior = EventSubscription._defaultBehaviorImpl}) {
  if (endpoint.endsWith('*')) {
    //then this is a path and we want to glob match
    this._registeredPaths.update(endpoint.substring(0, endpoint.length - 1),
        (list) => list + [behavior],
        ifAbsent: () => [behavior]);
  } else {
    this._registeredUris.update(endpoint, (list) => list + [behavior],
        ifAbsent: () => [behavior]);
  }
}