FutureBuilder(
future: Future.delayed(Duration(seconds: 3)),
builder: (c, s) =>
s.connectionState != ConnectionState.done
? Center(child: CircularProgressIndicator())
: nextPage()
When I am pointing to the nextPage() function, my FutureBuilder throws an error.
Here is my nextPage() function, where it is pointing in the FutureBuilder:
nextPage() async{
bool visitedFlag = await getVIsitingFlag();
setVIsitingFlag();
if (visitedFlag == true) {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => HomeScreen()));
}
else {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => NewScreen()));
}
}
The error is:
type 'Future' is not a subtype of type 'Widget'