My source code generates two errors:
- A value of type 'XFile' can't be assigned to a variable of type 'File'.
- Instance member 'pickImage' can't be accessed using static access.at
Here is my source code:
`
String _tweetText;
File _pickedImage;
bool _loading = false;
handleImageFromGallery() async {
try {
File imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);
if (imageFile != null) {
setState(() {
_pickedImage = imageFile;
});
}
} catch (e) {
print(e);
}
}
`
I am new to flutter and could not solve these issues so far.
To solve fiest issue write this code
To solve second issue you have to assign avarible to _pickedImage or make it null by adding
?