0

I am trying to make login logout system , every thing works fine but one scene has auto focus so when I open the following login --> focus scene --> logout --> login --> focus scene , after will crash

there is dispose

      @override
      void dispose() {
        _inputFocusNode.dispose();
        _textController.dispose();
        super.dispose();
      }

here when logout:

await Navigator.of(context, rootNavigator: true)
                  .pushNamedAndRemoveUntil(
                      '/login', (Route<dynamic> route) => false,);
  • I run it on web (google chrome)
  • flutter SDK 3.3.4
  • Mac os

when it crash

Ali Ayasrah
  • 75
  • 11

1 Answers1

0

Difficult to answer with the little code snippet. Check if your routes are configured.

Example:

routes: {
// When navigating to the "/" route, build the FirstScreen widget.
'/': (context) => const FirstScreen(),
// When navigating to the "/second" route, build the SecondScreen widget.
'/second': (context) => const SecondScreen(),
},

Also refer to this stack overflow, if this helps; Flutter remove all routes

Godwin
  • 512
  • 4
  • 14
  • thank you for reply I am using Getx , and all pages in the list ` 'debugShowCheckedModeBanner: false, getPages: appRoutes(), initialRoute: '/', initialBinding: MainBinding(), transitionDuration: Duration.zero, theme: appTheme,' ` – Ali Ayasrah Oct 19 '22 at 22:39