diff --git a/.github/workflows/prepare.yaml b/.github/workflows/prepare.yaml index efff0d46..77cf8d82 100644 --- a/.github/workflows/prepare.yaml +++ b/.github/workflows/prepare.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - flutter-version: ['3.0.x', '3.3.x', '3.7.x', '3.10.x'] + flutter-version: ['3.10.x'] steps: - name: Clone repository @@ -47,7 +47,7 @@ jobs: - name: flutter format (example app) working-directory: ./example - run: flutter format --set-exit-if-changed . + run: dart format --set-exit-if-changed . - name: flutter analyze (example app) working-directory: ./example diff --git a/android/build.gradle b/android/build.gradle index dbcbc14b..cd9b2be1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = "1.7.22" + ext.kotlin_version = "1.9.0" repositories { google() mavenCentral() @@ -7,9 +7,9 @@ buildscript { } dependencies { - classpath "com.android.tools.build:gradle:7.2.2" + classpath "com.android.tools.build:gradle:7.4.2" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jlleitschuh.gradle:ktlint-gradle:11.0.0" + classpath "org.jlleitschuh.gradle:ktlint-gradle:11.5.0" } } @@ -29,7 +29,7 @@ rootProject.allprojects { android { namespace "vn.hunghd.flutterdownloader" - compileSdk 32 + compileSdk 33 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -46,7 +46,7 @@ android { defaultConfig { minSdk 19 - targetSdk 32 + targetSdk 33 } } diff --git a/android/gradle.properties b/android/gradle.properties deleted file mode 100644 index 08f2b5f9..00000000 --- a/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.enableJetifier=true -android.useAndroidX=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index dcf0f19c..00000000 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip diff --git a/android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt b/android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt index 94bd5c47..2d9bf628 100644 --- a/android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt +++ b/android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt @@ -257,7 +257,7 @@ class DownloadWorker(context: Context, params: WorkerParameters) : filename: String?, headers: String, isResume: Boolean, - timeout: Int, + timeout: Int ) { var actualFilename = filename var url = fileURL diff --git a/android/src/main/kotlin/vn/hunghd/flutterdownloader/FlutterDownloaderPlugin.kt b/android/src/main/kotlin/vn/hunghd/flutterdownloader/FlutterDownloaderPlugin.kt index b6f527b2..2a7b928e 100644 --- a/android/src/main/kotlin/vn/hunghd/flutterdownloader/FlutterDownloaderPlugin.kt +++ b/android/src/main/kotlin/vn/hunghd/flutterdownloader/FlutterDownloaderPlugin.kt @@ -91,7 +91,7 @@ class FlutterDownloaderPlugin : MethodChannel.MethodCallHandler, FlutterPlugin { requiresStorageNotLow: Boolean, saveInPublicStorage: Boolean, timeout: Int, - allowCellular: Boolean, + allowCellular: Boolean ): WorkRequest { return OneTimeWorkRequest.Builder(DownloadWorker::class.java) .setConstraints( diff --git a/android/src/main/kotlin/vn/hunghd/flutterdownloader/TaskDao.kt b/android/src/main/kotlin/vn/hunghd/flutterdownloader/TaskDao.kt index 6bb7a8a9..1fffd964 100644 --- a/android/src/main/kotlin/vn/hunghd/flutterdownloader/TaskDao.kt +++ b/android/src/main/kotlin/vn/hunghd/flutterdownloader/TaskDao.kt @@ -21,7 +21,7 @@ class TaskDao(private val dbHelper: TaskDbHelper) { TaskEntry.COLUMN_NAME_SHOW_NOTIFICATION, TaskEntry.COLUMN_NAME_TIME_CREATED, TaskEntry.COLUMN_SAVE_IN_PUBLIC_STORAGE, - TaskEntry.COLUMN_ALLOW_CELLULAR, + TaskEntry.COLUMN_ALLOW_CELLULAR ) fun insertOrUpdateNewTask( diff --git a/example/android/build.gradle b/example/android/build.gradle index 8b3b6ce4..5cc84de1 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = "1.7.22" + ext.kotlin_version = "1.9.0" repositories { google() mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:7.2.2" + classpath "com.android.tools.build:gradle:7.4.2" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index dcf0f19c..ec915a81 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip diff --git a/example/lib/download_list_item.dart b/example/lib/download_list_item.dart index a7ac1093..9c7d9c48 100644 --- a/example/lib/download_list_item.dart +++ b/example/lib/download_list_item.dart @@ -12,9 +12,9 @@ class DownloadListItem extends StatelessWidget { }); final ItemHolder? data; - final Function(TaskInfo?)? onTap; - final Function(TaskInfo)? onActionTap; - final Function(TaskInfo)? onCancel; + final void Function(TaskInfo?)? onTap; + final void Function(TaskInfo)? onActionTap; + final void Function(TaskInfo)? onCancel; Widget? _buildTrailing(TaskInfo task) { if (task.status == DownloadTaskStatus.undefined) { diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 4df84939..1d011495 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.0.0+1 publish_to: none environment: - sdk: '>=2.17.0 <4.0.0' - flutter: '>=3.0.0' + sdk: '>=3.0.0 <4.0.0' + flutter: '>=3.10.0' dependencies: android_path_provider: ^0.3.0 @@ -20,7 +20,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - leancode_lint: ^2.0.0+1 + leancode_lint: ^4.0.0+2 flutter: uses-material-design: true diff --git a/lib/src/callback_dispatcher.dart b/lib/src/callback_dispatcher.dart index 674b4b60..5e657e84 100644 --- a/lib/src/callback_dispatcher.dart +++ b/lib/src/callback_dispatcher.dart @@ -16,7 +16,8 @@ void callbackDispatcher() { ..setMethodCallHandler((call) async { final args = call.arguments as List; final handle = CallbackHandle.fromRawHandle(args[0] as int); - final callback = PluginUtilities.getCallbackFromHandle(handle); + final callback = PluginUtilities.getCallbackFromHandle(handle) as void + Function(String id, int status, int progress)?; if (callback == null) { // ignore: avoid_print diff --git a/lib/src/downloader.dart b/lib/src/downloader.dart index 1649dba4..15ec6ce7 100644 --- a/lib/src/downloader.dart +++ b/lib/src/downloader.dart @@ -1,3 +1,5 @@ +// ignore_for_file: avoid_dynamic_calls + import 'dart:async'; import 'dart:convert'; import 'dart:io'; @@ -149,8 +151,6 @@ class FlutterDownloader { return result.map( (dynamic item) { - // item as Map; // throws - return DownloadTask( taskId: item['task_id'] as String, status: DownloadTaskStatus(item['status'] as int), @@ -209,8 +209,6 @@ class FlutterDownloader { return result.map( (dynamic item) { - // item as Map; // throws - return DownloadTask( taskId: item['task_id'] as String, status: DownloadTaskStatus(item['status'] as int), diff --git a/pubspec.yaml b/pubspec.yaml index d79ee4f0..ff92a8e7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,8 +15,8 @@ flutter: pluginClass: FlutterDownloaderPlugin environment: - sdk: '>=2.17.0 <4.0.0' - flutter: '>=3.0.0' + sdk: '>=3.0.0 <4.0.0' + flutter: '>=3.10.0' dependencies: flutter: @@ -25,4 +25,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - leancode_lint: ^2.0.0+1 + leancode_lint: ^4.0.0+2