initUserInfo static method

Future<DataResult> initUserInfo(
  1. UserProvider userProvider
)

初始化用户信息

Implementation

static Future<DataResult> initUserInfo(UserProvider userProvider) async {
  ///用户信息
  String? userId = SpUtil.getString(AppConfig.userId);
  dynamic userEntity;
  if (userId != null) {
    var userDbProvider = UserInfoDbProvider();
    userEntity = await userDbProvider.getUserInfo(userId);
    if (userEntity != null) {
      userProvider.setUserEntity(userEntity);
    }
  }
  bool? isLogin = userEntity != null && SpUtil.getBool(AppConfig.userLogin)!;
  return DataResult(userEntity, isLogin == true);
}