1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 22:39:22 +00:00

Updated Dio

This commit is contained in:
Pierre HUBERT 2020-03-24 15:01:34 +01:00
parent 13394811bb
commit 6e867041e8
3 changed files with 11 additions and 13 deletions

View File

@ -37,12 +37,17 @@ class APIHelper {
else else
url = Uri.https(config().apiServerName, path); url = Uri.https(config().apiServerName, path);
final data = FormData.from(request.args); final data = FormData.fromMap(request.args);
// Process files (if required) // Process files (if required)
if (multipart) if (multipart)
request.files.forEach( for (var key in request.files.keys) {
(k, v) => data.add(k, UploadFileInfo(v, v.path.split("/").last))); var v = request.files[key];
data.files.add(MapEntry(
key,
await MultipartFile.fromFile(v.path,
filename: v.path.split("/").last)));
}
// Execute the request // Execute the request
final response = await Dio().post( final response = await Dio().post(

View File

@ -57,13 +57,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
cookie_jar:
dependency: transitive
description:
name: cookie_jar
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
@ -91,7 +84,7 @@ packages:
name: dio name: dio
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.2" version: "3.0.9"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter

View File

@ -22,7 +22,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # 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) # Preferences are useful for a lot of things (ex: login tokens)
shared_preferences: ^0.5.6+3 shared_preferences: ^0.5.6+3
@ -34,7 +34,7 @@ dependencies:
image_picker: ^0.6.3+4 image_picker: ^0.6.3+4
# The HTTP client is used to make requests on the Comunic API # 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 # This plugins allows to load remote images
cached_network_image: ^2.0.0 cached_network_image: ^2.0.0