fix: null safe

This commit is contained in:
bggRGjQaUbCoE
2024-08-27 11:03:44 +08:00
parent 0e332ce080
commit 24458c106f
3 changed files with 11 additions and 11 deletions

View File

@@ -11,8 +11,8 @@ class FansController extends GetxController {
int ps = 20;
int total = 0;
RxList<FansItemModel> fansList = <FansItemModel>[].obs;
late int mid;
late String name;
late int? mid;
late String? name;
var userInfo;
RxString loadingText = '加载中...'.obs;
RxBool isOwner = false.obs;
@@ -23,9 +23,9 @@ class FansController extends GetxController {
userInfo = userInfoCache.get('userInfoCache');
mid = Get.parameters['mid'] != null
? int.parse(Get.parameters['mid']!)
: userInfo.mid;
isOwner.value = mid == userInfo.mid;
name = Get.parameters['name'] ?? userInfo.uname;
: userInfo?.mid;
isOwner.value = mid == userInfo?.mid;
name = Get.parameters['name'] ?? userInfo?.uname;
}
Future queryFans(type) async {