FlutterDownloader class

Provides access to all functions of the plugin in a single place.

Constructors

FlutterDownloader()

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 Properties

debug bool
If true, more logs are printed.
no setter
initialized bool
Whether the plugin is initialized. The plugin must be initialized before use.
no setter

Static Methods

cancel({required String taskId}) Future<void>
Cancels download task with id taskId.
cancelAll() Future<void>
Cancels all enqueued and running download tasks.
enqueue({required String url, required String savedDir, String? fileName, Map<String, String> headers = const {}, bool showNotification = true, bool openFileFromNotification = true, bool requiresStorageNotLow = true, bool saveInPublicStorage = false, bool allowCellular = true, int timeout = 15000}) Future<String?>
Creates a new task which downloads a file from url to savedDir and returns a unique identifier of that new download task.
initialize({bool debug = false, bool ignoreSsl = false}) Future<void>
Initializes the plugin. This must be called before any other method.
loadTasks() Future<List<DownloadTask>?>
Loads all tasks from SQLite database.
loadTasksWithRawQuery({required String query}) Future<List<DownloadTask>?>
Loads tasks from SQLite database using raw query.
open({required String taskId}) Future<bool>
Opens the file downloaded by download task with taskId. Returns true if the downloaded file can be opened, false otherwise.
pause({required String taskId}) Future<void>
Pauses a running download task with id taskId.
registerCallback(DownloadCallback callback, {int step = 10}) Future<void>
Registers a callback to track the status and progress of a download task.
remove({required String taskId, bool shouldDeleteContent = false}) Future<void>
Deletes a download task from the database. If the given task is running, it is also canceled. If the task is completed and shouldDeleteContent is true, the downloaded file will be deleted.
resume({required String taskId, bool requiresStorageNotLow = true, int timeout = 15000}) Future<String?>
Resumes a paused download task with id taskId.
retry({required String taskId, bool requiresStorageNotLow = true, int timeout = 15000}) Future<String?>
Retries a failed download task.