I try to upload image to Firebase local storage emulator from flutter desktop software. I'm using file_selector_windows plugin for file selection.
void _openImageFile() async {
final typeGroup = XTypeGroup(
label: 'images',
extensions: ['jpg', 'png'],
);
final files = await FileSelectorPlatform.instance
.openFiles(acceptedTypeGroups: [typeGroup]);
final file = files[0];
final fileName = file.name;
final filePath = file.path;
final responseFireStorage = await http.post(
Uri.parse('http://localhost:9199/v0/b/default-bucket/o?name=sample.jpg'),
headers: <String, String>{
'Content-Type': 'image/jpeg',
},
body: filePath,
);
print(responseFireStorage.statusCode);
}
Error: 400 BadRequest