future.delayed in flutter code example
Example 1: future delayed flutter
Future.delayed(Duration(seconds: 5), () {
// 5s over, navigate to a new page
Navigator.pushNamed(context, MaterialPageRoute(builder: (_) => Screen2()));
});
Example 2: flutter wait for specific time
await Future.delayed(const Duration(seconds: 2), (){});