-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Is it possible to send files to a server via HTTP from a shared isolate in WEB?
If so, could you provide an example?
I've been having trouble with this and the error I receive when using the isolate is:
"ClientException: Null check operator used on a null value, uri='...'"
Thanks in advance!
EJEMPLO:
var request = http.MultipartRequest('post', url);
request.files.add(http.MultipartFile.fromBytes(
'foto', List<int>.from(file['bytes'].toList()),
filename: '${file['id']}.${file['ext']}', contentType: mime
));
request.fields['datos'] = json.encode(
Map<String, String>.from({
'folder': folder, 'filename': '${file['id']}.${file['ext']}'
})
);
request.headers['Content-Type'] = 'multipart/form-data';
request.headers['Accept'] = 'application/json';
print(request.files.first.field);
print(request.files.first.contentType);
print(request.files.first.length);
print(request.files.first.filename);
print(request.files.first);
print(request.fields);
print(request.files.first.isFinalized);
print('----------------------------');
http.StreamedResponse? response;
try {
response = await request.send();
} catch (e) {
return {'abort': true, 'body': e.toString()};
}
Plugins:
http: ^1.3.0
http_parser: ^4.0.2
Metadata
Metadata
Assignees
Labels
No labels