名称 'XFile' 不是类型,因此不能用作类型参数。尝试将名称更正为现有类型,或定义名为 'XFile' 的类型



问题就在这里(https://i.stack.imgur.com/D0zPF.png)

我已经尝试运行flutter clean和flutter pub get,但没有变化,我不知道是什么导致了这个问题。我很感激你们的帮助。

你可以试试这个吗?


chooseFile() async {
final chosenFile = await ImagePicker().pickImage(source: ImageSource.gallery);

if(chosenFile != null) {
return chosenFile.path;
}
}

如果它不工作,你可以告诉我你之前尝试过的代码,并解释所需的结果。

最新更新