How to save image using flutter and firebase | firebase_storage | upload using putFile() | Part 2

preview_player
Показать описание
@TrueCoders

Part 1 Select Image

How to Install Firebase on Flutter?
Sign In And User Registration in Flutter.
Flutter Save Data To Firebase.

save an image using Flutter and Firebase, you can follow these steps:
1 Create a Firebase project and enable Firebase Storage.
6 Use the putFile() method to upload the file to Firebase Storage, passing in the File object representing the image file.
7 Listen to the TaskSnapshot returned by putFile() to get updates on the upload progress.

firebase_storage is a Flutter plugin that provides easy access to Firebase Cloud Storage, a cloud-based object storage solution that allows you to securely store and serve user-generated content, such as images, videos, and audio files, from your app.

Firebase Cloud Storage provides a simple and easy-to-use API that enables developers to upload and download files to and from the cloud, manage access to those files, and monitor file upload and download progress.

The firebase_storage plugin provides a simple way to integrate Firebase Cloud Storage into your Flutter app. With this plugin, you can easily upload and download files, monitor the upload and download progress, and manage access to the files stored in Firebase Cloud Storage.

Overall, firebase_storage is a useful tool for Flutter developers who want to leverage the power of cloud storage in their apps. It allows you to store and retrieve user-generated content in a secure and scalable way, without having to manage the infrastructure and complexity of hosting the files yourself.
Рекомендации по теме
Комментарии
Автор

thanks alot for showing me how to save the data but how can i call the data ex profile picture?

carlosjohnson
Автор

I need help please, "String resp =
await StoreData().saveData(bio: bio, website: website, file: _image!);
}" in my screen that's set up to for profile page, the resp is yellow. and it says its not being used. can you please help

INematJ
Автор

you are not providing documentId or any reference id of firebase, how come it store in your firebase? how come it should get to know that, it should be saved in that particular firebase

Justme-dkvm
Автор

I did the same code but when I restart the emulator it does not display the image I selected from the gallery rather it shows the default image. Please help me in that case

nsbhhsh
Автор

thanks for u work but can u share ur source ? because i did the same nd no file saved in firebase

xenia
Автор

Future<String> _uploadImage(
{required String imageName, required File image}) async {
try {
final ref = FirebaseStorage.instance
.ref()
.child('user_images')
.child('$imageName.jpg');
await ref.putFile(image);
final imageUrl = await ref.getDownloadURL();
return imageUrl;
} catch (e) {
rethrow;
}
}

AdhamFaisal
welcome to shbcf.ru