How To make interactive notification in Flutter
How To make interactive notification in Flutter
I am making a music player app in Flutter and I am not able to find anyway to make widget or something that is displayed in the notification tray and can play pause the music. Is it even possible to achieve this in flutter and if yes, the how can I do that? Thanks in advance.
Like the musix match music controller.
– Ayush Singh
Aug 27 at 18:28
I want to make something like that for my flutter app.
– Ayush Singh
Aug 27 at 18:29
2 Answers
2
Because of the way android notifications work, you can only really customize them with android code (for now at least). So unfortunately, you're going to have to write some native code here.
The actual notification part is the exact same as directly with android in this case, so you can simply look that up. Here's a start though.
The other part to this is that you need to communicate between your flutter code and the native code which handles the notification. To do so, you need to use Platform Channels. Platform channels are things you register so that you can send data back and forth between java/kotlin/objc/swift and dart, in the form of events or 'method calls'. The docs do a better job than me of explaining how to use them.
This flutter dependency seems to do the work for me:-
https://pub.dartlang.org/packages/media_notification#-readme-tab-
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
can you any code or image that make easy to understand what you want.
– Viren V Varasadiya
Aug 27 at 18:25