How to resolved Member not found: ‘packageRoot’ how to solve ignore: deprecated_member_use in Flutter?

Root Cause of this problem

  • platform pub is out of date. Most likely in your case it’s a transitive dependency from path_provider pub.
  • For some reason, flutter pub get won’t update platform which is a transitive dependency. Even if you change the version of its parent pub path_provider to the latest version and call flutter pub get again.

Solutions:

First of all try to these command:

  • flutter pub upgrade
  • flutter clean
  • flutter pub get

if cleaning and getting the packages didn’t work. This error started after I upgraded flutter. I was on the master channel, a quick fix for me was to switch to stable

  • flutter channel stable
  • flutter upgrade

and above process didn’t work. then try this:

flutter pub cache repair

How to Handle ignore: deprecated_member_use Warnings

This warning occurs when you’re using deprecated Flutter widgets or APIs, such as:

// Old:
FlatButton(onPressed: ..., child: Text('OK'))

// New:
TextButton(onPressed: ..., child: Text('OK'))

Deprecated buttons like FlatButton, RaisedButton, and OutlineButton have been replaced by TextButton, ElevatedButton, and OutlinedButton respectively.

If you’re using an older widget for temporary compatibility, and don’t want to refactor immediately, you might use:

 ignore: deprecated_member_use

However, it’s recommended to update your codebase instead of suppressing warnings.

Final Thoughts

The error “Member not found: ‘packageRoot’” and the deprecated_member_use warning usually occur when packages are misaligned with your current Flutter SDK version. Start by upgrading and cleaning your project. If that fails, switch to the stable channel and consider using dependency overrides.

Keeping your packages up to date and refactoring deprecated usage ensures long-term stability and performance for your Flutter apps.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More