rpcContract<TInput, TOutput> function
BloomRpcContract<TInput, TOutput>
rpcContract<TInput, TOutput>({
- required BloomHttpMethod method,
- required String pathTemplate,
- dynamic encodeInput(
- TInput input
- TInput decodeInput(
- dynamic json
- dynamic encodeOutput(
- TOutput output
- TOutput decodeOutput(
- dynamic json
- String? summary,
- String? description,
- List customCacheKey(
- TInput input
Convenience factory function for declaring a BloomRpcContract.
final getUser = rpcContract<void, User>(
method: BloomHttpMethod.get,
pathTemplate: '/users/:id',
decodeOutput: User.fromJson,
);
Implementation
BloomRpcContract<TInput, TOutput> rpcContract<TInput, TOutput>({
required BloomHttpMethod method,
required String pathTemplate,
dynamic Function(TInput input)? encodeInput,
TInput Function(dynamic json)? decodeInput,
dynamic Function(TOutput output)? encodeOutput,
TOutput Function(dynamic json)? decodeOutput,
String? summary,
String? description,
List<dynamic> Function(TInput input)? customCacheKey,
}) {
return BloomRpcContract<TInput, TOutput>(
method: method,
pathTemplate: pathTemplate,
encodeInput: encodeInput,
decodeInput: decodeInput,
encodeOutput: encodeOutput,
decodeOutput: decodeOutput,
summary: summary,
description: description,
customCacheKey: customCacheKey,
);
}