registerFallback method

void registerFallback(
  1. dynamic callback(
    1. Parameters parameters
    )
)

Registers a fallback method on this server.

A server may have any number of fallback methods. When a request comes in that doesn't match any named methods, each fallback is tried in order. A fallback can pass on handling a request by throwing a RpcException.methodNotFound exception.

callback can return either a JSON-serializable object or a Future that completes to a JSON-serializable object. Any errors in callback will be reported to the client as JSON-RPC 2.0 errors. callback may send custom errors by throwing an RpcException.

Implementation

void registerFallback(Function(Parameters parameters) callback) {
  _fallbacks.add(callback);
}