Flutter: AUDIO_OUTPUT_FLAG_FAST denied by client

1

I am working on flutter app .. i want to display a local notification when a button on the app has been clicked ..

i followed this tutorial " https://medium.com/@nitishk72/flutter-local-notification-1e43a353877b " but i got nothing when i clicked on the button with no error in the run ..

the logcat show this error when i clicked on the button: 1592-1683/system_process W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client

this is my whole logcat:

11-07 10:59:30.878 9097-9117/com.android.packageinstaller D/EGL_emulation: eglMakeCurrent: 0xae834b80: ver 2 0
11-07 10:59:31.477 1592-1824/system_process W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.run() from WindowAnimator.java:124 waiters=0 for 455ms
    
    --------- beginning of system
11-07 10:59:31.660 1592-2668/system_process W/InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 9240 uid 10066
11-07 10:59:31.679 1846-1846/com.google.android.googlequicksearchbox I/Choreographer: Skipped 47 frames!  The application may be doing too much work on its main thread.
11-07 10:59:31.682 1846-2133/com.google.android.googlequicksearchbox D/EGL_emulation: eglMakeCurrent: 0xae834f40: ver 2 0
11-07 10:59:31.709 1846-2133/com.google.android.googlequicksearchbox D/EGL_emulation: eglMakeCurrent: 0xae834f40: ver 2 0
11-07 10:59:31.716 1846-2133/com.google.android.googlequicksearchbox D/EGL_emulation: eglMakeCurrent: 0xae834f40: ver 2 0
11-07 10:59:31.721 1846-2133/com.google.android.googlequicksearchbox W/OpenGLRenderer: Incorrectly called buildLayer on View: aep, destroying layer...
11-07 10:59:31.727 1846-2133/com.google.android.googlequicksearchbox D/EGL_emulation: eglMakeCurrent: 0xae834f40: ver 2 0
11-07 10:59:31.797 9097-9117/com.android.packageinstaller D/EGL_emulation: eglMakeCurrent: 0xae834b80: ver 2 0
11-07 10:59:32.014 9097-9097/com.android.packageinstaller I/Choreographer: Skipped 101 frames!  The application may be doing too much work on its main thread.
11-07 10:59:32.017 9097-9117/com.android.packageinstaller D/EGL_emulation: eglMakeCurrent: 0xae834b80: ver 2 0
11-07 11:01:13.764 9611-9611/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
11-07 11:01:13.770 9611-9611/? D/AndroidRuntime: CheckJNI is ON
11-07 11:01:13.864 9611-9611/? E/memtrack: Couldn't load memtrack module (No such file or directory)
11-07 11:01:13.864 9611-9611/? E/android.os.Debug: failed to load memtrack module: -2
11-07 11:01:13.919 9611-9611/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
11-07 11:01:13.930 1592-1682/system_process I/ActivityManager: Force stopping com.accounting.studentaccounting appid=10066 user=0: from pid 9611
11-07 11:01:13.931 9611-9611/? D/AndroidRuntime: Shutting down VM
11-07 11:01:14.453 9622-9622/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
11-07 11:01:14.456 9622-9622/? D/AndroidRuntime: CheckJNI is ON
11-07 11:01:14.539 9622-9622/? E/memtrack: Couldn't load memtrack module (No such file or directory)
11-07 11:01:14.540 9622-9622/? E/android.os.Debug: failed to load memtrack module: -2
11-07 11:01:14.581 9622-9622/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
11-07 11:01:14.609 9622-9622/? I/art: System.exit called, status: 0
11-07 11:01:14.609 9622-9622/? I/AndroidRuntime: VM exiting with result code 0.
11-07 11:01:17.541 9639-9639/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
11-07 11:01:17.548 9639-9639/? D/AndroidRuntime: CheckJNI is ON
11-07 11:01:17.648 9639-9639/? E/memtrack: Couldn't load memtrack module (No such file or directory)
11-07 11:01:17.649 9639-9639/? E/android.os.Debug: failed to load memtrack module: -2
11-07 11:01:17.716 9639-9639/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
11-07 11:01:17.753 3931-3946/com.android.defcontainer D/DefContainer: Copying /data/local/tmp/app.apk to base.apk
11-07 11:01:18.721 1592-1605/system_process I/art: Background sticky concurrent mark sweep GC freed 22093(1400KB) AllocSpace objects, 13(2MB) LOS objects, 12% free, 13MB/15MB, paused 5.185ms total 58.973ms
11-07 11:01:21.651 1592-1623/system_process D/PackageManager: Renaming /data/app/vmdl362496313.tmp to /data/app/com.accounting.studentaccounting-1
11-07 11:01:21.653 1592-1613/system_process I/ActivityManager: Force stopping com.accounting.studentaccounting appid=10066 user=-1: uninstall pkg
11-07 11:01:22.240 1592-1623/system_process I/PackageManager: Package com.accounting.studentaccounting codePath changed from /data/app/com.accounting.studentaccounting-2 to /data/app/com.accounting.studentaccounting-1; Retaining data and using new
11-07 11:01:22.344 1592-1623/system_process I/PackageManager: Running dexopt on: /data/app/com.accounting.studentaccounting-1/base.apk pkg=com.accounting.studentaccounting isa=x86 vmSafeMode=false
11-07 11:01:22.370 9653-9653/? E/cutils-trace: Error opening trace file: Permission denied (13)
11-07 11:01:22.370 9653-9653/? I/dex2oat: /system/bin/dex2oat --zip-fd=5 --zip-location=/data/app/com.accounting.studentaccounting-1/base.apk --oat-fd=6 --oat-location=/data/dalvik-cache/x86/data@app@com.accounting.studentaccounting-1@base.apk@classes.dex --instruction-set=x86 --instruction-set-features=default --runtime-arg -Xms64m --runtime-arg -Xmx512m --swap-fd=11
11-07 11:01:22.489 9653-9653/? I/dex2oat: Decided to run without swap.
11-07 11:01:25.824 9653-9653/? I/dex2oat: dex2oat took 3.453s (threads: 2) arena alloc=47KB java alloc=1052KB native alloc=3MB free=4MB
11-07 11:01:25.830 1592-1623/system_process W/PackageManager: Code path for pkg : com.accounting.studentaccounting changing from /data/app/com.accounting.studentaccounting-2 to /data/app/com.accounting.studentaccounting-1
    Resource path for pkg : com.accounting.studentaccounting changing from /data/app/com.accounting.studentaccounting-2 to /data/app/com.accounting.studentaccounting-1
11-07 11:01:25.831 1592-1613/system_process I/ActivityManager: Force stopping com.accounting.studentaccounting appid=10066 user=-1: update pkg
11-07 11:01:26.082 1592-1623/system_process I/ActivityManager: Force stopping com.accounting.studentaccounting appid=10066 user=0: pkg removed
11-07 11:01:26.139 1592-1623/system_process W/Settings: Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
11-07 11:01:26.143 1592-1654/system_process I/InputReader: Reconfiguring input devices.  changes=0x00000010
11-07 11:01:26.145 1592-1654/system_process I/InputReader: Reconfiguring input devices.  changes=0x00000010
11-07 11:01:26.147 1592-1654/system_process I/InputReader: Reconfiguring input devices.  changes=0x00000010
11-07 11:01:26.180 1787-2817/com.google.android.gms.persistent E/NetworkScheduler.SR: Unrecognised action provided: android.intent.action.PACKAGE_REMOVED
11-07 11:01:26.268 1592-1592/system_process I/art: Explicit concurrent mark sweep GC freed 21801(1519KB) AllocSpace objects, 11(1918KB) LOS objects, 25% free, 11MB/15MB, paused 2.844ms total 157.512ms
11-07 11:01:26.270 1592-1623/system_process I/art: WaitForGcToComplete blocked for 130.256ms for cause Explicit
11-07 11:01:26.291 1592-1592/system_process D/JobSchedulerService: Receieved: android.intent.action.PACKAGE_REMOVED
11-07 11:01:26.291 1592-1592/system_process D/BackupManagerService: Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.accounting.studentaccounting flg=0x4000010 (has extras) }
11-07 11:01:26.309 1787-1801/com.google.android.gms.persistent I/art: Background sticky concurrent mark sweep GC freed 51993(2MB) AllocSpace objects, 13(419KB) LOS objects, 17% free, 9MB/11MB, paused 2.470ms total 120.819ms
11-07 11:01:26.464 2206-9662/com.google.android.gms D/Wear_Controller: Received broadcast action=android.intent.action.PACKAGE_REMOVED and uri=com.accounting.studentaccounting
11-07 11:01:26.483 1846-1846/com.google.android.googlequicksearchbox W/Launcher: setApplicationContext called twice! old=com.google.android.velvet.VelvetApplication@1a4db9e3 new=com.google.android.velvet.VelvetApplication@1a4db9e3
11-07 11:01:26.503 7135-7135/com.android.keychain W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1692 android.content.ContextWrapper.startService:516 android.content.ContextWrapper.startService:516 com.android.keychain.KeyChainBroadcastReceiver.onReceive:12 android.app.ActivityThread.handleReceiver:2609 
11-07 11:01:26.512 1592-1592/system_process D/BackupManagerService: Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.accounting.studentaccounting flg=0x4000010 (has extras) }
11-07 11:01:26.513 1592-1592/system_process W/BackupManagerService: Removing schedule queue dupe of com.accounting.studentaccounting
11-07 11:01:26.734 2018-9671/com.google.android.googlequicksearchbox:search I/UpdateIcingCorporaServi: Updating corpora: APPS=com.accounting.studentaccounting, CONTACTS=MAYBE
11-07 11:01:26.765 1846-1846/com.google.android.googlequicksearchbox I/Launcher: Deferring update until onResume
11-07 11:01:26.857 2206-9672/com.google.android.gms D/Wear_Controller: Received broadcast action=android.intent.action.PACKAGE_ADDED and uri=com.accounting.studentaccounting
11-07 11:01:26.905 1846-1846/com.google.android.googlequicksearchbox I/Launcher: Deferring update until onResume
11-07 11:01:26.956 2206-9657/com.google.android.gms I/FontsPackageChangeOp: Package com.accounting.studentaccounting has no metadata
11-07 11:01:26.992 1846-1846/com.google.android.googlequicksearchbox W/Launcher: setApplicationContext called twice! old=com.google.android.velvet.VelvetApplication@1a4db9e3 new=com.google.android.velvet.VelvetApplication@1a4db9e3
11-07 11:01:27.046 1592-1623/system_process I/art: Explicit concurrent mark sweep GC freed 8429(409KB) AllocSpace objects, 0(0B) LOS objects, 25% free, 11MB/15MB, paused 2.080ms total 775.926ms
11-07 11:01:27.126 2206-2308/com.google.android.gms I/Icing: Usage reports 0 indexed 0 rejected 0 imm upload true
11-07 11:01:27.130 2018-9671/com.google.android.googlequicksearchbox:search I/ApplicationLogger: canRun() : Opted Out
11-07 11:01:27.131 2018-9671/com.google.android.googlequicksearchbox:search I/UpdateIcingCorporaServi: UpdateCorporaTask done [took 397 ms] updated apps [took 397 ms] 
11-07 11:01:27.151 9639-9639/? I/art: System.exit called, status: 0
11-07 11:01:27.151 9639-9639/? I/AndroidRuntime: VM exiting with result code 0.
11-07 11:01:27.427 2206-2271/com.google.android.gms I/Icing: Usage reports 0 indexed 0 rejected 0 imm upload false
11-07 11:01:27.442 2206-2271/com.google.android.gms I/Icing: Usage reports 0 indexed 0 rejected 0 imm upload false
11-07 11:01:27.507 2206-2308/com.google.android.gms I/Icing: Usage reports 0 indexed 0 rejected 0 imm upload false
11-07 11:01:27.545 2206-2308/com.google.android.gms I/Icing: Usage reports 0 indexed 0 rejected 0 imm upload false
11-07 11:01:27.788 9684-9684/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
11-07 11:01:27.791 9684-9684/? D/AndroidRuntime: CheckJNI is ON
11-07 11:01:27.891 9684-9684/? E/memtrack: Couldn't load memtrack module (No such file or directory)
11-07 11:01:27.891 9684-9684/? E/android.os.Debug: failed to load memtrack module: -2
11-07 11:01:27.947 9684-9684/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
11-07 11:01:27.960 1592-2644/system_process I/ActivityManager: START u0 {act=android.intent.action.RUN flg=0x30000000 cmp=com.accounting.studentaccounting/.MainActivity (has extras)} from uid 0 on display 0
11-07 11:01:27.973 1592-2644/system_process V/WindowManager: addAppToken: AppWindowToken{3f51c5b1 token=Token{331d2058 ActivityRecord{133e313b u0 com.accounting.studentaccounting/.MainActivity t126}}} to stack=1 task=126 at 0
11-07 11:01:28.004 1164-1242/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1806336
11-07 11:01:30.220 2206-6919/com.google.android.gms I/Icing: Indexing 9A9FBE7FF9AFFF4D53F7ACF6D5C5FF9804366E3C from com.google.android.googlequicksearchbox
11-07 11:01:30.236 1164-1164/? E/EGL_emulation: tid 1164: eglCreateSyncKHR(1865): error 0x3004 (EGL_BAD_ATTRIBUTE)
11-07 11:01:30.291 1592-1618/system_process W/art: Long monitor contention event with owner method=android.graphics.Bitmap com.android.server.wm.WindowManagerService.screenshotApplications(android.os.IBinder, int, int, int, boolean) from WindowManagerService.java:6129 waiters=0 for 2.289s
11-07 11:01:30.293 1592-1618/system_process V/WindowManager: Adding window Window{3aaa79e9 u0 Starting com.accounting.studentaccounting} at 4 of 10 (after Window{3b371fc5 u0 com.android.packageinstaller/com.android.packageinstaller.UninstallerActivity})
11-07 11:01:30.295 1592-1618/system_process I/Choreographer: Skipped 138 frames!  The application may be doing too much work on its main thread.
11-07 11:01:30.345 9684-9684/? D/AndroidRuntime: Shutting down VM
11-07 11:01:30.355 1164-2165/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 13778944
11-07 11:01:30.364 1592-2668/system_process W/art: Long monitor contention event with owner method=int com.android.server.am.ActivityStackSupervisor.startActivityMayWait(android.app.IApplicationThread, int, java.lang.String, android.content.Intent, java.lang.String, android.service.voice.IVoiceInteractionSession, com.android.internal.app.IVoiceInteractor, android.os.IBinder, java.lang.String, int, int, android.app.ProfilerInfo, android.app.IActivityManager$WaitResult, android.content.res.Configuration, android.os.Bundle, int, android.app.IActivityContainer, com.android.server.am.TaskRecord) from ActivityStackSupervisor.java:857 waiters=1 for 140ms
11-07 11:01:30.472 1592-1824/system_process I/ActivityManager: Start proc 9695:com.accounting.studentaccounting/u0a66 for activity com.accounting.studentaccounting/.MainActivity
11-07 11:01:30.476 1592-1613/system_process W/art: Long monitor contention event with owner method=android.content.Intent com.android.server.am.ActivityManagerService.registerReceiver(android.app.IApplicationThread, java.lang.String, android.content.IIntentReceiver, android.content.IntentFilter, java.lang.String, int) from ActivityManagerService.java:15581 waiters=2 for 109ms
11-07 11:01:30.483 9695-9695/? E/libprocessgroup: failed to make and chown /acct/uid_10066: Read-only file system
11-07 11:01:30.483 9695-9695/? W/Zygote: createProcessGroup failed, kernel missing CONFIG_CGROUP_CPUACCT?
11-07 11:01:30.484 9695-9695/? I/art: Not late-enabling -Xcheck:jni (already on)
11-07 11:01:30.962 2206-6919/com.google.android.gms I/Icing: Indexing DE2F07B2BDEFB76CDA53A2B27F4B62BA0D25E1F2 from com.google.android.gms
11-07 11:01:31.028 1846-2133/com.google.android.googlequicksearchbox D/EGL_emulation: eglMakeCurrent: 0xae834f40: ver 2 0
11-07 11:01:31.307 2206-6919/com.google.android.gms I/Icing: Indexing done 9A9FBE7FF9AFFF4D53F7ACF6D5C5FF9804366E3C
11-07 11:01:31.311 2206-6919/com.google.android.gms I/Icing: Indexing done DE2F07B2BDEFB76CDA53A2B27F4B62BA0D25E1F2
11-07 11:01:31.328 9695-9695/com.accounting.studentaccounting W/linker: libflutter.so: unused DT entry: type 0x6ffffffe arg 0x6334
    libflutter.so: unused DT entry: type 0x6fffffff arg 0x3
11-07 11:01:37.961 1592-1695/system_process D/TaskPersister: removeObsoleteFile: deleting file=125_task.xml
11-07 11:01:40.329 1592-1613/system_process W/ActivityManager: Launch timeout has expired, giving up wake lock!
11-07 11:01:40.781 9695-9720/com.accounting.studentaccounting I/flutter: Observatory listening on http://127.0.0.1:34764/
11-07 11:01:40.952 9695-9695/com.accounting.studentaccounting D/EGL_emulation: eglCreateContext: 0xb435b760: maj 2 min 0 rcv 2
11-07 11:01:41.482 9695-9716/com.accounting.studentaccounting D/EGL_emulation: eglMakeCurrent: 0xb435b760: ver 2 0
11-07 11:01:42.398 9695-9708/com.accounting.studentaccounting I/art: Background sticky concurrent mark sweep GC freed 797(54KB) AllocSpace objects, 1(16KB) LOS objects, 0% free, 2MB/2MB, paused 19.125ms total 79.815ms
11-07 11:01:42.599 9695-9708/com.accounting.studentaccounting I/art: Background partial concurrent mark sweep GC freed 59(2640B) AllocSpace objects, 0(0B) LOS objects, 40% free, 2MB/4MB, paused 8.569ms total 29.667ms
11-07 11:01:42.651 9695-9721/com.accounting.studentaccounting D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
11-07 11:01:42.705 9695-9695/com.accounting.studentaccounting D/Atlas: Validating map...
11-07 11:01:42.715 1592-1824/system_process V/WindowManager: Adding window Window{26e7d21 u0 com.accounting.studentaccounting/com.accounting.studentaccounting.MainActivity} at 4 of 11 (before Window{3aaa79e9 u0 Starting com.accounting.studentaccounting})
11-07 11:01:42.771 9695-9721/com.accounting.studentaccounting I/OpenGLRenderer: Initialized EGL, version 1.4
11-07 11:01:42.898 9695-9721/com.accounting.studentaccounting W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
11-07 11:01:44.144 9695-9721/com.accounting.studentaccounting D/EGL_emulation: eglCreateContext: 0xae8f20a0: maj 2 min 0 rcv 2
11-07 11:01:44.160 9695-9721/com.accounting.studentaccounting D/EGL_emulation: eglMakeCurrent: 0xae8f20a0: ver 2 0
11-07 11:01:44.166 9695-9721/com.accounting.studentaccounting D/OpenGLRenderer: Enabling debug mode 0
11-07 11:01:44.550 9695-9721/com.accounting.studentaccounting D/EGL_emulation: eglMakeCurrent: 0xae8f20a0: ver 2 0
11-07 11:01:44.851 9097-9117/com.android.packageinstaller D/EGL_emulation: eglMakeCurrent: 0xae834b80: ver 2 0
11-07 11:01:45.273 1713-2148/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xb42fc760: ver 2 0
11-07 11:01:45.284 1713-1713/com.android.systemui I/Choreographer: Skipped 30 frames!  The application may be doing too much work on its main thread.
11-07 11:01:45.368 1713-2148/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xb42fc760: ver 2 0
11-07 11:01:45.375 1592-1618/system_process I/Choreographer: Skipped 35 frames!  The application may be doing too much work on its main thread.
11-07 11:01:45.396 1592-1803/system_process V/WindowManager: Adding window Window{3e898bff u0 SurfaceView} at 4 of 12 (before Window{26e7d21 u0 com.accounting.studentaccounting/com.accounting.studentaccounting.MainActivity})
11-07 11:01:45.461 1713-2148/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xb42fc760: ver 2 0
11-07 11:01:45.607 1592-1682/system_process W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.run() from WindowAnimator.java:124 waiters=1 for 186ms
11-07 11:01:45.731 9695-9695/com.accounting.studentaccounting D/EGL_emulation: eglCreateContext: 0xb4313940: maj 2 min 0 rcv 2
11-07 11:01:46.039 9695-9695/com.accounting.studentaccounting D/EGL_emulation: eglMakeCurrent: 0xb4313940: ver 2 0
11-07 11:01:48.695 9695-9695/com.accounting.studentaccounting I/Choreographer: Skipped 357 frames!  The application may be doing too much work on its main thread.
11-07 11:01:48.982 1592-1618/system_process I/ActivityManager: Displayed com.accounting.studentaccounting/.MainActivity: +18s615ms
11-07 11:01:49.040 1713-2148/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xb42fc760: ver 2 0
11-07 11:01:49.056 1713-2148/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xb42fc760: ver 2 0
11-07 11:01:49.245 9695-9715/com.accounting.studentaccounting D/EGL_emulation: eglMakeCurrent: 0xb4313940: ver 2 0
11-07 11:01:54.206 1592-1619/system_process W/BatteryStatsImpl: Couldn't get kernel wake lock stats
11-07 11:02:00.042 1713-2148/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xb42fc760: ver 2 0
11-07 11:02:12.524 1765-1765/com.android.inputmethod.latin I/LatinIME: Starting input. Cursor position = 0,0
11-07 11:02:12.844 1713-2148/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xb42fc760: ver 2 0
11-07 11:02:12.912 1765-4106/com.android.inputmethod.latin D/EGL_emulation: eglMakeCurrent: 0xae94f760: ver 2 0
11-07 11:02:18.298 1765-1765/com.android.inputmethod.latin I/LatinIME: Starting input. Cursor position = 0,0
11-07 11:02:25.542 1765-4106/com.android.inputmethod.latin D/EGL_emulation: eglMakeCurrent: 0xae94f760: ver 2 0
11-07 11:02:33.453 1765-2044/com.android.inputmethod.latin I/LatinIME:LogUtils: Dictionary info: dictionary = UserHistoryDictionary.en_US ; version = 1505595022 ; date = 1541577753
11-07 11:03:00.044 1713-2148/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xb42fc760: ver 2 0
11-07 11:03:07.719 1592-1683/system_process W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client

and this is my code:

class ItemList extends StatefulWidget {
  final List list;
  ItemList({this.list});
  @override
  _ItemListState createState() => _ItemListState();
}

class _ItemListState extends State<ItemList> {

  FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;

  @override
  initState() {
    super.initState();
    var Android = new AndroidInitializationSettings('@drawable/logo');
    var IOS = new IOSInitializationSettings();
    var initializationSettings = new InitializationSettings(
        Android, IOS);
    flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
    flutterLocalNotificationsPlugin.initialize(initializationSettings,
        selectNotification: onSelectNotification);


  }
  Future onSelectNotification(String payload) {

   // debugPrint("payload:  + $payload");
    showDialog(context: context,
        builder: (_) {
          new AlertDialog(
            title: new Text('Notification'),
            content: new Text('payload: $payload'),

          );
        },
        );
  }




  @override
  Widget build(BuildContext context) {
    return Container(
      child: new Padding(
                  padding: const EdgeInsets.all(15.0),
                  child: new RaisedButton(onPressed: showNotification,
                    child: new Text('تذكير بموعد الدفع',
                      style: Theme.of(context).textTheme.headline,
                    ),)
              ),
    );



  }

  Future showNotification() async {
    var android = new AndroidNotificationDetails(
        'channel id', 'channel NAME', 'channel Description');
    var iOS = new IOSNotificationDetails();
    var platform = new NotificationDetails(android, iOS);
    await flutterLocalNotificationsPlugin.show(
        0, 'new video', 'flutter local notifications', platform, payload: 'No_Sound');

  }



}

android-studio
dart
flutter
android-notifications
localnotification
asked on Stack Overflow Nov 8, 2018 by rawan taban

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0