register abstract method

void register(
  1. CallbackWithReturn<CallbackInputType, CallbackReturnType> callback
)

Registers a new callback function.

The callback will be stored and invoked when call is called. Each call adds a distinct registration: registering the same function twice makes it run twice per dispatch, and unregister then removes one registration at a time.

Example:

final handler = CallbackHandler<int, String>();
handler.register((n) => 'Number: $n');

Implementation

void register(
    CallbackWithReturn<CallbackInputType, CallbackReturnType> callback);