ApiUpload class

Provides API for uploading files

final upload = ApiUpload(options: options);
...
final file1 = SharedFile(File('/some/file'));
final file2 = 'https://some/file';

final id1 = await upload.auto(file1); // File instance
final id2 = await upload.auto(file2); // URL to file
final id3 = await upload.auto(file1.path) // path to file;

Run upload process in isolate

final upload = ApiUpload(options: options);
...
final id = await upload.auto(SharedFile(File('/some/file')), runInIsolate: true);

Constructors

ApiUpload({required ClientOptions options})

Properties

apiUrl String
no setterinherited
cdnUrl String
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
options ClientOptions
final
privateKey String?
no setterinherited
publicKey String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uploadUrl String
no setterinherited

Methods

auto(Object resource, {bool runInIsolate = false, bool? storeMode, ProgressListener? onProgress, CancelToken? cancelToken}) Future<String>
Upload file resource according to type if String makes fromUrl upload if it is http/https url or try retrieve SharedFile if path is absolute, otherwise make an SharedFile request according to size
base(SharedFile file, {bool? storeMode, ProgressListener? onProgress, CancelToken? cancelToken}) Future<String>
Make upload to /base endpoint
buildUri(String url, [Map<String, dynamic> params = const {}]) Uri
inherited
createMultipartRequest(String method, Uri uri, [bool authorizeRequest = true]) → UcMultipartRequest
inherited
createRequest(String method, Uri uri, [bool authorizeRequest = true]) → UcRequest
inherited
fromUrl(String url, {Duration checkInterval = const Duration(seconds: 1), bool? storeMode, ProgressListener? onProgress}) Future<String>
Make upload to /fromUrl endpoint
multipart(SharedFile file, {bool? storeMode, ProgressListener? onProgress, CancelToken? cancelToken, int? maxConcurrentChunkRequests}) Future<String>
Make upload to /multipart endpoint maxConcurrentChunkRequests maximum concurrent requests cancelToken make cancelable request
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveStoreModeParam(bool? storeMode) String
inherited
resolveStreamedResponse(FutureOr<StreamedResponse> streamedResponse) Future<Map<String, dynamic>>
inherited
resolveStreamedResponseStatusCode(FutureOr<StreamedResponse> streamedResponse) Future<Response>
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited