Flutter iOS App: SocketException: OS Error: Bad file descriptor, errno = 9

0
277


Multiple Flutter iOS users of my app have received the following error in their application while sending a multipart request for uploading images:

SocketException: OS Error: Bad file descriptor, errno = 9, address = <back-end server domain>, port = 64362

The code to send the request

var request = http.MultipartRequest("POST", uri);
request.files.add(
await http.MultipartFile.fromPath(
 "images",
 imagePath,
 filename: imageName,
 ),
);
request.headers.addAll({
  "Content-type": "multipart/form-data",
});
var response = await request.send();
var response2 = await http.Response.fromStream(response);