callService method

Future<Response> callService(
  1. String name, {
  2. String? isolateId,
  3. Map<String, dynamic>? args,
})

Call a service that is registered by exactly one client.

Implementation

Future<Response> callService(
  String name, {
  String? isolateId,
  Map<String, dynamic>? args,
  // ignore: avoid-redundant-async, for some reasons tests fail without `async
}) async {
  final registeredMethod = _registeredMethodsForService[name];
  if (registeredMethod == null) {
    throw Exception('There is no registered method for service "$name"');
  }
  return service!.callMethod(
    registeredMethod,
    isolateId: isolateId,
    args: args,
  );
}