“错误: 在 Flutter 找不到成员: ‘ packageRoot’”

当我试图在 Android Studio 上运行任何 flutter 项目时,我得到了这个特殊的错误:

[+11147 ms] [+13655 ms] ../../flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.2/lib/src/interface/local_platform.dart:46:19: Error: Member not found: 'packageRoot'.
[        ] [   +1 ms]       io.Platform.packageRoot; // ignore: deprecated_member_use
[        ] [        ]                   ^^^^^^^^^^^

在网上找了好一会儿,但是没有找到任何可行的解决方案。有人能帮忙解决这个问题吗?

54543 次浏览

I faced the same issue. I fixed it.

flutter channel stable
flutter upgrade
flutter pub upgrade