'tyring to upoad image to firebase but im getting Xfile has no instance method 'getByteData' error
this is my upload function but its posting to firebase.
List<XFile>? images = [];
Future<Future<String>> postImages(imagefile) async {
String filename = DateTime.now().millisecondsSinceEpoch.toString();
FirebaseStorage db = FirebaseStorage.instance;
await db
.ref()
.child("images")
.child(filename)
.putData((await imagefile.getByteData()).buffer.asUint8List());
return db.ref().child("images").child(filename).getDownloadURL();
}
``
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
