Navigator pop when using persistent_bottom_nav_bar - Flutter
141
This worked for me.
Alert(
context: context,
type: AlertType.error,
title: "RFLUTTER ALERT",
desc: "Flutter is more awesome with RFlutter Alert.",
buttons: [
DialogButton(
child: Text(
"COOL",
style: TextStyle(color: Colors.white, fontSize: 20),
),
onPressed: () => Navigator.of(context, rootNavigator: true).pop(),
width: 120,
)
],
).show();
Author by
uyhaW
Updated on December 30, 2022Comments
-
uyhaW over 1 year
I am currently using
persistent_bottom_nav_bar: ^4.0.2
andrflutter_alert
but the problem is when I callNavigator.of(context).pop();
I always get this error:FlutterError (This widget has been unmounted, so the State no longer has a context (and should be considered defunct). Consider canceling any active work during "dispose" or using the "mounted" getter to determine if the State is still active.)
That happens when I use
persistent_bottom_nav_bar
, I have tried to usebottomNavigationBar
which is a property ofScaffold
widget, and that's really fine and there is no problem withNavigator.of(context).pop();
. Is there a way to do Navigator pop when usingpersistent_bottom_nav_bar
-
Nabin Dhakal over 2 yearscan you show the showDialog code
-