login method Null safety

Future<NIMResult<void>> login(
  1. NIMLoginInfo loginInfo
)

The API for login. Once the API is called successfully, the SDK will automatically connect to the CommsEase server, and then send user information to the server, which will finally return the login result.

Implementation

Future<NIMResult<void>> login(NIMLoginInfo loginInfo) {
  final info;
  final sdkOptions = NimCore.instance.sdkOptions;
  if (sdkOptions != null && loginInfo.customClientType == null) {
    info = NIMLoginInfo(
      account: loginInfo.account,
      token: loginInfo.token,
      authType: loginInfo.authType,
      loginExt: loginInfo.loginExt,
      customClientType: sdkOptions.customClientType,
    );
  } else {
    info = loginInfo;
  }
  return _platform.login(info);
}