[Solved] Error: Member not found: ’packageRoot’ in Flutter

In this post, we are going to show you how to solve Error: Member not found: 'packageRoot' error in Flutter. This error occurs when you have recently upgraded the Flutter SDK version. See the solutions below to solve this error.

path/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0/
lib/src/interface/local_platform.dart:46:19: Error: Member not found: 'packageRoot'. io.Platform.packageRoot; // ignore: deprecated_member_use ^^^^^^^^^^^

Here, you have upgraded the Flutter SDK, but the platform plugin of Flutter is an older one. You can solve this error with these two solutions.

To solve this error, you have to upgrade the pub of downloaded as cache on Flutter SDK. To upgrade pub, hit the command below on the terminal.

flutter pub upgrade

Now, run your app, the error might be fixed now. If the error is not gone yet, then try the solutions below:

You need to upgrade Flutter to a stable version and upgrade the packages and plugins as well. To upgrade Flutter to the stable version, hit the command below at your project folder.

flutter channel stable
flutter upgrade

It will upgrade you Flutter SDK to the stable version, after upgrading SKD, upgrade the pub as well.

flutter pub upgrade

If "flutter pub upgrade" is not working, then you can manually mention the greater version of the platform plugin at pubspect.yaml file. Put the line on your pubspec.yaml file.

dependency_overrides:
  platform: ^3.1.0

You can solve this error by cleaning build-cache as well and downloading all the packages again. Hit the command below to clear the cache and rebuild the package's cache.

flutter clean
flutter pub get

In this way, you can solve "Error: Member not found: 'packageRoot'" Error in Flutter.

1 Commet on this Article

Lucas Aschenbach

Thanks! `flutter pub upgrade` did the trick for me!

2 years ago


Please Wait...