/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-8.1.3/lib/fluttertoast.dart:165:28: Error: Member not found: 'Overlay.maybeOf'.
var _overlay = Overlay.maybeOf(context!);
^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-8.1.3/lib/fluttertoast.dart:154:18: Error: The getter 'mounted' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
framework.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'mounted'.
if (context?.mounted != true) {
^^^^^^^
3
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
After adding fluttertoast in my project it shows this problem while I run project on my device.
Now, what does it mean?
I was trying to show toast when an error or success occurred. But without snackbar fluttertoast is the only option to do.
But after adding dependency this problem showed.
Update: Found the actual issue:
Flutter toast v8.1.3 cannot work with a Flutter version older than 3.7.0 because of a breaking change in Flutter v3.7.0. You have to either use fluttertoast v8.1.2 or you have to upgrade your flutter version to v3.7.0+.
Old Answer
I faced a similar issue after running the flutter pub upgrade but even after rolling back the changes in the pubspec.yaml file, I got the same error. But this issue was fixed after rolling back the changes in the pubspec.lock file. Make sure to do flutter clean after reverting changes in pubspec.lock file.
I also came across the same problem,
Due to some limitations I was not able to change the flutter version, and Changing the version of fluttertoast has not led to any success. so what I do is try some other alternatives
toast: ^0.3.0
https://pub.dev/packages/toast
I removed fluttertoast completely from the project and install a new dependency by running the command in the terminal
flutter pub add toast
usage:
Toast.show("Toast plugin app", duration: Toast.lengthShort, gravity: Toast.bottom);
try to use this:
if (!mounted) return;
snackBar(yourText, context);//or use your fluttertoast
if you had any problem or question i'm here to answer.
happy coding.
Unfortunately, this error is caused by a version incompatibility between the fluttertoast package and your version of Flutter. The Overlay.maybeOf method was removed in Flutter 2.0 and replaced with Overlay.of, which is likely what the fluttertoast package is using.
In order to fix this error, you can try upgrading to the latest version of fluttertoast, or if that doesn't work, downgrade your version of Flutter to a version compatible with the version of fluttertoast you are using.
Building flutter tool...
Error: Error when reading '../../../flutter/packages/flutter_tools/.packages': No such file or directory
Error: Couldn't resolve the package 'flutter_tools' in 'package:flutter_tools/executable.dart'.
../../../flutter/packages/flutter_tools/bin/flutter_tools.dart:7:8: Error: Not found: 'package:flutter_tools/executable.dart'
import 'package:flutter_tools/executable.dart' as executable;
^
../../../flutter/packages/flutter_tools/bin/flutter_tools.dart:10:14: Error: Method not found: 'main'.
executable.main(args);
^^^^
I had the issue in this post before and i followed its solution : I am not able to use flutter as im getting an error with the dart sdk, only it has been working for weeks until today then i ran into the error above.. anything i can do..
I reinstalled flutter linux version and it works just fine.
After upgrading my flutter from 2.10.5 to 3.0.0, I have those errors on my android studio and the project don't build anymore on windows 10.
How can I solve this problems.
Thanks
'Size' is imported from both 'dart:ffi' and 'dart:ui'.
bitsdojo_window package seems to have issues when Flutter 3 was introduced. One of possible ways is to run this command on your terminal
dart fix --apply
and
flutter pub upgrade
This happens because of Flutter 3.0. This package needs to get updated for Flutter 3.0
check This Link for the answer it requires an update which the developer said he's working on it
I yesterday upgraded to Flutter 2.0.6 and when I added web support to an existing project I am getting this error
lib/generated_plugin_registrant.dart:16:3: Error: Getter not found: 'AnotherFlushbarPlugin'.
AnotherFlushbarPlugin.registerWith(registrar);
I am using a dependency Flushbar thought it might be due to that I removed that package run flutter clean but no use the error is still there
Fixed the issue there was package Flushbar code in the yaml file, I removed the line "another_flushbar": ^1.10.10 to fix the issue
I update the Flutter latest stable version 1.20.1 when I click the run button on an already existing project it shows me this error:
Could not resolve the package 'characters' in 'package: characters/characters.dart'.
But when I create a new project and try to run it works.
Following the Github issue below, it is a common issue after upgrading to a different Flutter Version
Could not resolve package characters
In my case, I resolved the issue with flutter clean.