putFile static method

Future<Map<String, dynamic>?> putFile(
  1. String url,
  2. File file
)

直传文件

Implementation

static Future<Map<String,dynamic>?> putFile(String url, File file) async {
  try {
    assetDio();
    var result = await _dio!.put(
      url,
      data: MultipartFile.fromFile(file.path),
    );
    return result.isSuccessful ? result.data : null;
  } on DioException catch (e) {
    return _convertException(e, url);
  } on SocketException catch (e) {
    return _convertException(e, url);
  }
}