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

26 lines
585 B
Dart

import '../services/Storage.dart';
import 'dart:convert';
class UserServices{
static getUserInfo() async{
List userinfo;
try {
List userInfoData = json.decode(await Storage.getString('userInfo'));
userinfo = userInfoData;
} catch (e) {
userinfo = [];
}
return userinfo;
}
static getUserLoginState() async{
var userInfo=await UserServices.getUserInfo();
if(userInfo.length>0&&userInfo[0]["username"]!=""){
return true;
}
return false;
}
static loginOut(){
Storage.remove('userInfo');
}
}