简体   繁体   中英

how to create and connect a storage content in firebase for flutter app?

Well, I made a flutter application that contains some svg images that can be interacted with by clicking on the region, and its name appears (such as the map of the United States of America) I want to put this content in firebase. the user should conect to show the content stocked in firebase any way or example to do it?

You can use firebase_storage package for that

  1. In console.firebase.google.com select you project/create project and enable storage.

  2. Add package firebase_storage in pubspec.yaml, find the latest version on pub.dev

  3. In your flutter project use these function

StorageReference storageRef =FirebaseStorage.instance.ref().child('assets/images/myImage.jpg'); // put your images in assets folder and specify the path in the child

StorageUploadTask uploadTask = storageRef.putData(imageData);// creating the reference and uploading the image to firebase

uploadTask.onComplete.then((value) {
  print('Image uploaded successfully');
}); // When image is uplaod it will print on the console...

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM