基础库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
757 B

  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_comm/models/user/user_info_model.dart';
  3. ///
  4. /// 用户信息
  5. ///
  6. class UserInfoNotifier with ChangeNotifier {
  7. UserInfoModel _userInfo;
  8. /// 初始化,是否需要读取缓存信息?
  9. UserInfoNotifier();
  10. /// 更新用户数据
  11. void setUserInfo(UserInfoModel loginUser) async {
  12. print('${loginUser.toString()}');
  13. this._userInfo = loginUser;
  14. // 缓存数据 TODO
  15. /// token
  16. }
  17. /// 退出登陆
  18. void unLogin() {
  19. this._userInfo = null;
  20. // 清除缓存数据 TODO
  21. }
  22. /// 获取登陆数据
  23. UserInfoModel getUserInfoModel() {
  24. if (null != _userInfo) {
  25. return _userInfo;
  26. }
  27. // TODO 需要读取缓存的数据?
  28. return null;
  29. }
  30. }