Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从一个文件导入到另一个文件时出现问题-颤振_Android_Flutter_Dart_Import - Fatal编程技术网

Android 从一个文件导入到另一个文件时出现问题-颤振

Android 从一个文件导入到另一个文件时出现问题-颤振,android,flutter,dart,import,Android,Flutter,Dart,Import,我有一个destination.dart文件,包括建筑物的详细信息列表,并已将该文件导入到building_screen.dart和building_carousel.dart中。然而,尽管它过去是无错误的,但现在我得到一个错误,即尽管Destination.dart和导入中存在Destination,但Destination需要定义为class。我如何解决这个问题 import 'package:flutter/material.dart'; (this is where it shows e

我有一个destination.dart文件,包括建筑物的详细信息列表,并已将该文件导入到building_screen.dart和building_carousel.dart中。然而,尽管它过去是无错误的,但现在我得到一个错误,即尽管Destination.dart和导入中存在Destination,但Destination需要定义为class。我如何解决这个问题

import 'package:flutter/material.dart'; (this is where it shows error)

class Building {
  String imageUrl;
  String name;
  String description;
  String date;
  String details;
  List<String> imagePaths;

  Building({
    this.imageUrl,
    this.name,
    this.description,
    this.date,
    this.details,
    this.imagePaths,
  });
}


List<Building> buildings = [
  Building(
    imageUrl: 'assets/images/close-up_library.jpg',
    name: 'The Library',
    description: 'View the innovative Library of Birmingham',
    date: 'Date built: 2010',
    details: ' '
    ];
导入“包装:颤振/材料.省道”;(这是显示错误的地方)
班级建设{
字符串imageUrl;
字符串名;
字符串描述;
字符串日期;
字符串详细信息;
列出图像路径;
建筑({
这个.imageUrl,
这个名字,
这个.说明,,
这个日期,
这个.细节,,
这是一条路径,
});
}
列出建筑物=[
建筑(
imageUrl:'assets/images/close-up_library.jpg',
名称:'图书馆',
描述:“查看伯明翰创新图书馆”,
日期:“建造日期:2010年”,
详细信息:“”
];
其他文件正在导入此文件以显示建筑。
另外,当我尝试运行应用程序时,会显示一个“空值上使用的空检查运算符”错误,“Dart编译器意外退出”。

您能提供文件的代码以及如何导入它们吗?看起来您还没有在其中定义类,因为错误正好说明了这一点?是的,我现在已将代码添加到问题中