我在 Flutter 中导入包时偶然发现了一个问题,我试图通过运行 flutter packages get 并关闭 Android Studio 中的项目并重新打开它来解决这个问题。
import 'package:task_02_category_widget/category.dart';
这是上面的行,当我运行它时遇到的错误在控制台中给出了以下错误。
Your application could not be compiled, because its dependencies could
not be established.
The following Dart file:
/Users/username/Documents/flutter_rectangle_2/lib/main.dart
...refers, in an import, to the following library:
package:task_02_category_widget/category.dart
That library is in a package that is not known. Maybe you forgot to
mention it in your pubspec.yaml file?