flutter error: This widget has been unmounted, so the State no longer has a context (and should be considered defunct)
Try to use
Navigator.pop() or Navigator.of(context, rootNavigator: true).pop()
instead of Navigator.of(mounted).pop()) to close Dialog window.
This widget has been unmounted, so the State no longer has a context (and should be considered defunct). Consider canceling any. Ans:
if (mounted) {
...
}
this is because you don't dispose of or cancel any subscriptions or controllers.TRr to dispose or cancel subscriptions or controllers.