Issue
How to show splash screen in flutter for 3 seconds and then go next my login screen.
I have tried.countdowntimer but import is unresolved
import 'package: countDown/countDown.dart';
CountDown cd new CountDown(new Duration(seconds: 4));
CountDown is unresolved
Android Studio & Flutter
Solution
You can execute code with a delay using Future.delayed
new Future.delayed(const Duration(seconds: 3), () {
Navigator.pushNamed(context, '/login');
});
update
const delay 3;
widget.countdown delay;
StreamSubscription sub;
sub new Stream.periodic(const Duration(seconds: 1), (count) {
setState(() > widget.countdown--);
if(widget.countdown < 0) {
sub.cancel();
Navigator.pushNamed(context, '/login');
}
});
Answered By – Günter Zöchbauer