currentUser property

User? get currentUser

获取当前用户

使用 GetX 的依赖注入功能查找并返回当前用户实例 如果未找到用户实例,则返回 null

Implementation

static User? get currentUser {
  try {
    User re = Get.find();
    return re;
  } catch (e) {
    return null;
  }
}