1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] onPopInvokedWithResult being called twice

Discussão em 'Mobile' iniciado por Stack, Novembro 7, 2024 às 12:42.

  1. Stack

    Stack Membro Participativo

    I have a PopScope that handles some cleanup, but for some reason, the onPopInvokedWithResult callback is being called twice.

    How can this happen?

    @immutable
    class MyRoute extends GoRouteData {

    const MyRoute({
    // ...
    });

    @override
    Page buildPage(BuildContext context, GoRouterState state) => MaterialPage(
    key: state.pageKey,
    child: PopScope(
    child: MyPageWithScaffold(
    // ...
    ),
    onPopInvokedWithResult: (didPop, result) {
    if (didPop) {
    doCleanup();
    }
    },
    ),
    );
    }

    Continue reading...

Compartilhe esta Página