@@marcin774 Not sure about you, but I find that fireship moves at such a fast pace that it makes it difficult to keep up. I feel that the content is intended more for entertainment combined with education.
@@basdfgwe I agree with you, fireship is like filelledstacks*1.5 speed. For me it's a choice of: do I want to pause the video every minute and write down what's being presented vs trying to keep up with the author by writing down his code ASAP so I won't have to pause. In my case, second approach is always 💩 - it might solve the problem I'm currently facing, but if I will face same problem again, I sure won't know how to do it and will have to rewatch the video. That's why fireship's speed doesn't bother me, cause I always spend time to analyze the content. Having said all of the above, I think, both fireship and filledstacks have AMAZING, really thought-out content, full of awesome tricks. Resocoder is not bad either :). I definitely learnt much more from them, than I learnt from official docs.
Hi Dane. Just wanted to let you know that your approach to architecture, and how you explain it in your tutorials, has made a massive difference in my progression as a Flutter dev. Couple all of that with the fact that it's coming from a fellow South African just makes the entire experience excellent. Look forward to more videos. Take care.
Hey Matthew! Thanks for reaching out and commenting, I really appreciate the words of encouragement and the feedback in general. It makes me happy to also know that I'm helping improve the "programming thinking" in general. It helps more than learning an actual framework. Thanks again, and it's great to see more SA flutter devs :D
Another great video Dane. Some additions may be the ability so send notifications to specific users by fetching their device token to a string in firestore, or even better to a array of strings, in case they install the app in multiple devices. Also creating a firebase function may help in situations where the user have to receive a notifications when someone sends him a message, like skype or viber. i use typescript for this with the server token of firebase. Covering the above in a video as a continuation of this one, can help lots of junior developers. All the best.
Thanks for the suggestions. I usually don't go too deep into app specific functionalities. I abstract what I do in multiple production apps to the core and make a video about that. There's a lot more to do but that would require a series with a specific implementation detail which won't expose more coding fundamentals and will actually just be an implementation video of something they "should" know how to do given they pick up on the techniques and principles used.
Explained in a very sophisticated way. Much appreciated. I have a QUERY, I'm showing a custom popup when notification is received(in onMessage() callback). but when the app is in the background, onMessage() wouldn't trigger how can I show a custom pop-up in this scenerio?
This push thing is so interesting. I had no idea I could squeeze out extra revenue from the same amount of traffic by simply adding push monetization to my sites. Currently I use MonadPlug, works great with AdSense.
Thank you so much for introducing the flutter project architecture. It took me some time to get used to it but now I am able to implement complex services without disturbing the core functionalities of my app. Thanks a lot, Dan :) I have one request, could you make it a full fledged video on notifications like: scheduling them, showing a notification pop up instead of it sitting in the notification tray. That would complete this.
Hey, you're very welcome. I'm happy that you have grasped onto the idea of the architecture. It's very helpful. Scheduling notifications locally? We don't really do that so there's nothing special I can show you that's no in the local notification package readme. In terms of them showing up, on Android the app has to be in the background for the notification to show. If you want it to show while it's in the foreground you have to add an onMessage listener and use the local notification package to recreate a notification for you.
@@FilledStacks Yes, I have successfully integrated it in the app. I followed exactly what you suggested just that it took me some extra time. In any case, thanks for your comment :) I have been following your playlist on food-delivery app. It teaches me how to think, structure, manage and maintain real-world projects at scale. Looking forward for more videos there 😇
Hello Sir, in new Android devices (including Emulators) , notifications are received with no sound even when enabling sound from the Firebase send notification dashboard. How to fix this issue? thanks
Thank You. I am sharing this video and not skipping any ads(i feel guilty watching your videos for Free). Would love to see more videos on provider package(mainly stream provider). Also if possible please make a video about creating APIs and a sample app that communicates with multiple APIs and passes the data received internally in the app. Thank you again for the tutorial. Have a great day. Peace✌🏻✌️✌️
Thank you. very much appreciated. All my videos use provider 😅 how many more do you want to see haha. I also have created videos about using an api called state and api integration in flutter. also all 3 of my architecture videos cover api calling and data passing.
Hi, based on your provider architecture, is there a way to choose when 'onModelReady' should be executed? For example: Fetching comments via 'onModelReady' on homeview, I navigate to another view and back to homeview again, this is where I don't want to fetch comments again since the data has been fetched previously. right now, 'onModelReady' just runs whenever I navigate to the view.
Good question. No there’s not, I usually build that into the service (return local data or from memory). The view will have no state. It will always be constructed new when you navigate to it. You’ll have to cache your view yourself and pass that when navigating to avoid constructing it again
@@FilledStacks When you said 'cache the view yourself', is this UI view caching implemented using the 'cache_manager' package that you have shown in your written tutorial?
@@alvin3171997 No, you can use a map with a key and a widget or just save the view reference as a widget locally to re-use when needed. Widget myView = MyView() build() { return myView; } That way you only construct it once and then pass it to the build function over and over as it needs it.
Hi Dane, great video as always thank you. I've followed this tutorial and have one problem with the push notification and hoping you might be able to help. The notifications are received and logs are printed correctly(onResume,onMessage,onLaunch printed accordingly) but navigation is not happening when the app is brought to the front . Upon checking I found out that the Global key for navigation is null when I click the notification and open the app(I'm using the navigation as a service guide from you ). This happens when app is minimized or closed with the back button. Any idea what I might be doing wrong?
That's usually something that happens if you initialise the push notification service before you set the navigation key. I would move the push notification service initialise to the startup viewmodel if it's not there. Or to the homeviewmodel where you land after the startup viewmodel.
Thank you for your awesome work :) Can you kindly suggest can i use the same to send notification for video calls. In that case, how to set the sender of the video call in the FCM?
The is handling notifications, not sending custom notification. I would have a cloud function where you can submit a name and a token and it sends the notification to the user. Or better a reactive function that listens to a collection of calls. When a new document is made it sends a notification to the receiver token in the document.
@@FilledStacks Thank you for your response and your valuable time. I am using a Go server , will listen to call and send notification to receiver via FCM. Is that correct?
Wow the video was super useful! How to trigger notifications based on changes in firestore? For example, if a new document is added, a notification should be sent.
you can use any other free api you want and call fcm from there to send a notification. You won't have real time functionality but you can probably tell your api from your app that there's a new notification to be sent.
Using this setup with DialogService from Stacked. when onMessage is triggered I use showDialog- this works fine, until the scenario where there's a second onMessage triggered before the user has tapped OK on the first dialog. They can tap ok on the second one, but if they try to tap again, the dialog is stuck there. the getter 'isCompleted' was called on null. Receiver: null Tried calling: isCompleted When the exception was thrown, this was the stack #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5) #1 DialogService._showDialog. package:stacked_services/…/dialog/dialog_service.dart:127 #2 GestureRecognizer.invokeCallback package:flutter/…/gestures/recognizer.dart:183 #3 TapGestureRecognizer.handleTapUp
Most likely because it's still being shown. We could probably add a flag for you to check if a dialog is currently being shown. That should help. For now you can track that in the push notification service to avoid showing the dialog again.
You're very welcome :) The cool thing about wrapping your code in a service class is that you can inject it and make use of it in basically any architecture. BLoC, redux, MVC. Happy to see you found some value in it.
in my flutter app users receive notifications for some time(forground,background,killed) but then background notifications stops receiving. App is only for android. What could be the issue.
yep. You ask for it in the onTap handler. Just call your model.askForPermissions function if you have one. Or whatever your permission request function is called.
Really enjoy your totorials. Very crisp and good architecture design. Only on this push notification service, I realise that there are challenges when using a service...showing a UI snackbar from a service without BuildContext is a problem (fixed using package Get.snackbar)...state management store dispatch calls from services without BuildContext are a real headache...
Thank you, I appreciate the kind words. They are. We have a snackbar service available as well which just wraps get snackbar functionality and adds easier way to register and show custom snack bars.
Can you please also describe how to send those push notifications on specific categories? Right now all the notifications go to the Miscellaneous category which is very bad because we can't set priorities for the notifications. I can't find any way to do that. Please help!!! Thank you!
Hi Dane, I followed your tutorial and successfully sent a notification that redirects my flutter app to another route. My problem is when I restart my flutter. It looks like it doe'snt clear the previous notifiation and trigger the callback and automatically redirects the route again. Is this the default behavior?
No, that's not default behaviour. Sounds like the same function is firing when the app opens again. When you tap on the notification it'll fire the onResume function and pass it the same notification function.
Is that black screen at the start of the app or when reloading the app on the emulator ? In my recent project i have the sam issue, but i haven't started looking that much into it.
That screen is when the app is launched from the push notification. It doesn't happen on devices for me since my push notification navigation logic runs after the first screen is drawn. What I have done before is performed a delayed navigation so the normal app startup view rendering is complete and then I navigate.
Hi! You can create video with tutorial how to create in app notifications? Maybe who know, how to show user notification every fay in 9:00 am or 7:00 pm? It's push notifications or in-app notifications? I am newer in Flutter, and can't understand, how realize that. Thank you!
First of all, thank you this great tutorial. I just want to how to receive notification even if the app is terminated. Can you provide me some example/s?
You're very welcome. It does that automatically for you when a notification is received. If you're talking about running background code when you receive a notification you can supply a static background function callback to the configure function.
@@FilledStacks Hello. I am finally able to figure out why the app is not receiving notifications on my end. Basically, my app is running on vivo 1718 and upon checking on More Settings -> Applications -> Autostart, my app is not enabled. When I tried to enable my app on Autostart, opened it again (to initialize firebase messaging) and terminated it to test if it is going to receive notification. I triggered my server to send some notification and BAAM. It worked. How's that possible? Can you please explain? Anyways, thanks for helping.
Hey, I have been looking how to send a notification if certain value is changed in the database. Like in a monitoring app I need to send a notification if certain value is exceeded or goes less than the critical value. Please help me, I'm stuck here....
Add a cloud function trigger on the documents you want to listen to. Use the onUpdate trigger. Get the document in the trigger, look at the value and then send the notification if it matches your criteria.
Great tutorial! Hi Dane! can you extend the push notification tutorial to Notification to Specific Device User? Say something like a new message received to Specific user?
Thank you. That functionality you would do using topics. I show at the end how to register topics. register your users unique ID as a topic. That way you can send only to that user using the topic functionality. In the push notification initialise functionality you should register every user to a topic of their user id.
@@FilledStacks Dane, wouldnt this be an issue if you use each users unique ID as a subscription topic in order to send specific messages just for that user ? My line of thinking is if you have a very large app with millions of users (say 50+ million) then your approach would have 50 million unique subscriptions if your use case was to send specific messages to a user ? Your suggestion has 1 benefit of simplifying sending a message to all devices owned by 1 user (No need to worry about device tokens and manage this state). However - GCM documentation does point out that if your requirement is to send out messages to a user that has multiple devices DEVICE GROUP MESSAGING instead. My reservation about your approach is a) Latency, b) FCM servers registering so many user topics, c) Potential limitation now or in the future for total number of topics. Lastly, I realise that maintaining Tokens etc is somewhat more troublesome to implement then topic based subscriptions - but just wanted to know why this wasnt suggested as the overhead in terms of FCM processing seems much less than maintaining millions of topics - and have you used your approach on very large installations without any issues ?
@@paulbaker2499 Thanks for the detailed question Paul. I appreciate the details. To be honest we experience latency with all push notification registration types. I use topics for the simplicity it provides, the number of topics registered wouldn't make a difference or so far it hasn't. The largest user base I've worked with is about 500k installs all registering 1-3 topics. There's been no noticeable lags. We've recently started using segment for push notifications which allows you to send directly to a push notification token. If you identified the user then you can use the token directly to send a notification. That would basically be the same as maintaining an updated user token on your server side database and using that to send the push notification directly. There might be a small decrease in notification lag given that it's not going through the topic queue mechanism, but I haven't seen a large difference. I'd be interested to see the actual difference. I don't think there would be, but FCM is not very consistent so I wouldn't be suprised if what you found is the better way of doing it. At this moment i won't be able to confirm my way is better so I'd lean towards saying you should try the way you read that's recommended, if that doesn't work come back and check out the topic way of doing things.
Sir i need your help. Sir How to get someone’s birthday reminders offline, about he/she you added to a sqlite database listview? FCM needs internet connection but i need to be notified offline , yes using flutter
Hi I am new to flutter and I have created an e-commerce app using your video so I would like to know have you worked with payments in flutter if yes can you please make a video coz I tried with strip and Paypal they are okay but they don't support the South African Rand please suggest and payment gateway for payment that supports the Rand in Flutter
This is the code required to receive a push notification. If you want to send to a user you can just pass that users FCM token to your backend when sending the message and it'll go directly to that user.
no. this code is not for sending messages. You should not be watching this video. You should be learning problem solving skills and fundamentals of programming. Then sending doesn't happen on a device. A backend sends the push notifications. Not the app itself.
it's my pleasure to make. I might do an on onboarding process but i won't be doing a bottom nav bar. there's lots of tutorial out there on that one already.
@@FilledStacks Thanks!!! I'll try to figure out a way to incorporate a bottom nav bar on the HomeView. Still learning stuff about provider and flutter in general. Thanks for you great videos man! #FilledStacksArmy
@@maakuuuNice! Yeah it's a common misconception that you'd have to implement things differently. But the way my architecture is setup is to ensure you can still implement things the same way as you would without the provider architecture.
Normal architecture meaning everything in one file? If so then no. This is the only way I write code. This can be used with any code setup, it's just an application of the S in the SOLID principles. It actually has nothing to do with any architecture. This is exactly how i would use it in BLoC, Redux or and other state management solution that exists for Flutter. So whichever one you use, you can apply this directly. Only different would be I won't call my class a service, I'd call it something else (whatever you like calling a class that wraps functionality into a single place).
@@whyimustusemyrealname3801 Aaaaaah I see. I don't use BloC but I know a lot of devs that use bloc with services. It just makes sense to wrap functionality that belongs together into one file. That's if you use the SOLID principles as your base for software engineering. If you don't then most likely you're fine with mixing functionality across multiple files. All I'm doing here is making a class that handles all the push notification stuff, you can call it from your Bloc, your views, the main file. It's just something that helps with maintenance, it doesn't have anything to do with the state management solution.
@@FilledStacks hey thanks for being so interactive hope your channel will grow more, thanks I think I will just make one class for the notifications/services like you said
@@whyimustusemyrealname3801 You're welcome. My goal is to help spread the knowledge that's helped me build and deliver large projects. The comment section is a great place to do that so I'm very grateful for questions. Especially challenging ones that will help me get more insights into how other developers do things. We're both benefiting from it so it's a win-win! Thanks again for commenting.
For iOS you have to make sure your certs you upload for push notification matches the app id you selected in the dev account and in your project in xcode. It's very important.
@@FilledStacks It does match... In fact, I can receive the notifications on background and when the app is closed butthe callback function onMessage is never called...
That's usually the only time you receive the notifications. When it's not in the foreground. That's how it works in this video. You have to run in release mode because closing the app after a debugger is attached leaves it in an unwanted state.
Thanks for sharing that. I appreciate it. The website does have quite a lot of useful content in it. I'd also recommend everyone to go and check it out :D
That is expected like I said in the tutorial. I explained the three callbacks and when the messages come through. Notifications won't show in the notification panel when the app is open because the purpose of a notification is to get you into the app. If the app is open it doesn't need to do that because you're already in the app.
@@devdeejay749 lol on Android you can call the notification center and push it yourself from the app, what happens is simple lol (on iOS too) 1) Your app is running 2) your app receive a message notification 3) your app connects to the notification center and post the notification there itself 4) you get a notification, How do you reproduce this in flutter , easy -> Follow this tutorial till the end -> Go on Pub.dev and add the package called "Flutter_local_notification" -> Follow the page installation tutorial and you will see that you can actually send a notification to yourself any time lol using -> Once you receive a notification from your app, on the method that handle the app on foreground, just add the piece of code of "flutterLocalNotification" lol and you'll be done Conlusion: Coding is simple, you just need to be creative
the notification icons are set through the android manifest. You can also set it through native android code. Don't have the code right now but I did it a while back.
i have all of the videos.. why are you guyz sending the notification when the app is in foreground do one thing please send the notification when you are in the app the notification will never arrive..
Notifications don't show up in the system tray when the app is open. That is by design. It shouldn't show up there because the app is already open. Notifications is a way for a developer to get the user to open the app again, there's no point in a notification if the app is already open. It only shows when it's in the background. And in the video i send a notification in all the states.
provide a static function to the background handler that calls into native code to open your activity into the foreground.You'll probably get banned from the app store if you do that since it goes against the new "less phone usage" rules all OS's are putting in place. Opening your app on someones phone while they're busy would definitely warrant an immediate uninstall. At least for me.
@@FilledStacks I did it with webview in the app, then had a success page on the url. Email me, I'll send you the app in Google play to check out. emsm007@gmail.com
You're very welcome. You can implement it the exact same way in a chat app. The type of application doesn't change the way this particular set of code will be written.
That's because it's been removed. You should always consider the date of the video and most importantly look at the readme for the package being used. That'll ensure you always use the latest implementation of something. I think it's FirebaseMessaging.instance now.
@@chinmayagarnaik6458 Shouldn't make a difference. I use that logic in all my apps, even the desktop ones which are on master, latest. Clean your project and run again.
@@omtecnologia Yeah, iOS has one of the worst native integration experiences for these things. You'll have to play around with it until the notifications show up.
@@FilledStacks iOS needs a request permission, and this is not working for my app... idk what is wrong.. any example iOS code? NotificationSettings settings = await messaging.requestPermission( alert: true, announcement: false, badge: true, carPlay: false, criticalAlert: false, provisional: false, sound: true, );
Thank you. Views don't matter much to me ☺️ i care about bringing value and helping. If this video has helped you or anyone else then i've achieved my goal. The views is not my main priority.
I can. It's a service class that wraps the navigation functionality so we can make use of it without the context. Watch the previous videos or just install stacked_Services and assign the nav key in your main file.
Out of the many Flutter tutorials out there, you're one of the channels that stands out, well done!
Your work is highly appreciated.
Thank you very much, I really appreciate the kind words. I try my best to deliver quality and value in every video so I appreciate the comment.
you should also checkout "fireship"
@@marcin774 Not sure about you, but I find that fireship moves at such a fast pace that it makes it difficult to keep up. I feel that the content is intended more for entertainment combined with education.
@@basdfgwe I agree with you, fireship is like filelledstacks*1.5 speed. For me it's a choice of: do I want to pause the video every minute and write down what's being presented vs trying to keep up with the author by writing down his code ASAP so I won't have to pause. In my case, second approach is always 💩 - it might solve the problem I'm currently facing, but if I will face same problem again, I sure won't know how to do it and will have to rewatch the video. That's why fireship's speed doesn't bother me, cause I always spend time to analyze the content. Having said all of the above, I think, both fireship and filledstacks have AMAZING, really thought-out content, full of awesome tricks. Resocoder is not bad either :). I definitely learnt much more from them, than I learnt from official docs.
Hi Dane. Just wanted to let you know that your approach to architecture, and how you explain it in your tutorials, has made a massive difference in my progression as a Flutter dev. Couple all of that with the fact that it's coming from a fellow South African just makes the entire experience excellent. Look forward to more videos. Take care.
Hey Matthew! Thanks for reaching out and commenting, I really appreciate the words of encouragement and the feedback in general.
It makes me happy to also know that I'm helping improve the "programming thinking" in general. It helps more than learning an actual framework.
Thanks again, and it's great to see more SA flutter devs :D
Your quality videos help to make of flutter a better community, I acquired most of my knowledge through this channel, thanks filledstacks ❤️🙏
That’s so awesome to hear. Thank you for the comment and I’m happy that I could help you on your journey.
Amazing tutorial, thank you for leveling up Flutter's community!
Thanks for watching and thank you for the positive feedback.
Dam you're helping me increase my income.Thank you so much.God bless you
hehe, that's the goal :) You're very welcome. Goodluck with your business, hope it goes great!
omg! Thank you so much your the best please make more every week.
It's my pleasure :) I will try my hardest to make more every week.
@@FilledStacks please add more tutorial i think you re the best
@@kemids2842 Can't argue with you. He's very straightforward. ♥
Can't argue either.. Didn't think it was so simple to have push notifications..
As always, brilliant and straight to the point!
Awesome. I'm happy I could be helpful, and thank you for watching the video.
Another great video Dane. Some additions may be the ability so send notifications to specific users by fetching their device token to a string in firestore, or even better to a array of strings, in case they install the app in multiple devices.
Also creating a firebase function may help in situations where the user have to receive a notifications when someone sends him a message, like skype or viber. i use typescript for this with the server token of firebase.
Covering the above in a video as a continuation of this one, can help lots of junior developers.
All the best.
Thanks for the suggestions. I usually don't go too deep into app specific functionalities. I abstract what I do in multiple production apps to the core and make a video about that. There's a lot more to do but that would require a series with a specific implementation detail which won't expose more coding fundamentals and will actually just be an implementation video of something they "should" know how to do given they pick up on the techniques and principles used.
This video was really helpful. Thanks. Have one question, doesn't Android require notification permissions?
Awesome. I'm happy to hear that it helped. And no, Android doesn't require permissions.
You sir are AMAZING. Loved your tutorial , it was a breeze. Thank you!!!!!
Niiiiice!!! That's exactly how implementing these features should feel. Especially with the setup and architecture that I'm using.
@@FilledStacks Speaking of which i'm getting a null navigator when i'm testing. Any idea what i'm doing wrong?
Bravo! This is complex task but you made it so simple! Great 🤩
Yeeaahhhh!! It's awesome right! I use this implementation in all my apps.
@@FilledStacks me too :)
Explained in a very sophisticated way. Much appreciated.
I have a QUERY, I'm showing a custom popup when notification is received(in onMessage() callback). but when the app is in the background, onMessage() wouldn't trigger how can I show a custom pop-up in this scenerio?
You'll listen to the onbackground message function and schedule a local notification when it comes through.
@@FilledStacks Thanks and love
This push thing is so interesting. I had no idea I could squeeze out extra revenue from the same amount of traffic by simply adding push monetization to my sites. Currently I use MonadPlug, works great with AdSense.
I did not know that either, I don't use push for monetisation but clients use it to lure users back to the app to make more purchases :)
South Africa! Representing!! Wohoooo!!!!
Yeeeaaahhhh!!! SA in the house
Awesome video. You make it easy to understand. Thank you!
You're very welcome Tuan :) Thanks for watching and always giving feedback. I appreciate it.
Thank you so much for introducing the flutter project architecture. It took me some time to get used to it but now I am able to implement complex services without disturbing the core functionalities of my app. Thanks a lot, Dan :)
I have one request, could you make it a full fledged video on notifications like: scheduling them, showing a notification pop up instead of it sitting in the notification tray.
That would complete this.
Hey, you're very welcome. I'm happy that you have grasped onto the idea of the architecture. It's very helpful.
Scheduling notifications locally? We don't really do that so there's nothing special I can show you that's no in the local notification package readme.
In terms of them showing up, on Android the app has to be in the background for the notification to show. If you want it to show while it's in the foreground you have to add an onMessage listener and use the local notification package to recreate a notification for you.
@@FilledStacks Yes, I have successfully integrated it in the app. I followed exactly what you suggested just that it took me some extra time. In any case, thanks for your comment :)
I have been following your playlist on food-delivery app. It teaches me how to think, structure, manage and maintain real-world projects at scale. Looking forward for more videos there 😇
@@niteshmethani9884 Awesome! I'm very happy to hear that. I'll be sharing some of my real world app building soon. Stick around!
Hello Sir, in new Android devices (including Emulators) , notifications are received with no sound even when enabling sound from the Firebase send notification dashboard. How to fix this issue? thanks
Hi hi, I have no idea. I haven't experienced this. In fact I've actually never tested sound. Wouldn't be able to help you out there.
Thank You. I am sharing this video and not skipping any ads(i feel guilty watching your videos for Free). Would love to see more videos on provider package(mainly stream provider). Also if possible please make a video about creating APIs and a sample app that communicates with multiple APIs and passes the data received internally in the app. Thank you again for the tutorial. Have a great day. Peace✌🏻✌️✌️
Thank you. very much appreciated. All my videos use provider 😅 how many more do you want to see haha. I also have created videos about using an api called state and api integration in flutter. also all 3 of my architecture videos cover api calling and data passing.
Thank you sharing. I would really like to see a demonstration like this for flutter web and push notifications.
That's a good idea. I'll see if I can fit that into my schedule of videos for the year.
Hi, based on your provider architecture, is there a way to choose when 'onModelReady' should be executed?
For example:
Fetching comments via 'onModelReady' on homeview, I navigate to another view and back to homeview again, this is where I don't want to fetch comments again since the data has been fetched previously.
right now, 'onModelReady' just runs whenever I navigate to the view.
Good question. No there’s not, I usually build that into the service (return local data or from memory). The view will have no state. It will always be constructed new when you navigate to it. You’ll have to cache your view yourself and pass that when navigating to avoid constructing it again
@@FilledStacks And that service will be registered using "LazySIngleton", right?
@@alvin3171997 Yes, all services are registered as a lazy singleton to ensure there's only one in the app.
@@FilledStacks When you said 'cache the view yourself', is this UI view caching implemented using the 'cache_manager' package that you have shown in your written tutorial?
@@alvin3171997 No, you can use a map with a key and a widget or just save the view reference as a widget locally to re-use when needed.
Widget myView = MyView()
build() {
return myView;
}
That way you only construct it once and then pass it to the build function over and over as it needs it.
Hi Dane, great video as always thank you. I've followed this tutorial and have one problem with the push notification and hoping you might be able to help. The notifications are received and logs are printed correctly(onResume,onMessage,onLaunch printed accordingly) but navigation is not happening when the app is brought to the front . Upon checking I found out that the Global key for navigation is null when I click the notification and open the app(I'm using the navigation as a service guide from you ). This happens when app is minimized or closed with the back button. Any idea what I might be doing wrong?
That's usually something that happens if you initialise the push notification service before you set the navigation key. I would move the push notification service initialise to the startup viewmodel if it's not there. Or to the homeviewmodel where you land after the startup viewmodel.
Worked like a charm...thanks a million
@@lallawmzualakhawlhring7340 Awesome. Happy to hear that it's worked
you're the best , thank you
Thank you very much! :)
Thank you for your awesome work :)
Can you kindly suggest can i use the same to send notification for video calls. In that case, how to set the sender of the video call in the FCM?
The is handling notifications, not sending custom notification. I would have a cloud function where you can submit a name and a token and it sends the notification to the user.
Or better a reactive function that listens to a collection of calls. When a new document is made it sends a notification to the receiver token in the document.
@@FilledStacks Thank you for your response and your valuable time. I am using a Go server , will listen to call and send notification to receiver via FCM. Is that correct?
yep that's correct.
Wow the video was super useful!
How to trigger notifications based on changes in firestore? For example, if a new document is added, a notification should be sent.
You create a firebase function listening to your collection using the updated callback and then send your push notifications from that function.
@@FilledStacks
Recently firebase cloud functions was changed to a paid feature.
Are there any alternate methods to do this without firebase functions?
you can use any other free api you want and call fcm from there to send a notification. You won't have real time functionality but you can probably tell your api from your app that there's a new notification to be sent.
Hello thanks for the great tutorial
Is there a way to save notifications locally for example using the hive package when the app is in the background
You're very welcome. And yes, you do exactly as you said now. use hive or any local storage and store it locally.
@@FilledStacks i tried that but their is a problem working onBackground method i can't use them is their a way around that?
Great work Dane, Has anyone tested this for ios as well ?
Yes, we all have. This is what I use for my clients applications and our own.
Using this setup with DialogService from Stacked. when onMessage is triggered I use showDialog- this works fine, until the scenario where there's a second onMessage triggered before the user has tapped OK on the first dialog.
They can tap ok on the second one, but if they try to tap again, the dialog is stuck there.
the getter 'isCompleted' was called on null.
Receiver: null
Tried calling: isCompleted
When the exception was thrown, this was the stack
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1 DialogService._showDialog.
package:stacked_services/…/dialog/dialog_service.dart:127
#2 GestureRecognizer.invokeCallback
package:flutter/…/gestures/recognizer.dart:183
#3 TapGestureRecognizer.handleTapUp
Most likely because it's still being shown. We could probably add a flag for you to check if a dialog is currently being shown. That should help. For now you can track that in the push notification service to avoid showing the dialog again.
very very nice video... the implementation was a bit different for me because i'm not using view models but your video was extremely helpful, thanks
You're very welcome :) The cool thing about wrapping your code in a service class is that you can inject it and make use of it in basically any architecture. BLoC, redux, MVC. Happy to see you found some value in it.
How did you do it?
@@bestrazer I'm using provider
Thanks
I have a chat app and i want to show notification to specific users ?
How to show that?
You send a push notification to the users FCM token.
in my flutter app users receive notifications for some time(forground,background,killed) but then background notifications stops receiving. App is only for android. What could be the issue.
Background messages need to have a certain format. Make sure the push notification payload is "marked for background"
Forecast asking for permission on app load, is it possible to ask for permission on a button click or somewhere in the inside screen?
yep. You ask for it in the onTap handler. Just call your model.askForPermissions function if you have one. Or whatever your permission request function is called.
Really enjoy your totorials. Very crisp and good architecture design.
Only on this push notification service, I realise that there are challenges when using a service...showing a UI snackbar from a service without BuildContext is a problem (fixed using package Get.snackbar)...state management store dispatch calls from services without BuildContext are a real headache...
Thank you, I appreciate the kind words. They are. We have a snackbar service available as well which just wraps get snackbar functionality and adds easier way to register and show custom snack bars.
Can you please also describe how to send those push notifications on specific categories? Right now all the notifications go to the Miscellaneous category which is very bad because we can't set priorities for the notifications. I can't find any way to do that. Please help!!! Thank you!
Subscribe to a topic to send to specific topics. Register a channel on Android for custom Channels.
Hi Dane, I followed your tutorial and successfully sent a notification that redirects my flutter app to another route. My problem is when I restart my flutter. It looks like it doe'snt clear the previous notifiation and trigger the callback and automatically redirects the route again. Is this the default behavior?
No, that's not default behaviour. Sounds like the same function is firing when the app opens again. When you tap on the notification it'll fire the onResume function and pass it the same notification function.
Is that black screen at the start of the app or when reloading the app on the emulator ? In my recent project i have the sam issue, but i haven't started looking that much into it.
That screen is when the app is launched from the push notification. It doesn't happen on devices for me since my push notification navigation logic runs after the first screen is drawn. What I have done before is performed a delayed navigation so the normal app startup view rendering is complete and then I navigate.
Thats some clean code. 😁
haha you know I always try to keep it that way :)
hello, what emulator you use to work with flutter, I was using Genymotion but I failed to implement Firebase Auth and Notifications..
Hi I use the Pixel 2 AVD provided by Android in the Developer tools
Thank you so much bro for those vids
You're very welcome Gabriel :)
Hello, is posible save push notifications before user click it?
Before the user clicks, probably not. But when the user clicks you can save it.
awe nice tut
Thanks Thanks!
Excelent video, very useful.
Awesome! Very happy to hear that.
You're doing great work keep it up big brother !
Thank you! I'll try my best to do so
Hi!
You can create video with tutorial how to create in app notifications?
Maybe who know, how to show user notification every fay in 9:00 am or 7:00 pm? It's push notifications or in-app notifications? I am newer in Flutter, and can't understand, how realize that.
Thank you!
Hi, I see a few comments on Local notifications. I will look into that after this series of videos is complete.
Thanks best Regards from #PH
You're welcome! And thank you :)
First of all, thank you this great tutorial. I just want to how to receive notification even if the app is terminated. Can you provide me some example/s?
You're very welcome. It does that automatically for you when a notification is received. If you're talking about running background code when you receive a notification you can supply a static background function callback to the configure function.
@@FilledStacks Hello. I am finally able to figure out why the app is not receiving notifications on my end. Basically, my app is running on vivo 1718 and upon checking on More Settings -> Applications -> Autostart, my app is not enabled. When I tried to enable my app on Autostart, opened it again (to initialize firebase messaging) and terminated it to test if it is going to receive notification. I triggered my server to send some notification and BAAM. It worked. How's that possible? Can you please explain? Anyways, thanks for helping.
Thank you very much
You're very welcome :)
Hey, I have been looking how to send a notification if certain value is changed in the database. Like in a monitoring app I need to send a notification if certain value is exceeded or goes less than the critical value. Please help me, I'm stuck here....
Add a cloud function trigger on the documents you want to listen to. Use the onUpdate trigger. Get the document in the trigger, look at the value and then send the notification if it matches your criteria.
Great tutorial!
Hi Dane! can you extend the push notification tutorial to Notification to Specific Device User?
Say something like a new message received to Specific user?
Thank you. That functionality you would do using topics. I show at the end how to register topics. register your users unique ID as a topic. That way you can send only to that user using the topic functionality. In the push notification initialise functionality you should register every user to a topic of their user id.
@@FilledStacks Dane, wouldnt this be an issue if you use each users unique ID as a subscription topic in order to send specific messages just for that user ? My line of thinking is if you have a very large app with millions of users (say 50+ million) then your approach would have 50 million unique subscriptions if your use case was to send specific messages to a user ? Your suggestion has 1 benefit of simplifying sending a message to all devices owned by 1 user (No need to worry about device tokens and manage this state). However - GCM documentation does point out that if your requirement is to send out messages to a user that has multiple devices DEVICE GROUP MESSAGING instead. My reservation about your approach is a) Latency, b) FCM servers registering so many user topics, c) Potential limitation now or in the future for total number of topics. Lastly, I realise that maintaining Tokens etc is somewhat more troublesome to implement then topic based subscriptions - but just wanted to know why this wasnt suggested as the overhead in terms of FCM processing seems much less than maintaining millions of topics - and have you used your approach on very large installations without any issues ?
@@paulbaker2499 Thanks for the detailed question Paul. I appreciate the details. To be honest we experience latency with all push notification registration types. I use topics for the simplicity it provides, the number of topics registered wouldn't make a difference or so far it hasn't. The largest user base I've worked with is about 500k installs all registering 1-3 topics. There's been no noticeable lags. We've recently started using segment for push notifications which allows you to send directly to a push notification token. If you identified the user then you can use the token directly to send a notification. That would basically be the same as maintaining an updated user token on your server side database and using that to send the push notification directly.
There might be a small decrease in notification lag given that it's not going through the topic queue mechanism, but I haven't seen a large difference. I'd be interested to see the actual difference. I don't think there would be, but FCM is not very consistent so I wouldn't be suprised if what you found is the better way of doing it. At this moment i won't be able to confirm my way is better so I'd lean towards saying you should try the way you read that's recommended, if that doesn't work come back and check out the topic way of doing things.
@@paulbaker2499 register your device id to the server and only send to device with that id bro, no need to use topic
register your device id to the server and only send to device with that id bro, no need to use topic
Sir i need your help. Sir How to get someone’s birthday reminders offline, about he/she you added to a sqlite database listview? FCM needs internet connection but i need to be notified offline , yes using flutter
When adding the birthday schedule a local notification for that day.
@@FilledStacks can you make a video on setting reminders on a particular date ?
I can not. Because the readme for the local notifications package has the code in it
@@FilledStacks oh really but i read the readme carefully, where is it in the readme? Please
the part where you schedule the notification for a specific time.
Great video can we get one for local notifications for flutter 😊... Love you videos thank you ❤️
Thank you. Not in this series but I’ll probably do one after.
@@FilledStacks have you done it
@@jemmytech5474 I have not
Hi I am new to flutter and I have created an e-commerce app using your video so I would like to know have you worked with payments in flutter if yes can you please make a video coz I tried with strip and Paypal they are okay but they don't support the South African Rand please suggest and payment gateway for payment that supports the Rand in Flutter
Hey,yes I have. we use payfast for payment integration. they have docs on their site om how to do it.
FilledStacks can you please do a video on it using http request for payments
Wow! Such an awesome job to make it simple as possible. Does this work in iOS also?
Thank you :) Yes Flutter runs on iOS and Android
Is it possible to send separate messages to different users this way?
This is the code required to receive a push notification. If you want to send to a user you can just pass that users FCM token to your backend when sending the message and it'll go directly to that user.
@@FilledStacks It's not clear to me sir. Can this code send a message only to the user we want?
no. this code is not for sending messages. You should not be watching this video. You should be learning problem solving skills and fundamentals of programming.
Then sending doesn't happen on a device. A backend sends the push notifications. Not the app itself.
Thank you for this. Would you mind to implement a bottom nav bar along with onboarding process via sharedpreferences? :)
it's my pleasure to make. I might do an on onboarding process but i won't be doing a bottom nav bar. there's lots of tutorial out there on that one already.
@@FilledStacks Thanks!!! I'll try to figure out a way to incorporate a bottom nav bar on the HomeView. Still learning stuff about provider and flutter in general. Thanks for you great videos man! #FilledStacksArmy
@@maakuuuNice! Yeah it's a common misconception that you'd have to implement things differently. But the way my architecture is setup is to ensure you can still implement things the same way as you would without the provider architecture.
always the best
Thanks yoooouu :)
Can you please explain Locator.dart? What is it and how do I implement it?
I have in my other videos. Search for provider architecture on my channel and watch that video.
do you have a version with normal architecture? I don't like to use services or viewmodel concept.
Normal architecture meaning everything in one file? If so then no. This is the only way I write code. This can be used with any code setup, it's just an application of the S in the SOLID principles. It actually has nothing to do with any architecture. This is exactly how i would use it in BLoC, Redux or and other state management solution that exists for Flutter. So whichever one you use, you can apply this directly. Only different would be I won't call my class a service, I'd call it something else (whatever you like calling a class that wraps functionality into a single place).
@@FilledStacks not one file, but I kinda new my architecture following bloc example by felangel
@@whyimustusemyrealname3801 Aaaaaah I see. I don't use BloC but I know a lot of devs that use bloc with services. It just makes sense to wrap functionality that belongs together into one file. That's if you use the SOLID principles as your base for software engineering. If you don't then most likely you're fine with mixing functionality across multiple files. All I'm doing here is making a class that handles all the push notification stuff, you can call it from your Bloc, your views, the main file. It's just something that helps with maintenance, it doesn't have anything to do with the state management solution.
@@FilledStacks hey thanks for being so interactive hope your channel will grow more, thanks I think I will just make one class for the notifications/services like you said
@@whyimustusemyrealname3801 You're welcome. My goal is to help spread the knowledge that's helped me build and deliver large projects. The comment section is a great place to do that so I'm very grateful for questions. Especially challenging ones that will help me get more insights into how other developers do things. We're both benefiting from it so it's a win-win! Thanks again for commenting.
Hi. please make a video about this topics with recent version of firebase messaging. Thanks in advance.
Hi, that should be coming up soon in the BoxtOut series I'm doing
Please make 'onBackgroundMessage' handler tutorial as well!
If you know about the property you know how to use it. You just supply a static function to it and it'll be called when you get a notification.
For me, it's only working on emulator, not on the physical Device. I'am not using local notifications plugin (on iOS)
For iOS you have to make sure your certs you upload for push notification matches the app id you selected in the dev account and in your project in xcode. It's very important.
@@FilledStacks It does match... In fact, I can receive the notifications on background and when the app is closed butthe callback function onMessage is never called...
Mmmmm, you’ll have to check the docs for that. I think they mention it in there that only resume and startup is used in iOS.
Nice work man
Please when the app is closed... I don't receive notifications, can you help out
That's usually the only time you receive the notifications. When it's not in the foreground. That's how it works in this video. You have to run in release mode because closing the app after a debugger is attached leaves it in an unwanted state.
I have actually been running in release mode... Thanks for the reply anyways anyways
Awesome 👍👍👍
Thank you. I try ;)
guys visit his website (link in description)
He has amazing contents with great details and superb ui ux.
Loved it♥️
Thanks for sharing that. I appreciate it. The website does have quite a lot of useful content in it. I'd also recommend everyone to go and check it out :D
I am not receiving notification when my app is in the foreground in the IOS device. please help
That is expected like I said in the tutorial. I explained the three callbacks and when the messages come through. Notifications won't show in the notification panel when the app is open because the purpose of a notification is to get you into the app. If the app is open it doesn't need to do that because you're already in the app.
@@FilledStacks But we still get whatsapp notification from different chats right? even though we might still be using the app.
@@devdeejay749 you got a point here, I want to do the same.
@@devdeejay749 maybe we should use local notifications for that case ?
@@devdeejay749 lol on Android you can call the notification center and push it yourself from the app, what happens is simple lol (on iOS too)
1) Your app is running
2) your app receive a message notification
3) your app connects to the notification center and post the notification there itself
4) you get a notification, How do you reproduce this in flutter , easy
-> Follow this tutorial till the end
-> Go on Pub.dev and add the package called "Flutter_local_notification"
-> Follow the page installation tutorial and you will see that you can actually send a notification to yourself any time lol using
-> Once you receive a notification from your app, on the method that handle the app on foreground, just add the piece of code of "flutterLocalNotification" lol and you'll be done
Conlusion: Coding is simple, you just need to be creative
Good stuff
Thank you :)
really amazing tutorial as always can you do search and filter with firebase please love lots
Thank you, I think search functionality is also on the list of tutorials to make
up for this also excited for this tutorial please make it this week
@@kemids2842 I have other things planned for the next few weeks, I'll see if I can slot it in after that
@@FilledStacks omg always be your no1 fan
😎😎🤗
How to send targeted notifications to a specific user / device ?
Subscribe them to a topic using their unique identifier, then send the message directly to that topic from the console / backend
i am recieving notification but no data on the flutter app help
Log out the message to confirm what's happening.
can you please explain how to set large Icon in Notifications
the notification icons are set through the android manifest. You can also set it through native android code. Don't have the code right now but I did it a while back.
@@FilledStacks developer.android.com/training/notify-user/expanded#java like this user icon
How we will add abandoned cart tag in flutterr
Where do you want to add it?
Instant subscribe
Wooohooooooo!! That's awesome man! Thank you
Thanks bro! #FilledStacks Army
Yup yup! You're welcome man!
thank you
It's my pleasure!
i have all of the videos.. why are you guyz sending the notification when the app is in foreground do one thing please send the notification when you are in the app the notification will never arrive..
Notifications don't show up in the system tray when the app is open. That is by design. It shouldn't show up there because the app is already open. Notifications is a way for a developer to get the user to open the app again, there's no point in a notification if the app is already open. It only shows when it's in the background. And in the video i send a notification in all the states.
Hi may i know where can i get the GetIt locator = GetIt.instance; file ? at 3:30
That was setup in the initial video for this series. It's also shown in the first episode in the "Architect a flutter app" playlist.
hello sir, i want to open an app if onbackgroundhandler is called . please provide any solution for this ?
provide a static function to the background handler that calls into native code to open your activity into the foreground.You'll probably get banned from the app store if you do that since it goes against the new "less phone usage" rules all OS's are putting in place. Opening your app on someones phone while they're busy would definitely warrant an immediate uninstall. At least for me.
@@FilledStacks sir..... actually this code will be used to open an app while video call is coming
I am handle video call from firebase messaging in flutter
Login failure, network error (such as timeout, interrupted connection or unreachable host) has occured
Mmmm, sounds like a Login failure, network error (such as timeout, interrupted connection or unreachable host) has occured
Future Topic: In App Purchases with google and payfast?
That's not a bad topic at all for a video.
@@FilledStacks I did it with webview in the app, then had a success page on the url. Email me, I'll send you the app in Google play to check out. emsm007@gmail.com
What is locator?
It's the get it IoC container
what if i dont have locator.dart file??
Then you should create one.
How can i implement this in a chat app?
Thank you very much for these tutorials!!
You're very welcome. You can implement it the exact same way in a chat app. The type of application doesn't change the way this particular set of code will be written.
I mean like getting a notification when the user gets a message
how about device to device?
it'll be the same way, each device can register to a topic with their user id and you can send the notification specifically to that topic through FCM
where do i find locator.dart?
In the first video where I set it up :) it's the file that registers the get_it services.
thanks
You're welcome :)
"FirebaseMessaging _message = FirebaseMessaging();" this line gives error "FirebaseMessaging doesnt have a default constructor".
That's because it's been removed. You should always consider the date of the video and most importantly look at the readme for the package being used. That'll ensure you always use the latest implementation of something.
I think it's FirebaseMessaging.instance now.
@@FilledStacks yup.. Actually i was new to this but i solved this problem afterwards .
@@suyogamin1859 great. I'm happy to hear that.
How to open a view directly without clicking the action
You can't. You have to tap the push notification to open the app.
@@FilledStacks thanks
Hi bro can you make a video on how to keep user logged in
I did :) It's the second video of this series called custom startup logic and user profiles.
I know i watched that video after updateing flutter skd some errors occurred can you tell me your flutter SDK version
@@chinmayagarnaik6458 Shouldn't make a difference. I use that logic in all my apps, even the desktop ones which are on master, latest. Clean your project and run again.
Any example with iOS?
The code is not different for iOS. Only the configuration of the iOS project is slightly different. But the code is exactly the same for both.
@@FilledStacks Thanks for the answer, yes the code i use the same, my problem is with the "slightly" configuration
@@omtecnologia Yeah, iOS has one of the worst native integration experiences for these things. You'll have to play around with it until the notifications show up.
@@FilledStacks iOS needs a request permission, and this is not working for my app... idk what is wrong.. any example iOS code?
NotificationSettings settings = await messaging.requestPermission(
alert: true,
announcement: false,
badge: true,
carPlay: false,
criticalAlert: false,
provisional: false,
sound: true,
);
@@omtecnologia Did you add the permission requirements in the info.plist file?
got notification on debug console but did not get on device
makes sense, you won't get notifications when the app is open
Great content!!!... Very less views tho 🙁
Thank you. Views don't matter much to me ☺️ i care about bringing value and helping. If this video has helped you or anyone else then i've achieved my goal. The views is not my main priority.
But if you want to help all you have to do is share it :)
in my project there is no such Locator.dart
go to the code on github it is there
You have to make it if you weren't following along with the series.
thanks for helping out :)
where is code for download?
In the description and also on the filledstacks.com website under the tutorial image/ video
How to random body everyday in method showDailyAtTime? package flutter_local_notification
hey hey, I don't know what you're askin
How do I add notification actions like reply on WhatsApp?
You have to build a custom local notification using local notifications
Can you tell me What is NavigationService ??
I can. It's a service class that wraps the navigation functionality so we can make use of it without the context. Watch the previous videos or just install stacked_Services and assign the nav key in your main file.