I am using snackbar to display the toast in my flutter app. Now, when I am running the app, I am a build failed error:
The getter 'mounted' isn't defined for the class 'BuildContext'. ../…/lib/fluttertoast.dart:155
I do not get why because I am not using fluttertoast plugin anywhere in my application.
Please see my code below:
void _showSnackBar(String message) {
final snackBar = SnackBar(
content: Text(message),
backgroundColor: SSColours.primary,
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}
May you please help, thanks.
I found my solution. After doing much investigation, I found out there was nothing wrong with my code, I just needed to upgrade my flutter to the latest version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With