clearUser static method
清除用户信息(退出登录)
Implementation
static Future<bool> clearUser() async {
try {
final sp = await SharedPreferences.getInstance();
final success = await sp.remove(_userKey);
if (success) {
print('✅ 用户信息已清除');
}
return success;
} catch (e) {
print('❌ 清除用户信息失败: $e');
return false;
}
}