loginRoom method

Future<Map> loginRoom(
  1. String roomID,
  2. dynamic user,
  3. dynamic config
)

Implementation

Future<Map<dynamic, dynamic>> loginRoom(
    String roomID, dynamic user, dynamic config) async {
  ZegoUserWeb webUser =
      ZegoUserWeb(userID: user["userID"], userName: user["userName"]);
  ZegoRoomConfigWeb webConfig = ZegoRoomConfigWeb(
      maxMemberCount: config["maxMemberCount"],
      token: config["token"],
      isUserStatusNotify: config["isUserStatusNotify"]);
  var result;
  result = await (() {
    Map completerMap = createCompleter();
    ZegoFlutterEngine.instance.loginRoom(roomID, webUser, webConfig,
        completerMap["success"], completerMap["fail"]);
    return completerMap["completer"].future;
  })();
  final map = {};
  map["errorCode"] = 0;
  map["extendedData"] = "{}";
  if (result == false) {
    map["errorCode"] = 1;
  }
  return Future.value(map);
}