I think your problem arises from here: prefShare.spAppGetter();
Since Future<bool> spAppGetter() async {...}
is an async function returning a future you should call it with await
so that you can be sure spAppGetter has completed before you call bool status = prefShare.isNew ?? false;
and to do so you should mark your main function as async as well. Your main function would look something like this then:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await prefShare.spAppGetter();
bool status = prefShare.isNew ?? false;
prefShare.spAppNew();
runApp(
MaterialApp(home: status == true ? ButtonScreen() : Home()),
);
}
CLICK HERE to find out more related problems solutions.