on<T> method

void on<T>(
  1. String event,
  2. NorbixWebhookHandler<T> handler
)

Register the typed handler for one event. The payload is cast to T.

Use the entity type for entity events (UserDto), Mutation<UserDto> for user.updated, List for batch events, etc.

Implementation

void on<T>(String event, NorbixWebhookHandler<T> handler) {
  _handlers[event] = (payload, e) => handler(payload as T, e);
}