invokeMethod method

Future<String> invokeMethod(
  1. String arg_methodName,
  2. List<String?> arg_arguments
)

Implementation

Future<String> invokeMethod(
    String arg_methodName, List<String?> arg_arguments) async {
  final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
      'dev.flutter.pigeon.SignalRHostApi.invokeMethod', codec,
      binaryMessenger: _binaryMessenger);
  final Map<Object?, Object?>? replyMap =
      await channel.send(<Object?>[arg_methodName, arg_arguments])
          as Map<Object?, Object?>?;
  if (replyMap == null) {
    throw PlatformException(
      code: 'channel-error',
      message: 'Unable to establish connection on channel.',
    );
  } else if (replyMap['error'] != null) {
    final Map<Object?, Object?> error =
        (replyMap['error'] as Map<Object?, Object?>?)!;
    throw PlatformException(
      code: (error['code'] as String?)!,
      message: error['message'] as String?,
      details: error['details'],
    );
  } else if (replyMap['result'] == null) {
    throw PlatformException(
      code: 'null-error',
      message: 'Host platform returned null value for non-null return value.',
    );
  } else {
    return (replyMap['result'] as String?)!;
  }
}