createSession method

  1. @override
Future<Session> createSession()
override

Creates a new screenshare session. Sessions will start in a 'pending' state. To activate a session an agent must have joined and all required consent given by the user. Pending sessions contain a six digit code that can be displayed for the user to give to a support agent.

Throws a PlatformException if a session cannot be created (e.g. no network connection).

Implementation

@override
Future<Session> createSession() async {
  Map? rvalue;
  try {
    rvalue = await methodChannel.invokeMapMethod('createSession');
  } on PlatformException catch (e) {
    print('Cannot create session: $e');
    rethrow;
  }
  if (rvalue == null) {
    throw PlatformException(
        code: 'COBROWSE_IO_ERROR', message: 'createSession failed');
  }
  return Session._build(rvalue);
}