[ad_1]
I am new migrating to flutter latest model. I have been migrating Flutter v1 to v3, however after I use the plugin file_picker: ^5.0.1 gallery and digital camera are working wonderful, however each time is an file, this error seems, I have been looking out in all places and I have not discovered an answer for this, does anybody know the way I can repair this downside?
var request = http.MultipartRequest('POST', Uri.parse(baseURL! + urlFiles));
request.fields['apiKey'] = API_KEY;
request.fields['username'] = username as String;
request.fields['authenticationCode'] = authCode as String;
request.information.add(await http.MultipartFile.fromPath('myfile', filename)); //<-- Error
var streamedResponse = await request.ship();
last response = await http.Response.fromStream(streamedResponse);
// If the response from the server is right code == 200 we proceed with the parsing of the json
if (response.statusCode == 200) {
last responseJson = json.decode(response.physique);
That is how I have been working information and pictures:
_pickFile() async {
FilePickerResult? end result = await FilePicker.platform.pickFiles();
if (end result == null) return;
PlatformFile file = end result.information.first;
print('File Title: ${file.title}');
print('File Dimension: ${file.measurement}');
print('File Extension: ${file.extension}');
print('File Path: ${file.path}');
// if (path == null) return;
Navigator.pop(context);
_uploadFile('$path');}
_getPhoto(ImageSource supply) async {
var picture = await ImagePicker().getImage(supply: supply, imageQuality: 50);
if (picture == null) return;
path = picture.path;
Navigator.pop(context);
if (kDebugMode) {
print('---> ImagePicker $path');
}
_uploadFile(path as String);}
[ad_2]
