init method Null safety

Future<void> init(
  1. EMOptions options
)

初始化SDK 指定options.

Implementation

Future<void> init(EMOptions options) async {
  _options = options;
  EMLog.v('init: $options');
  // 直接返回当前登录账号和是否登陆过
  Map result =
      await _channel.invokeMethod(EMSDKMethod.init, options.toJson());
  Map map = result[EMSDKMethod.init];
  _currentUsername = map['currentUsername'];
  _isLoginBefore = () {
    if (map.containsKey("isLoginBefore")) {
      return map['isLoginBefore'] as bool;
    } else {
      return false;
    }
  }();

  return null;
}