getLoggedInDevicesFromServer method Null safety

Future<List<EMDeviceInfo>> getLoggedInDevicesFromServer(
  1. {required String username,
  2. required String password}
)

Gets all the information about the logged in devices under the specified account.

Param username The username you want to get the device information.

Param password The password.

Return TThe list of the logged-in devices.

Throws A description of the exception. See {@link EMError}.

Implementation

Future<List<EMDeviceInfo>> getLoggedInDevicesFromServer(
    {required String username, required String password}) async {
  EMLog.v('getLoggedInDevicesFromServer: $username, "******"');
  Map req = {'username': username, 'password': password};
  Map result = await _channel.invokeMethod(
      ChatMethodKeys.getLoggedInDevicesFromServer, req);
  try {
    EMError.hasErrorFromResult(result);
    List<EMDeviceInfo> list = [];
    result[ChatMethodKeys.getLoggedInDevicesFromServer]?.forEach((info) {
      list.add(EMDeviceInfo.fromJson(info));
    });
    return list;
  } on EMError catch (e) {
    throw e;
  }
}