bind<TInput, TOutput> method

void bind<TInput, TOutput>(
  1. BloomRpcContract<TInput, TOutput> contract,
  2. BloomRpcHandler<TInput, TOutput> handler
)

Registers a server handler for contract.

rpcRouter.bind(getTaskContract, (ctx, input) async {
  final taskId = ctx.pathParams['id']!;
  return taskDb.get(taskId);
});

Implementation

void bind<TInput, TOutput>(
  BloomRpcContract<TInput, TOutput> contract,
  BloomRpcHandler<TInput, TOutput> handler,
) {
  _bindings.add(BloomRpcBinding<TInput, TOutput>(contract, handler));
}