diff --git a/ohos/src/main/ets/components/FlutterDownloaderPlugin.ets b/ohos/src/main/ets/components/FlutterDownloaderPlugin.ets index 7c09bf98a50b190d20672f3f5db6d3c46a5b2bf9..19f0c706da49363ae72a317ca0c550e2c8f521d1 100644 --- a/ohos/src/main/ets/components/FlutterDownloaderPlugin.ets +++ b/ohos/src/main/ets/components/FlutterDownloaderPlugin.ets @@ -326,6 +326,11 @@ export class FlutterDownloaderPlugin implements FlutterPlugin, MethodCallHandler const filename: string = call.argument('file_name') ?? url.substring(url.lastIndexOf("/") + 1, url.length); const headers = this.requireArgument(call, 'headers'); const showNotification = this.requireArgument(call, 'show_notification'); + // 如果showNotification为false则提示:鸿蒙不支持将showNotification设置为false。(鸿蒙官方暂不支持该属性) + if (!showNotification) { + result.error("8", "ohos does not support setting showNotification to false.", "ohos does not support setting showNotification to false."); + return; + } const openFileFromNotification = this.requireArgument(call, 'open_file_from_notification'); const allowCellular = this.requireArgument(call, 'allow_cellular'); const taskId =