我正在使用 image_picker: ^0.8.4+4 ,但出现此错误。我能做些什么来使这段代码正确?
late File selectedImage;
bool _isLoading = false;
CrudMethods crudMethods = CrudMethods();
Future getImage() async {
var image = await ImagePicker().pickImage(source: ImageSource.gallery);
setState(() {
selectedImage = image; //A value of type 'XFIle' can't be assigned to a variable of type 'File' error.
});
}
uploadBlog() async {
// ignore: unnecessary_null_comparison
if (selectedImage != null) {
setState(() {
_isLoading = true;
});
Run Code Online (Sandbox Code Playgroud) dart flutter flutter-dependencies flutter-layout imagepicker