create static method

Future<Peer> create({
  1. bool initiator = false,
  2. bool verbose = false,
  3. Map<String, dynamic>? config,
  4. RTCDataChannelInit? dataChannelConfig,
})

Creates a new Peer

Use initiator to specify if this is the peer that should initiate the connection. For the webrtc config the default is to use publicly available stun server config is used. Although this works during development it could get taken down at any moment and does not support the turn protocol. If transfer is not working you can turn on logging with the verbose option.

Implementation

static Future<Peer> create(
    {bool initiator = false,
    bool verbose = false,
    Map<String, dynamic>? config,
    RTCDataChannelInit? dataChannelConfig}) async {
  var conf = config ?? _googleStunConfig;
  var connection = await createPeerConnection(conf, _loopbackConstraints);
  return Peer._init(connection, initiator, verbose, dataChannelConfig);
}