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. The same callback instance can only be registered once (identified by hashCode).

Example:

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

Implementation

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