create static method

Future<RtcEngine> create(
  1. String appId
)

Creates an RtcEngine instance.

Unless otherwise specified, all the methods provided by the RtcEngine class are executed asynchronously. anyrtc recommends calling these methods in the same thread.

Note

  • You must create an RtcEngine instance before calling any other method.
  • You can create an RtcEngine instance either by calling this method or by calling RtcEngine.createWithAreaCode. The difference between RtcEngine.createWithAreaCode and this method is that RtcEngine.createWithAreaCode enables you to specify the connection area.
  • The RTC Flutter SDK supports creating only one RtcEngine instance for an app for now.

Parameter appId The App ID issued to you by anyRTC. See How to get the App ID. Only users in apps with the same App ID can join the same channel and communicate with each other. Use an App ID to create only one RtcEngine instance. To change your App ID, call destroy to destroy the current RtcEngine instance, and after destroy returns 0, call create to create an RtcEngine instance with the new App ID.

Returns

Implementation

static Future<RtcEngine> create(String appId) async {
  if (_engine != null) return _engine!;
  _methodChannel.invokeMethod('create', {
    'appId': appId
  });
  _engine = RtcEngine._();
  return _engine!;
}