File sampleImage;
Future getImage() async {
var tempImage = await ImagePicker.pickImage(source: ImageSource.gallery);
setState(() {
sampleImage = tempImage;
});
}
void submitValues(){
Blob blob = new Blob(sampleImage);
}
I need to convert the File into Blob in flutter in order to save in the database, I can't find any reference to do so.
Ok, after further investigation i figured it out
void submitValues() async {
Blob blob = new Blob(await sampleImage.readAsBytes());
}
await needs to be added along with readAsBytes in order to convert the File type variable into Blob
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.