create static method

Future<NativePeerConnectionFactory> create({
  1. Map<String, dynamic>? options,
})

Builds a fresh per-call factory. Initializes the WebRTC plugin if it hasn't been initialized yet.

options mirrors the WebRTC.initialize options map

Implementation

static Future<NativePeerConnectionFactory> create({
  Map<String, dynamic>? options,
}) async {
  final response = await WebRTC.invokeMethod(
    'createPeerConnectionFactory',
    <String, dynamic>{
      'options': options ?? <String, dynamic>{},
    },
  );

  if (response == null) {
    throw Exception(
        'createPeerConnectionFactory returned null, something wrong');
  }

  final factoryId = response['factoryId'] as String;
  return NativePeerConnectionFactory._(factoryId);
}