Error uploading image: [firebase_storage/object-not-found] No object exists at the desired reference. #10984
Unanswered
mynameismhmd
asked this question in
Q&A
Replies: 1 comment
-
Its weird kinda workaround but this actually seems to work for me when I am breaking the requests into different segments and awaited all of them. for example; `final firebaseimageupload = FirebaseStorage.instance
` |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
here is my code how can I fix this`import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:firebase_storage/firebase_storage.dart' as firebase_storage;
class EditImagePage extends StatefulWidget {
@OverRide
_EditImagePageState createState() => _EditImagePageState();
}
class _EditImagePageState extends State {
File? _imageFile;
String? _uploadedImageUrl;
@OverRide
void initState() {
super.initState();
_pickImage();
}
void _pickImage() async {
final pickedImage = await ImagePicker().getImage(source: ImageSource.gallery);
if (pickedImage != null) {
setState(() {
_imageFile = File(pickedImage.path);
});
}
}
Future _saveImage() async {
if (_imageFile != null) {
final fileName = '${DateTime.now().millisecondsSinceEpoch}.jpg';
final destination = 'images/$fileName';
}
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Edit Image'),
actions: [
IconButton(
onPressed: _saveImage,
icon: Icon(Icons.save),
),
],
),
body: Column(
children: [
Expanded(
child: _imageFile != null
? Image.file(_imageFile!)
: Container(),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
onPressed: _pickImage,
icon: Icon(Icons.photo_library),
),
}
}
`
Beta Was this translation helpful? Give feedback.
All reactions