diff --git a/lib/helpers/api_helper.dart b/lib/helpers/api_helper.dart index e5b069b..9a4bc89 100644 --- a/lib/helpers/api_helper.dart +++ b/lib/helpers/api_helper.dart @@ -37,12 +37,17 @@ class APIHelper { else url = Uri.https(config().apiServerName, path); - final data = FormData.from(request.args); + final data = FormData.fromMap(request.args); // Process files (if required) if (multipart) - request.files.forEach( - (k, v) => data.add(k, UploadFileInfo(v, v.path.split("/").last))); + for (var key in request.files.keys) { + var v = request.files[key]; + data.files.add(MapEntry( + key, + await MultipartFile.fromFile(v.path, + filename: v.path.split("/").last))); + } // Execute the request final response = await Dio().post( diff --git a/pubspec.lock b/pubspec.lock index d90cdcf..adcde19 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -57,13 +57,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" - cookie_jar: - dependency: transitive - description: - name: cookie_jar - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" crypto: dependency: transitive description: @@ -91,7 +84,7 @@ packages: name: dio url: "https://pub.dartlang.org" source: hosted - version: "2.2.2" + version: "3.0.9" flutter: dependency: "direct main" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index a88e85d..45d819d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 + cupertino_icons: ^0.1.3 # Preferences are useful for a lot of things (ex: login tokens) shared_preferences: ^0.5.6+3 @@ -34,7 +34,7 @@ dependencies: image_picker: ^0.6.3+4 # The HTTP client is used to make requests on the Comunic API - dio: ^2.1.2 + dio: ^3.0.9 # This plugins allows to load remote images cached_network_image: ^2.0.0