try to pass the parent context to your main screen.
@override Widget build(BuildContext context) { return mainScreen(context); } mainScreen(BuildContext context) { return FutureBuilder(....