respondWith method
void
respondWith({})
Implementation
void respondWith(
{List<dynamic>? arguments,
Map<String, dynamic>? argumentsKeywords,
bool isError = false,
String? errorUri,
YieldOptions? options}) {
if (isError) {
if (options != null) {
assert(options.progress == false);
}
assert(UriPattern.match(errorUri!));
final error = Error(
MessageTypes.codeInvocation, requestId, HashMap(), errorUri,
arguments: arguments, argumentsKeywords: argumentsKeywords);
_responseStreamController.add(error);
} else {
var invokeArguments = arguments;
var invokeArgumentsKeywords = argumentsKeywords;
if (options?.pptScheme == 'wamp') {
// It's E2EE payload
invokeArguments =
E2EEPayload.packE2EEPayload(arguments, argumentsKeywords, options!);
invokeArgumentsKeywords = null;
} else if (options?.pptScheme != null) {
// It's some variation of PPT
invokeArguments =
PPTPayload.packPPTPayload(arguments, argumentsKeywords, options!);
invokeArgumentsKeywords = null;
}
final yield = Yield(requestId,
options: options,
arguments: invokeArguments,
argumentsKeywords: invokeArgumentsKeywords);
_responseStreamController.add(yield);
}
if (options != null && !options.progress) {
_responseStreamController.close();
}
}