0
httpErrorHandle(
          response: response,
          context: context,
          onSuccess: () async {

            Navigator.pushNamedAndRemoveUntil(
                context, HomeScreen.routeName, (route) => false);
          });

I have this code in an asynchronous function outside stateful widget and there is this problem "Don't use 'BuildContext's across async gaps. Try rewriting the code to not reference the 'BuildContext'. "

I've tried using mounted as I've seen on the internet but it doesn't work because i'm non on a stateful widget

0 Answers0