【发布时间】:2021-07-16 19:51:22
【问题描述】:
在清单一中,我得到了一些物品。每次这些项目都在变化。有时,我可以在列表中获得不止一条记录。 在第二个列表中,我想存储列表一的所有数据。这样,我就可以显示列表二的所有项目了。
为了更清楚。
列表一 = "/temp/file1.jpeg"
列表二 = "/temp/file1.jpeg"
列表一 = "/temp/file2.jpeg"
列表二 = "/temp/file1.jpeg,/temp/file2.jpeg"
我试过了
void _openDocumentFileExplorer({fileType: FileType.custom}) async {
setState(() => _loadingPath = true);
try{
_paths = (await FilePicker.platform.pickFiles(
type: fileType,
allowMultiple: true,//_multiPick,
allowedExtensions: ['pdf']))?.files;
} on PlatformException catch (e) {
print("Unsupported operation" + e.toString());
} catch (ex) {
print('$ex');
}
if (!mounted) return;
setState(() {
_loadingPath = false;
_fileName = _paths != null ?
_paths!.map((e) => e.name).toString() : '...';
});
}
ListView.separated(
itemCount:
_paths != null && _paths!.isNotEmpty
? _paths!.length
: 1,
itemBuilder:
(BuildContext context, int index) {
final bool isMultiPath =
_paths != null && _paths!.isNotEmpty;
final String name = _paths!
.map((e) => e.name)
.toList()[index];
//filesGB store the full path + the file name
final filesGB = _paths!
.map((e) => e.path)
.toList()[index]
.toString();
print (filesGB);
_paths?.addAll(allFiles!.map((e) ));
allFiles.addAll(filesGB.toList());
allFiles.addAll(filesGB);
// allFilesV2.addAll(filesGB);
但它不起作用。我收到此错误消息。 "参数类型'String'不能赋值给参数类型'Iterable'"
请问您有什么建议吗?
【问题讨论】: