Error:编译我的文件时出现以下错误:library is in a package that is not known
这是指我的pages文件夹下的文件:home.dart。
这些是pubspec.yaml文件中的my dependencies:
dependecies:
flutter:
sdk: flutter
http: "^0.12.0+1"
intl: "^0.15.8"
charts_flutter: "0.6.0"
cupertino_icons: ^0.1.2
import 'package:fLutter/materiaL.dart';
import 'package:charts_fLutter/fLutter.dart' as charts
class PieChart extends StatefulWidget {
final Widget child;
override
PieChart({Key key, this.child}) : super(key: key);
_PieChartState createState() => _PieChartState();
class GPieChartState extends State<PieChart> {
List<charts.Series<Effl,String>> _seriesPieData;
_generateData() {
var pieData = [
new Effl( ' > ObJectlf ' , 35.8, Colors.bZue[6oo]),
new Effl( ' < ObJectlf ' , 8.3, Colors.red[6oo]),
好的,所以看看它说的错误
Refers, in an import, to the following library: package:efficience001/pages/home.dart That library is in a package that is not know. Maybe you forgot to mention it in your pubspec.yaml file?
这意味着Flutter无法在pages目录下找到home.dart文件。
由于您之前说它之前有效,唯一可能的逻辑解释是您已重命名,删除或移动了文件“home.dart”或其父文件夹。