更新时间:2023-01-25 23:21:53
下面是没有任何错误且说明清楚的代码
Here are code of without any error and clarifying well
class _SplashScreenState extends State<SplashScreen> {
Future<bool> isFirstTime() async {
var isFirstTime = SharedPref.pref.getBool('first_time');
if (isFirstTime != null && !isFirstTime) {
SharedPref.pref.setBool('first_time', false);
return false;
} else {
SharedPref.pref.setBool('first_time', false);
return true;
}
}
@override
void initState() {
super.initState();
Timer(Duration(seconds: 3), () {
isFirstTime().then((isFirstTime) {
isFirstTime ? print("First time") : print("Not first time");
});
}
);
}
}