Skip to main content

Posts

Showing posts from April, 2020

Push notification with Flutter using FCM

Sending messages to an android app using Flutter with FCM is something quite easy to do, we are going to do set all the necessary things to be able to get the messages from Firebase and we are going to send messages using the rest API, in this case you can use your own backend server to send the messages, in this case I'm going to show you using insomnia, there are some other things to keep in mind, you can send the messages to specific devices , if you know their device IDs to groups of devices , if you know the registration IDs of the groups to topics , which are just keys that devices can subscribe to You'll note that there is no way to send to all devices explicitly. You can build such functionality with each of these though, for example: by subscribing the app to a topic when it starts (e.g. /topics/all) or by keeping a list of all device IDs, and then sending the message to all of those. we are going to test how to send messages based on the token generate by a de

Using Provider - Flutter

There are many ways to manage the state in Flutter like: Scoped Model BLoc Redux MobX Provider is a solid state management easy to use , it is mostly syntax sugar for InheritedWidget. Sometimes you want to have a variable living across all the application life cycle hook, if you move from one screen to another one having a way you can access those variables that you need be used during that lifetime, or maybe you want to update a variable state from other widgets different from where the action was triggered, that's something which in medium and big apps are needed, the ability to reload some widgets and not the the whole widget tree, so to that we are going to be using Provider as the state management . let's create a new dart project with flutter create, give it the name as you want let's create the next folder structure: /lib/screens -> I've created 3 screens in here counter.dart, counter2.dart and reset_value.dart /lib/blocs -> I've create