Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue Mapbox used after being disposed #751

Open
mayananand369 opened this issue Oct 30, 2024 · 1 comment
Open

Fix issue Mapbox used after being disposed #751

mayananand369 opened this issue Oct 30, 2024 · 1 comment

Comments

@mayananand369
Copy link

I have a logout button in my app.
After logging out, an exception is being thrown which says: A MapboxMap was used after being disposed.
Once you have called dispose() on a MapboxMap, it can no longer be used.

Below are the relevant codes:

 void _showLogoutConfirmationDialogUsing(
    BuildContext context,
  ) =>
      ActionDialog.show(
        context,
        content: context.localize.areYouSureYouWantToLogout,
        onActionDismissed: () {
          Navigator.of(
            context,
          ).pop();
        },
        onActionConfirmed: () {
          Navigator.of(
            context,
          ).pop();

          context.read<Web3AuthLogoutBloc>().add(
                const Web3AuthLogoutEvent.logout(),
              );
        },
      );
 @override
  void dispose() {
    _mapboxMap?.dispose();
    _clickedRestriction.dispose();
    _centerLocationNotifier.dispose();
    _mapStyleNotifier.dispose();

    super.dispose();
  }
Screen.Recording.2024-10-30.at.9.49.35.PM.mov
@evil159
Copy link
Contributor

evil159 commented Oct 30, 2024

@mayananand369 could you put a breakpoint in MapboxMap.dispose(), is it called twice by any chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants