getLoginUserStorage method

Future<WepinUser?> getLoginUserStorage()

Implementation

Future<WepinUser?> getLoginUserStorage() async {
  final data = await wepinStorage.getAllLocalStorage();
  if (data == null) {
    return null;
  }
  final walletId = await wepinStorage.getLocalStorage<String>(StorageDataType.walletId);
  final userInfo = await wepinStorage.getLocalStorage<WepinUser>(StorageDataType.userInfo);
  final token = await wepinStorage.getLocalStorage<WepinToken>(StorageDataType.wepinConnectUser);
  final userStatus = await wepinStorage.getLocalStorage<WepinUserStatus>(StorageDataType.userStatus);

  if (userInfo == null || token == null || userStatus == null) {
    return null;
  }

  return WepinUser(
    status: userInfo.status,
    userInfo: userInfo.userInfo,
    walletId: walletId,
    userStatus: userStatus,
    token: token,
  );
}