getFromUser method

Future<NIMUserInfo?> getFromUser()

Implementation

Future<NIMUserInfo?> getFromUser() async {
  final String? accountId = fromAccountId;
  if (accountId == null) {
    return null;
  }
  var userResult =
      await NimCore.instance.userService.getUserList([accountId]);
  if (userResult.isSuccess &&
      userResult.data != null &&
      userResult.data!.isNotEmpty) {
    return userResult.data!.first;
  } else {
    final userCloudResult =
        await NimCore.instance.userService.getUserListFromCloud([accountId]);
    if (userCloudResult.isSuccess &&
        userCloudResult.data != null &&
        userCloudResult.data!.isNotEmpty) {
      return userCloudResult.data!.first;
    }
  }
  return null;
}