Skip to content

Image Upload Request

Veli Bacik edited this page Nov 26, 2021 · 1 revision

You can make a image upload request like this example:

 Future<String?> uploadFile({required File file}) async {
    final _formData = FormData.fromMap({
      "image": await MultipartFile.fromFile(file.path)
    });
    return (await _networkManager.uploadFile<String>('http/upload_server.com', _formData,
            headers: Map.fromEntries([MapEntry('custom_config', '{"type":"ATTACHMENT"}')])))
        .data;
  }
Clone this wiki locally