Home > Enterprise >  image can't upload to firebase database
image can't upload to firebase database

Time:10-14

I'm making an application, which has an image upload feature but not able to upload into the firebase database. the following is the image upload code that I made

    Future pickImage(ImageSource source) async {
    try {
      final image = await ImagePicker().pickImage(source: source);
      if(image == null) return;

      final imageTemporary = File(image.path);
      Reference ref = await storage.ref().child(imageTemporary.toString());
      UploadTask uploadTask = ref.putFile(imageTemporary);
      
      uploadTask.then((res) {
         res.ref.getDownloadURL();
      });
       setState(() => this.image = imageTemporary); 
      
    } on PlatformException catch(e) {
      print('failed to pick image');
    }
  }

CodePudding user response:

If you just set up the plugin for the first time and You just reload or Rerun your app then the above will occur.

So that you have to Uninstall your App First then Just Re-install your application.

/android/app/build.gradle

android {
    buildTypes {
        release {
            // other stuff

            shrinkResources false
            minifyEnabled false
        }
    }
}
  • Related