FileHandler class

Handler for file upload and download operations using DioFlow.

This class provides convenient methods for uploading and downloading files while leveraging all DioFlow features like authentication, retry logic, etc.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

downloadAndHandle(dynamic endpoint, UploadMethodsEnum methodTypes, {Map<String, dynamic>? parameters, Map<String, dynamic>? pathParameters, RequestOptionsModel requestOptions = const RequestOptionsModel(responseType: ResponseType.bytes), CancelToken? cancelToken, Future<void> onBytes(Uint8List bytes)?}) → Future<ResponseModel>
Downloads a file and (optionally) lets you handle the bytes to save to disk. Example:
downloadBytes(dynamic endpoint, UploadMethodsEnum methodTypes, {Map<String, dynamic>? parameters, Map<String, dynamic>? pathParameters, RequestOptionsModel requestOptions = const RequestOptionsModel(responseType: ResponseType.bytes), CancelToken? cancelToken}) → Future<ResponseModel>
Downloads a file as raw bytes (memory). Example:
downloadText(dynamic endpoint, UploadMethodsEnum methodTypes, {Map<String, dynamic>? parameters, Map<String, dynamic>? pathParameters, RequestOptionsModel requestOptions = const RequestOptionsModel(responseType: ResponseType.plain), CancelToken? cancelToken}) → Future<ResponseModel>
Downloads a text-based file (e.g. CSV, plain-text, logs). Example:
getFileInfo(dynamic endpoint, {Map<String, dynamic>? parameters, RequestOptionsModel requestOptions = const RequestOptionsModel(), Map<String, dynamic>? pathParameters, CancelToken? cancelToken}) → Future<ResponseModel>
Gets file information without downloading the entire file.
uploadFile<T>(dynamic endpoint, Map<String, T> files, UploadMethodsEnum methodTypes, {Map<String, dynamic>? additionalData, RequestOptionsModel requestOptions = const RequestOptionsModel(), ProgressCallback? onProgress, Map<String, dynamic>? parameters, Map<String, dynamic>? pathParameters, CancelToken? cancelToken}) → Future<ResponseModel>
Uploads multiple files to the specified endpoint.