Flutter Downloader - A plugin for creating and managing download tasks. Supports iOS and Android.

Overview

Flutter Community: flutter_downloader

Flutter Downloader

pub package

A plugin for creating and managing download tasks. Supports iOS and Android.

This plugin is based on WorkManager in Android and NSURLSessionDownloadTask in iOS to run download task in background mode.

Development note:

The changes of external storage APIs in Android 11 cause some problems with the current implementation. I decide to re-design this plugin with new strategy to manage download file location. It is still in triage and discussion in this PR. It is very appreciated to have contribution and feedback from Flutter developer to get better design for the plugin.

iOS integration

Required configuration:

Note: following steps requires to open your ios project in Xcode.

  • Enable background mode.

  • Add sqlite library.

  • Configure AppDelegate:

Objective-C:

/// AppDelegate.h
#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>

@interface AppDelegate : FlutterAppDelegate

@end
* registry) { if (![registry hasPlugin:@"FlutterDownloaderPlugin"]) { [FlutterDownloaderPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterDownloaderPlugin"]]; } } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [GeneratedPluginRegistrant registerWithRegistry:self]; [FlutterDownloaderPlugin setPluginRegistrantCallback:registerPlugins]; // Override point for customization after application launch. return [super application:application didFinishLaunchingWithOptions:launchOptions]; } @end ">
// AppDelegate.m
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#include "FlutterDownloaderPlugin.h"

@implementation AppDelegate

void registerPlugins(NSObject
   * registry) {   
  
   if (![registry 
   hasPlugin:
   @"FlutterDownloaderPlugin"]) {
     [FlutterDownloaderPlugin 
   registerWithRegistrar:[registry 
   registrarForPlugin:
   @"FlutterDownloaderPlugin"]];
  }
}

- (
   BOOL)
   application
   :(UIApplication *)
   application
    
   didFinishLaunchingWithOptions
   :(
   NSDictionary *)
   launchOptions {
  [GeneratedPluginRegistrant 
   registerWithRegistry:
   self];
  [FlutterDownloaderPlugin 
   setPluginRegistrantCallback:registerPlugins];
  
   // Override point for customization after application launch.
  
   return [
   super 
   application:application 
   didFinishLaunchingWithOptions:launchOptions];
}


   @end

  

Or Swift:

import UIKit
import Flutter
import flutter_downloader

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

private func registerPlugins(registry: FlutterPluginRegistry) { 
    if (!registry.hasPlugin("FlutterDownloaderPlugin")) {
       FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin")!)
    }
}

Optional configuration:

  • Support HTTP request: if you want to download file with HTTP request, you need to disable Apple Transport Security (ATS) feature. There're two options:
  1. Disable ATS for a specific domain only: (add following codes to your Info.plist file)
<key>NSAppTransportSecuritykey>
<dict>
  <key>NSExceptionDomainskey>
  <dict>
    <key>www.yourserver.comkey>
    <dict>
      
      <key>NSIncludesSubdomainskey>
      <true/>
      
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoadskey>
      <true/>
      
      <key>NSTemporaryExceptionMinimumTLSVersionkey>
      <string>TLSv1.1string>
    dict>
  dict>
dict>
  1. Completely disable ATS: (add following codes to your Info.plist file)
<key>NSAppTransportSecuritykey>
<dict>
    <key>NSAllowsArbitraryLoadskey><true/>
dict>
  • Configure maximum number of concurrent tasks: the plugin allows 3 download tasks running at a moment by default (if you enqueue more than 3 tasks, there're only 3 tasks running, other tasks are put in pending state). You can change this number by adding following codes to your Info.plist file.

<key>FDMaximumConcurrentTaskskey>
<integer>5integer>
  • Localize notification messages: the plugin will send a notification message to notify user in case all files are downloaded while your application is not running in foreground. This message is English by default. You can localize this message by adding and localizing following message in Info.plist file. (you can find the detail of Info.plist localization in this link)
<key>FDAllFilesDownloadedMessagekey>
<string>All files have been downloadedstring>

Note:

  • This plugin only supports save files in NSDocumentDirectory

Android integration

Required configuration:

  • If your project is running on Flutter versions prior v1.12, have a look at this document to configure your Android project.

  • From Flutter v1.12 with Android v2 embedding there's no additional configurations required to work with background isolation in Android (but you need to setup your project properly. See upgrading pre 1.12 Android projects)

  • In order to handle click action on notification to open the downloaded file on Android, you need to add some additional configurations. Add the following codes to your AndroidManifest.xml:

">
<provider
    android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
    android:authorities="${applicationId}.flutter_downloader.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths"/>
provider>

Note:

  • You have to save your downloaded files in external storage (where the other applications have permission to read your files)
  • The downloaded files are only able to be opened if your device has at least an application that can read these file types (mp3, pdf, etc)

Optional configuration:

  • Configure maximum number of concurrent tasks: the plugin depends on WorkManager library and WorkManager depends on the number of available processor to configure the maximum number of tasks running at a moment. You can setup a fixed number for this configuration by adding following codes to your AndroidManifest.xml:
">


<provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities="${applicationId}.androidx-startup"
    android:exported="false"
    tools:node="merge">
    <meta-data
        android:name="androidx.work.WorkManagerInitializer"
        android:value="androidx.startup"
        tools:node="remove" />
provider>


<provider
    android:name="vn.hunghd.flutterdownloader.FlutterDownloaderInitializer"
    android:authorities="${applicationId}.flutter-downloader-init"
    android:exported="false">
    
    <meta-data
        android:name="vn.hunghd.flutterdownloader.MAX_CONCURRENT_TASKS"
        android:value="5" />
provider>
  • Localize notification messages: you can localize notification messages of download progress by localizing following messages. (you can find the detail of string localization in Android in this link)
Download started Download in progress Download canceled Download failed Download complete Download paused ">
<string name="flutter_downloader_notification_started">Download startedstring>
<string name="flutter_downloader_notification_in_progress">Download in progressstring>
<string name="flutter_downloader_notification_canceled">Download canceledstring>
<string name="flutter_downloader_notification_failed">Download failedstring>
<string name="flutter_downloader_notification_complete">Download completestring>
<string name="flutter_downloader_notification_paused">Download pausedstring>
  • PackageInstaller: in order to open APK files, your application needs REQUEST_INSTALL_PACKAGES permission. Add following codes in your AndroidManifest.xml:
">
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

Usage

Import package:

import 'package:flutter_downloader/flutter_downloader.dart';

Initialize

WidgetsFlutterBinding.ensureInitialized();
await FlutterDownloader.initialize(
  debug: true // optional: set false to disable printing logs to console
);
  • Note: the plugin must be initialized before using.

Create new download task:

final taskId = await FlutterDownloader.enqueue(
  url: 'your download link',
  savedDir: 'the path of directory where you want to save downloaded files',
  showNotification: true, // show download progress in status bar (for Android)
  openFileFromNotification: true, // click on notification to open downloaded file (for Android)
);

Update download progress:

FlutterDownloader.registerCallback(callback); // callback is a top-level or static function

Important note: your UI is rendered in the main isolate, while download events come from a background isolate (in other words, codes in callback are run in the background isolate), so you have to handle the communication between two isolates. For example:

ReceivePort _port = ReceivePort();

@override
void initState() {
	super.initState();

	IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
	_port.listen((dynamic data) {
		String id = data[0];
		DownloadTaskStatus status = data[1];
		int progress = data[2];
		setState((){ });
	});

	FlutterDownloader.registerCallback(downloadCallback);
}

@override
void dispose() {
	IsolateNameServer.removePortNameMapping('downloader_send_port');
	super.dispose();
}

static void downloadCallback(String id, DownloadTaskStatus status, int progress) {
	final SendPort send = IsolateNameServer.lookupPortByName('downloader_send_port');
	send.send([id, status, progress]);
}

Load all tasks:

final tasks = await FlutterDownloader.loadTasks();

Load tasks with conditions:

final tasks = await FlutterDownloader.loadTasksWithRawQuery(query: query);
  • Note: In order to parse data into DownloadTask object successfully, you should load data with all fields from DB (in the other word, use: SELECT * ). For example:
SELECT * FROM task WHERE status=3
  • Note: the following is the schema of task table where this plugin stores tasks information
CREATE TABLE `task` (
	`id`	INTEGER PRIMARY KEY AUTOINCREMENT,
	`task_id`	VARCHAR ( 256 ),
	`url`	TEXT,
	`status`	INTEGER DEFAULT 0,
	`progress`	INTEGER DEFAULT 0,
	`file_name`	TEXT,
	`saved_dir`	TEXT,
	`resumable`	TINYINT DEFAULT 0,
	`headers`	TEXT,
	`show_notification`	TINYINT DEFAULT 0,
	`open_file_from_notification`	TINYINT DEFAULT 0,
	`time_created`	INTEGER DEFAULT 0
);

Cancel a task:

FlutterDownloader.cancel(taskId: taskId);

Cancel all tasks:

FlutterDownloader.cancelAll();

Pause a task:

FlutterDownloader.pause(taskId: taskId);

Resume a task:

FlutterDownloader.resume(taskId: taskId);
  • Note: resume() will return a new taskId corresponding to a new background task that is created to continue the download process. You should replace the original taskId (that is marked as paused status) by this new taskId to continue tracking the download progress.

Retry a failed task:

FlutterDownloader.retry(taskId: taskId);
  • Note: retry() will return a new taskId (like resume())

Remove a task:

FlutterDownloader.remove(taskId: taskId, shouldDeleteContent:false);

Open and preview a downloaded file:

FlutterDownloader.open(taskId: taskId);
  • Note: in Android, you can only open a downloaded file if it is placed in the external storage and there's at least one application that can read that file type on your device.

Bugs/Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on Github. Pull request are also welcome.

Comments
  • --- Failed to create image decoder with message 'unimplemented'

    --- Failed to create image decoder with message 'unimplemented'

    when i perform FlutterDownloader.loadTasks(),it reported Failed to create image decoder with message 'unimplemented',

    this is my code :

    Future get _apkLocalPath async { final directory = await getExternalStorageDirectory(); return directory.path; }

    Future _executeDownload(String downLoadUrl) async { final path = await _apkLocalPath; final taskId = await FlutterDownloader.enqueue( url: downLoadUrl, fileName: 'update.apk', savedDir: path, showNotification: true, openFileFromNotification: true ); FlutterDownloader.registerCallback((id, status, progress) { if (taskId == id && status == DownloadTaskStatus.complete) { print('install'); _installApk(); } });

    await FlutterDownloader.loadTasks(); }

    [✓] Flutter (Channel stable, v1.7.8+hotfix.3, on Mac OS X 10.13.6 17G7024, locale zh-Hans-CN)

    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 10.1) [✓] iOS tools - develop for iOS devices [✓] Android Studio (version 3.3) [✓] VS Code (version 1.37.1) [✓] Connected device (1 available)

    bug 
    opened by weiliang0626 36
  • Stuck at Installing build\app\outputs\apk\app.apk...

    Stuck at Installing build\app\outputs\apk\app.apk...

    I used to use 1.2.1, it worked fine and nice. Since a few days ago, I got 'keep stopping'. Then I tried to use the most up to date version and need add a new MyApplication.

    But with it, I cannot start the app, it stuck at Installing build\app\outputs\apk\app.apk..., any idea?

    opened by wyxcoder 29
  • Downloading stuck in progress

    Downloading stuck in progress

    Got this once so far so can't provide any more details. Notification was stuck at in progress and killing the app or going offline didn't remove it. In logs progress was 100% and no visible errors. I was downloading 2 files in parallel, the other one finished just fine.

    opened by AAverin 26
  •  FAILURE: Build failed with an exception.

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > com.android.build.api.transform.TransformException: Error while generating the main dex list: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: androidx.work.ArrayCreatingInputMerger * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 3s ******************************************************************************************* The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app. See https://goo.gl/CP92wY for more information on the problem and how to fix it. ******************************************************************************************* Gradle task assembleDebug failed with exit code 1 Getting this build error after using flutter_downloader package...
    opened by Zeeshan0201 24
  • java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE

    java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE

    As comment in issue #533 , i update to v1.7.1。And the problem is occured: ` java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl) at com.sun.tools.javac.util.Assert.error(Assert.java:133) at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitVarDef(TypeAnnotations.java:1164) at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:852) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1042) at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275) at com.sun.tools.javac.code.TypeAnnotations$1.run(TypeAnnotations.java:127) at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:152) at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:129) at com.sun.tools.javac.comp.Enter.complete(Enter.java:512) at com.sun.tools.javac.comp.Enter.main(Enter.java:471) at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:857) at com.sun.tools.javac.main.Main.compile(Main.java:523) at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129) at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138) at org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.call(AnnotationProcessingCompileTask.java:93) at org.gradle.api.internal.tasks.compile.ResourceCleaningCompilationTask.call(ResourceCleaningCompilationTask.java:57) at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:54) at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:39) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:100) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:52) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38) at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:51) at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:37) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:39) at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilerFactory$2.execute(IncrementalCompilerFactory.java:101) at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilerFactory$2.execute(IncrementalCompilerFactory.java:97) at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:60) at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:44) at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler$2.call(CompileJavaBuildOperationReportingCompiler.java:59) at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler$2.call(CompileJavaBuildOperationReportingCompiler.java:51) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406) at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler.execute(CompileJavaBuildOperationReportingCompiler.java:51) at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:158) at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:126) at com.android.build.gradle.tasks.AndroidJavaCompile.compile(AndroidJavaCompile.kt:237) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103) at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:47) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42) at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:476) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394) at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:461) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:444) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:93) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:237) at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:32) at java.util.Optional.map(Optional.java:215) at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32) at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26) at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58) at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35) at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48) at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33) at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39) at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73) at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54) at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35) at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51) at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45) at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31) at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:208) at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70) at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45) at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49) at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43) at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32) at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38) at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24) at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96) at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89) at java.util.Optional.map(Optional.java:215) at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54) at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38) at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76) at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37) at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36) at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26) at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90) at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48) at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:69) at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:47) at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:140) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108) at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67) at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94) at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406) at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52) at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) at java.lang.Thread.run(Thread.java:748)

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':flutter_downloader:compileDebugJavaWithJavac'.

    Compilation failed; see the compiler error output for details.

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Get more help at https://help.gradle.org

    BUILD FAILED in 11s Exception: Gradle task assembleDebug failed with exit code 1 `

    opened by chendengyuanxm 20
  • XCode archive error 'No such module flutter_downloader' when using AppDelegate.swift

    XCode archive error 'No such module flutter_downloader' when using AppDelegate.swift

    I can't archive the project with XCode if I use AppDelegate.swift as stated in the docs. Both flutter run --release and flutter build ios work.

    • XCode: Version 11.3.1 (11C504)

    • AppDelegate.swift:

    import UIKit
    import Flutter
    import flutter_downloader
    
    @UIApplicationMain
    @objc class AppDelegate: FlutterAppDelegate {
      override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
      ) -> Bool {
        GeneratedPluginRegistrant.register(with: self)
        FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
      }
    }
    
    private func registerPlugins(registry: FlutterPluginRegistry) {
        if (!registry.hasPlugin("FlutterDownloaderPlugin")) {
           FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin"))
        }
    }
    
    • flutter doctor -v:
    [✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.1 19B88, locale pt-BR)
        • Flutter version 1.12.13+hotfix.7 at /Users/JHBitencourt/Documents/
        • Framework revision 9f5ff2306b (8 weeks ago), 2020-01-26 22:38:26 -0800
        • Engine revision a67792536c
        • Dart version 2.7.0
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
        • Android SDK at /Users/JHBitencourt/Library/Android/sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-29, build-tools 29.0.2
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 11.3.1, Build version 11C504
        • CocoaPods version 1.8.4
    
    [✓] Android Studio (version 3.5)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 41.0.2
        • Dart plugin version 191.8593
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    
    • Error:

    image_error

    opened by JHBitencourt 20
  • All of the listen() method can't be called after called initialize()

    All of the listen() method can't be called after called initialize()

    version: flutter_downloader: ^1.3.3 platform: ios simulator

    code below: void main() async{ await FlutterDownloader.initialize(); runApp(MusicianApp()); }

    plugin audioplayers:^0.12.0:

    audioPlayer.onPlayerStateChanged.listen((state) { // never being called }

    plugin flutter_sound: ^1.4.8:

    flutterSound.onRecorderDbPeakChanged.listen((value) { // never being called })

    flutter doctor -v : [✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Mac OS X 10.14.6 18G1012, locale en-CN) • Flutter version 1.9.1+hotfix.4 at /Users/cyh/flutter • Framework revision cc949a8e8b (9 weeks ago), 2019-09-27 15:04:59 -0700 • Engine revision b863200c37 • Dart version 2.5.0

    [!] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at /Users/cyh/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 28.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

    [✓] Xcode - develop for iOS and macOS (Xcode 11.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.2.1, Build version 11B500 • CocoaPods version 1.7.0.beta.3

    [✓] Android Studio (version 3.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 34.0.1 • Dart plugin version 182.5215 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

    [✓] IntelliJ IDEA Ultimate Edition (version 2018.3.4) • IntelliJ at /Applications/IntelliJ IDEA.app • Flutter plugin version 32.0.3 • Dart plugin version 183.5429.25

    [✓] VS Code (version 1.36.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.1.0

    [✓] Connected device (1 available) • iPhone X • DFDBB98C-3C75-4688-8832-83AE4FD2001D • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)

    ! Doctor found issues in 1 category.

    opened by lxcyha 20
  • Flutter downloader is not working in Android 11.

    Flutter downloader is not working in Android 11.

    While I'm able to download and view the file successfully in Android 6 phone, it is not working in Android 11. In Android 11, both log as well as notification says file is downloaded successfully. But in Android 11, file is not actually saved in drive. Please find below code

    AndroidManifest.xml

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="eCommerce"
        android:networkSecurityConfig="@xml/network_security_config"
        android:requestLegacyExternalStorage="true"
        android:usesCleartextTraffic="true"
        android:hardwareAccelerated="true">
        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:requestLegacyExternalStorage="true"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
                android:name="io.flutter.embedding.android.NormalTheme"
                android:resource="@style/NormalTheme" />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
                android:name="io.flutter.embedding.android.SplashScreenDrawable"
                android:resource="@drawable/launch_background" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
        <service
            android:name=".MyPrintService"
            android:permission="android.permission.BIND_PRINT_SERVICE">
            <intent-filter>
                <action android:name="android.printservice.PrintService" />
            </intent-filter>
        </service>
    
        <provider
            android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
            android:authorities="${applicationId}.flutter_downloader.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>
    
        <provider
            android:name="androidx.work.impl.WorkManagerInitializer"
            android:authorities="${applicationId}.workmanager-init"
            android:enabled="false"
            android:exported="false" />
    
        <provider
            android:name="vn.hunghd.flutterdownloader.FlutterDownloaderInitializer"
            android:authorities="${applicationId}.flutter-downloader-init"
            android:exported="false">
            <meta-data
                android:name="vn.hunghd.flutterdownloader.MAX_CONCURRENT_TASKS"
                android:value="5" />
        </provider>
    
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.flutter_inappwebview.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>
    </application>
    
    <!--    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>-->
    <!--    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>-->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
    

    Dart code

    final fldr = (Platform.isAndroid ? await getExternalStorageDirectory() : await getApplicationSupportDirectory()); final taskId = await FlutterDownloader.enqueue( url: url.toString(), savedDir: fldr.path, showNotification: true, // show download progress in status bar (for Android) openFileFromNotification: true, );

    opened by swafvan 17
  • "Worker result FAILURE" on Android

    Plugin works like a breeze on iOS, but I get an error on Android.

    This is what I get from the log:

    I/flutter (27342): Download task is enqueued with id(a1fd47bc-d615-41ba-8eb9-65dc173bfafb)
    D/SystemJobScheduler(27342): Scheduling work ID a1fd47bc-d615-41ba-8eb9-65dc173bfafb Job ID 19
    D/GreedyScheduler(27342): Starting tracking for a1fd47bc-d615-41ba-8eb9-65dc173bfafb
    D/SystemJobService(27342): onStartJob for a1fd47bc-d615-41ba-8eb9-65dc173bfafb
    D/ConstraintTracker(27342): NetworkStateTracker: initial state = [ Connected=true Validated=true Metered=false NotRoaming=true ]
    D/NetworkStateTracker(27342): Registering network callback
    D/WorkConstraintsTracker(27342): Constraints met for a1fd47bc-d615-41ba-8eb9-65dc173bfafb
    D/GreedyScheduler(27342): Constraints met: Scheduling work ID a1fd47bc-d615-41ba-8eb9-65dc173bfafb
    D/WorkConstraintsTracker(27342): Constraints met for a1fd47bc-d615-41ba-8eb9-65dc173bfafb
    D/GreedyScheduler(27342): Constraints met: Scheduling work ID a1fd47bc-d615-41ba-8eb9-65dc173bfafb
    D/Processor(27342): Processor: processing a1fd47bc-d615-41ba-8eb9-65dc173bfafb
    D/Processor(27342): Work a1fd47bc-d615-41ba-8eb9-65dc173bfafb is already enqueued for processing
    D/Processor(27342): Work a1fd47bc-d615-41ba-8eb9-65dc173bfafb is already enqueued for processing
    D/NetworkStateTracker(27342): Network capabilities changed: [ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&FOREGROUND LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps SignalStrength: -50]
    D/WorkerWrapper(27342): Worker result FAILURE for a1fd47bc-d615-41ba-8eb9-65dc173bfafb
    D/Processor(27342): Processor a1fd47bc-d615-41ba-8eb9-65dc173bfafb executed; isSuccessful = false, reschedule = false
    D/SystemJobService(27342): a1fd47bc-d615-41ba-8eb9-65dc173bfafb executed on JobScheduler
    I/zygote64(27342): Do partial code cache collection, code=61KB, data=47KB
    I/zygote64(27342): After code cache collection, code=61KB, data=47KB
    I/zygote64(27342): Increasing code cache capacity to 256KB
    

    This is my code:

    String taskId = await FlutterDownloader.enqueue(url: link, savedDir: path,);
    

    I know nothing about Android Studio or how to debug Android Apps, so I really don't know how where to start to debug this issue.

    Thanks

    bug 
    opened by webpn 17
  • iOS: await FlutterDownloader.initialize(); leads to google sign in cancel button crash

    iOS: await FlutterDownloader.initialize(); leads to google sign in cancel button crash

    iOS Only: After initializing await FlutterDownloader.initialize(); in main() when google sign in popup appears and user press cancel.. APP Crashes.

    Please look into.

    This is very basic to use google sign in. Many users will face the same.

    opened by MunishThakur 16
  • Failed to set registerPlugins on iOS

    Failed to set registerPlugins on iOS

    Hi! I'm having a problem running an app with this plugin installed. I've done everything I found on the internet and nothing works... If I comment await FlutterDownloader.initialize(); I can start the application.

    Exception:

    [   +2 ms] [DEVICE LOG] 2020-01-09 10:10:13.600816+0100  localhost Runner[14546]: methodCallHandler: initialize
    [        ] [DEVICE LOG] 2020-01-09 10:10:13.601151+0100  localhost Runner[14546]: startBackgroundIsolate
    [        ] [DEVICE LOG] 2020-01-09 10:10:13.639051+0100  localhost Runner[14546]: (Foundation) *** Assertion failure in -[FlutterDownloaderPlugin startBackgroundIsolate:], /Users/breakpoint/Flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.3.4/ios/Classes/FlutterDownloaderPlugin.m:117
    [        ] [DEVICE LOG] 2020-01-09 10:10:13.686382+0100  localhost Runner[14546]: (CoreFoundation) *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'failed to set registerPlugins'
    [        ] [DEVICE LOG] *** First throw call stack:
    [   +4 ms] [DEVICE LOG] (
    [        ] [DEVICE LOG]         0   CoreFoundation                      0x000000010a5828db __exceptionPreprocess + 331
    [        ] [DEVICE LOG]         1   libobjc.A.dylib                     0x0000000109437ac5 objc_exception_throw + 48
    [        ] [DEVICE LOG]         2   CoreFoundation                      0x000000010a582662 +[NSException raise:format:arguments:] + 98
    [        ] [DEVICE LOG]         3   Foundation                          0x0000000108b0d76b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
    [        ] [DEVICE LOG]         4   Runner                              0x0000000105e50cfe -[FlutterDownloaderPlugin startBackgroundIsolate:] + 782
    [        ] [DEVICE LOG]         5   Runner                              0x0000000105e569eb -[FlutterDownloaderPlugin initializeMethodCall:result:] + 187
    [        ] [DEVICE LOG]         6   Runner                              0x0000000105e5a7d0 -[FlutterDownloaderPlugin handleMethodCall:result:] + 256
    [        ] [DEVICE LOG]         7   Flutter                             0x0000000106a98f95 __45-[FlutterMethodCha<…>
    [  +16 ms] methodCallHandler: initialize
    [        ] startBackgroundIsolate
    [        ] *** First throw call stack:
    [        ] (
    [        ]      0   CoreFoundation                      0x000000010a5828db __exceptionPreprocess + 331
    [        ]      1   libobjc.A.dylib                     0x0000000109437ac5 objc_exception_throw + 48
    [        ]      2   CoreFoundation                      0x000000010a582662 +[NSException raise:format:arguments:] + 98
    [        ]      3   Foundation                          0x0000000108b0d76b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
    [        ]      4   Runner                              0x0000000105e50cfe -[FlutterDownloaderPlugin startBackgroundIsolate:] + 782
    [        ]      5   Runner                              0x0000000105e569eb -[FlutterDownloaderPlugin initializeMethodCall:result:] + 187
    [        ]      6   Runner                              0x0000000105e5a7d0 -[FlutterDownloaderPlugin handleMethodCall:result:] + 256
    [        ]      7   Flutter                             0x0000000106a98f95 __45-[FlutterMethodCha<…>
    [   +3 ms] Service protocol connection closed.
    [        ] Lost connection to device.
    
    

    main.dart:

    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      await FlutterDownloader.initialize();
    
      ...
    }
    

    AppDelegate.m:

    #include "AppDelegate.h"
    #include "GeneratedPluginRegistrant.h"
    #include "FlutterDownloaderPlugin.h"
    
    @implementation AppDelegate
    
    void registerPlugins(NSObject<FlutterPluginRegistry>* registry) {
        [FlutterDownloaderPlugin registerWithRegistrar:[registry registrarForPlugin:@"vn.hunghd.flutter_downloader"]];
    }
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        if (@available(iOS 10.0, *)) {
            [UNUserNotificationCenter currentNotificationCenter].delegate = (id<UNUserNotificationCenterDelegate>)self;
        }
    
        [GeneratedPluginRegistrant registerWithRegistry:self];
        [FlutterDownloaderPlugin setPluginRegistrantCallback:registerPlugins];
    
        return [super application:application didFinishLaunchingWithOptions:launchOptions];
    }
    
    @end
    

    flutter doctor:

    [✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.13.6 17G10021,
        locale en-BA)
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    [✓] Xcode - develop for iOS and macOS (Xcode 10.3)
    [✓] Android Studio (version 3.3)
    [✓] IntelliJ IDEA Community Edition (version 2019.3.1)
    [✓] Connected device (1 available)
    
    • No issues found!
    

    flutter_downloader version:

    1.3.4
    
    opened by anisalibegic 15
  • Task is always equeued

    Task is always equeued

    I added `@pragma('vm:entry-point').

      @pragma('vm:entry-point')
      static void _downloadCallback(
          String id, DownloadTaskStatus status, int progress) {
        final SendPort? send =
            IsolateNameServer.lookupPortByName('downloader_send_port');
        send?.send([id, status, progress]);
      }
    

    this my log on a user's release app. i can't recurrent in my device. the task status is always DownloadTaskStatus(1)

    downloading...  DownloadTask(taskId: 6a217443-9767-44e2-b83e-81d2cb07c016, status: DownloadTaskStatus(1), progress: 0, url: https://images.linjieapp.com/images/ba7d8c51a42914c0bb10431ca9e914bc.png?x-oss-process=image/resize,w_1080,h_1439,m_lfit/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_0,y_0/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_0,y_483/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_0,y_966/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_483,y_0/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_483,y_483/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_483,y_966/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_966,y_0/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_966,y_483/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_966,y_966, filename: null, savedDir: /data/user/0/tech.echoing.congress/cache/image, timeCreated: 1672907271706, allowCellular: true)
    
    downloading...DownloadTask(taskId: 9ffa9aca-52fc-4ba2-bf16-804121514dd0, status: DownloadTaskStatus(1), progress: 0, url: https://images.linjieapp.com/images/ff40c00545415aacae200ef5fb83cd26.png?x-oss-process=image/resize,w_1080,h_1080,m_lfit/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_0,y_0/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_0,y_483/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_0,y_966/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_483,y_0/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_483,y_483/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_483,y_966/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_966,y_0/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_966,y_483/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_966,y_966, filename: null, savedDir: /data/user/0/tech.echoing.congress/cache/image, timeCreated: 1672907237533, allowCellular: true)
    
    downloading...DownloadTask(taskId: 6a217443-9767-44e2-b83e-81d2cb07c016, status: DownloadTaskStatus(1), progress: 0, url: https://images.linjieapp.com/images/ba7d8c51a42914c0bb10431ca9e914bc.png?x-oss-process=image/resize,w_1080,h_1439,m_lfit/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_0,y_0/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_0,y_483/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_0,y_966/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_483,y_0/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_483,y_483/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_483,y_966/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_966,y_0/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_966,y_483/watermark,image_aW1hZ2VzLzc5YTMyZTkwLTc2ZTEtMTFlZC1iZjU3LTQzZTZiZjFiOTQwMy5wbmc=,g_sw,x_966,y_966, filename: null, savedDir: /data/user/0/tech.echoing.congress/cache/image, timeCreated: 1672907271706, allowCellular: true)
    
    
    
    • Device: oppoR7x ColorOS 12.1 Android 12
    • OS: Android 12
    • plugin version 1.10.0 img_v2_2f1a8bfd-0648-416f-ba1b-fe73ebfca9ag
    bug 
    opened by lwj1994 0
  • Flutter downloader not loading  tasks in ios

    Flutter downloader not loading tasks in ios

    After downloading the file the plugin does not load the the tasks .

    FlutterDownloader.loadTasks() not loading downloaded tasks or its progress

    List? getTasks = await FlutterDownloader.loadTasks();

    it shows empty it works in android but not working in ios simulator

    bug 
    opened by noeljayson 3
  • Cannot query downloaded task in IOS after upgrade to flutter_downloader: ^1.10.0

    Cannot query downloaded task in IOS after upgrade to flutter_downloader: ^1.10.0

    It was working fine until I upgrade the plugin from 1.9.1 to 1.10.0

    final completedTask = await FlutterDownloader.loadTasksWithRawQuery( query: 'SELECT * FROM task WHERE status = 3');

    bug 
    opened by basnetjiten 0
  • How to encrypt downloading file.

    How to encrypt downloading file.

    Describe the bug

    To Reproduce

    Steps to reproduce the behavior:

    1. Go to '...'
    2. Click on '....'
    3. Scroll down to '....'
    4. See error

    Expected behavior

    Screenshots

    Desktop (please complete the following information):

    • OS: [e.g. iOS]
    • Browser [e.g. chrome, safari]
    • Version [e.g. 22]

    Device information:

    • Device: [e.g. iPhone 13]
    • OS: [e.g. iOS 15.4]
    • plugin version [e.g. v1.8.0]

    Additional context

    bug 
    opened by dghub-founder 0
  • Cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22

    Cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22

    FAILURE: Build failed with an exception.

    • What went wrong: A problem occurred configuring project ':flutter_downloader'.

    Could not resolve all artifacts for configuration ':flutter_downloader:classpath'. Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22. Required by: project :flutter_downloader > Cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22: - gradle70JavadocElements - gradle70RuntimeElements - gradle70SourcesElements - gradle71JavadocElements - gradle71RuntimeElements - gradle71SourcesElements - javadocElements - runtimeElementsWithFixedAttribute - sourcesElements All of them match the consumer attributes: - Variant 'gradle70JavadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22: - Unmatched attributes: - Found org.gradle.category 'documentation' but wasn't required. - Found org.gradle.docstype 'javadoc' but wasn't required. - Required org.gradle.jvm.version '11' but no value provided. - Required org.gradle.libraryelements 'jar' but no value provided. - Found org.gradle.plugin.api-version '7.0' but wasn't required. - Found org.gradle.status 'release' but wasn't required. - Compatible attributes: - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'. - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'. - Variant 'gradle70RuntimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22: - Unmatched attributes: - Found org.gradle.category 'library' but wasn't required. - Found org.gradle.jvm.environment 'standard-jvm' but wasn't required. - Found org.gradle.plugin.api-version '7.0' but wasn't required. - Found org.gradle.status 'release' but wasn't required. - Compatible attributes: - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'. - Required org.gradle.jvm.version '11' and found compatible value '8'. - Required org.gradle.libraryelements 'jar' and found compatible value 'jar'. - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'. - Variant 'gradle70SourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22:

    bug 
    opened by asd39715 0
Owner
Flutter Community
A central place for all community made Flutter packages. To get started, see the README of the 'community' repository.
Flutter Community
dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on background

dosdownloader Dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on back

Md Abir Ahsan Tahmim 1 Dec 8, 2021
Flutter youtube downloader - A Windows App made in Flutter to download mp3 or mp4 from a Youtube video

youtube_downloader A Windows App made in Flutter to download mp3 or mp4 from a Y

Sakshham Bhagat 3 Nov 30, 2022
A sophisticated tool for managing queues of asynchronous tasks, with a stream interface, strong typing and lots of helpful options.

Secretary A sophisticated task manager. Secretary is a tool for keeping your futures in check. It's useful for managing queues of asynchronous tasks,

Alex Baker 5 Dec 21, 2022
Download files from Firebase Storage with Flutter. List all images, videos, or other files from Firebase and download them.

Flutter Tutorial - Download Files From Firebase Storage Download files from Firebase Storage with Flutter. List all images, videos, or other files fro

Johannes Milke 28 Dec 4, 2022
A Video Player For Vimeo Videos in Flutter. This plugin allows us to play video from Vimeo and it supports Android and iOS platforms.

vimeo_video_player A Video Player For Vimeo Videos in Flutter. This plugin allow us to play video from vimeo and it's supports Android and iOS platfor

MindInventory 26 Dec 8, 2022
Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS

flutter_barcode_scanner A plugin for Flutter apps that adds barcode scanning support on both Android and iOS. Try example Just clone or download the r

Amol Gangadhare 325 Jan 6, 2023
Flutter plugin for Firebase Auth UI. Supports popular auth providers by using native SDK for Android and iOS.

firebase_auth_ui Flutter plugin of Firebase UI which allows to add login/sign-up quickly. NOTE: This plugin is under development. Please provide Feedb

Sandip Fichadiya 50 Mar 23, 2022
Flutter file manager - Flutter package for managing files on Android

flutter_file_utils Helper tools for managing files on Android. Getting Started For help getting started with Flutter, view our online documentation. F

Mohamed Naga 35 Nov 11, 2022
Basic file managing app for Android using Flutter framework

core_file_manager A simple application for managing files on Android devices using Flutter framework core_file_manager Getting Started Running the app

Mohamed Naga 25 Sep 20, 2022
An audiobook downloader and player in flutter using librivox api (WIP)

Flutter AudioBooks An audiobook listener and downloader in flutter using librivox API (WIP). Why? I wanted to make a beautiful AudioBook app, free for

Damodar Lohani 137 Jan 5, 2023
A powerful past paper downloader for IGCSE and A-Level.

Past Paper Finder Past Paper Finder is a past paper downloader for IGCSE and A-Level. It is designed to be as simple as possible and easy to use. Feat

SCIE.DEV 2 Dec 12, 2022
Youtube video downloader made using flutter.

FluTube Youtube video downloader made using flutter. Direct app download Build from source Download latest Flutter SDK (>=2.2.3) Clone this repo and t

Prateek SU 252 Dec 28, 2022
YouTube downloader built fully in Flutter

Youtube Downloader Flutter This is a cross platform app (currently tested on Android, Windows and Linux) to download videos from YouTube, it's still a

Mattia 109 Dec 18, 2022
An HTTP file downloader packed with many features -> resumable downloads, multiple connections, buffering, auto-retry, etc.

An HTTP file downloader packed with many features -> resumable downloads, multiple connections, buffering, auto-retry, etc. Features Resumable downloa

Liu YuanYuan 4 Feb 2, 2022
Youtube Downloader Application

pakistan_vd A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Muhammad Abair Mutarraf 1 Jul 24, 2021
This is the code for the POAPin app, which is written in Flutter and currently supports iOS, Android, and Web platforms.

POAPin This is the code for the POAPin app, which is written in Flutter and currently supports iOS, Android, and Web platforms. ?? Get the app Platfor

Glory Lab 17 Nov 7, 2022
A Flutter implementation of splash screen. Supports Android and IOS.

your_splash A Flutter implementation of splash screen. Supports Android and IOS. Features Supports splash screen with the Future callback Supports spl

Stepanenko Stanislav 6 Sep 27, 2022
A Flutter plugin to read 🔖 metadata of 🎵 media files. Supports Windows, Linux & Android.

flutter_media_metadata A Flutter plugin to read metadata of media files. A part of Harmonoid open source project ?? Install Add in your pubspec.yaml.

Harmonoid 60 Dec 2, 2022
This package helps developer to sort the flutter/dart packages and plugins alphabetically, This makes it easier when managing too many packages and when working with teams

Package helps to sort the flutter/dart packages and plugins alphabetically, This makes it easier when managing too many packages and when working with

DANCHE 7 Dec 21, 2022