ServerFunction<I, O> constructor

ServerFunction<I, O>({
  1. required ServerFunctionHandler<I, O> handler,
  2. String? id,
  3. ValueDecoder<I>? decodeInput,
  4. HttpMethod method = HttpMethod.post,
  5. Iterable<Middleware> middleware = const <Middleware>[],
})

Creates a server function and its invocation policy.

Implementation

ServerFunction({
  required this.handler,
  this.id,
  this.decodeInput,
  this.method = HttpMethod.post,
  Iterable<Middleware> middleware = const <Middleware>[],
}) : middleware = List<Middleware>.unmodifiable(middleware) {
  if (id?.isEmpty ?? false) {
    throw ArgumentError.value(id, 'id', 'Must not be empty.');
  }
}