uploadUserScreenshotToFirebase method

Future<String> uploadUserScreenshotToFirebase({
  1. required String filePath,
  2. required String imagePath,
  3. required String imageName,
})

uploadUserScreenshotToFirebase is function used for uploading the taken screenshot to the Firebase Storage.

Implementation

Future<String> uploadUserScreenshotToFirebase({
  required String filePath,
  required String imagePath,
  required String imageName,
}) async {
  File file = File(filePath);

  try {
    await firebase_storage.FirebaseStorage.instance
        .ref('$imagePath/$imageName.png')
        .putFile(file);
    String downloadURL = await firebase_storage.FirebaseStorage.instance
        .ref('$imagePath/$imageName.png')
        .getDownloadURL();
    return downloadURL;
  } on firebase_core.FirebaseException {
    rethrow;
  }
}