createWithConfig static method
Creates an RtcEngine instance.
Since v3.3.1
Unless otherwise specified, all the methods provided by the RtcEngine instance are executed asynchronously. Agora recommends calling these methods in the same thread.
Note
- You must create the RtcEngine instance before calling any other method.
- You can create an RtcEngine instance either by calling this method or by calling create. The difference between create and this method is that this method enables you to specify the region for connection.
- The Agora RTC Native SDK supports creating only one RtcEngine instance for an app for now.
Parameterconfig
Configurations for the RtcEngine instance. For details, see RtcEngineConfig.
Returns
- An RtcEngine instance if the method call succeeds.
- The error code, if this method call fails:
Implementation
static Future<RtcEngine> createWithConfig(RtcEngineConfig config) async {
if (_engine != null) return _engine!;
await _invokeMethod('create', {'config': config.toJson(), 'appType': 4});
_engine = RtcEngine._();
return _engine!;
}