重新编译后文件丢失

时间:2019-04-27 17:41:49

标签: dart flutter

Error: 编译文件时,出现以下错误:library is in a package that is not known

这是指文件:我的页面文件夹下的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

My code

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]),

1 个答案:

答案 0 :(得分:0)

好吧,所以看一下错误提示

  

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未能在页面目录下找到文件home.dart。

由于您之前说过它可以工作,所以唯一的逻辑解释是您已重命名,删除或移动了“ home.dart”文件或其父文件夹。