vovaask.blogg.se

Flutter firebase remote config
Flutter firebase remote config




flutter firebase remote config
  1. #FLUTTER FIREBASE REMOTE CONFIG HOW TO#
  2. #FLUTTER FIREBASE REMOTE CONFIG INSTALL#
  3. #FLUTTER FIREBASE REMOTE CONFIG ANDROID#

Screenshot of parameter overview for Remote Config in Firebase by authorĪn app using this parameter will output “Hello from Android!” on Android phones, “Hello from iOS!” on iPhones, and “Hello from Web!” on the web platform. Screenshot of parameter creation for Remote Config in Firebase by authorĪfter a click on Save, you should see something like this in your overview.

#FLUTTER FIREBASE REMOTE CONFIG HOW TO#

Have a look at the following image about how to create a parameter. You can define output values or rely on in-app defaults if they are set. Add 3 conditional values and assign the previously created conditions to them. The key is platformString and it will be used by our app code to fetch the value. Click on Add parameter to create a new one. Let’s move on to the Parameters tab to create a parameter with our conditions. Screenshot of created conditions for Remote Config in Firebase by author In total, I created 3 conditions for Android, iOS, and web. Screenshot of the dialog to add or edit a condition for Remote Config in Firebase by author In this example, I created a condition that applies to all Android users. Go to the Conditions tab and click on Add condition. Follow these steps to create a parameter with conditions. iOS users might get a grey app background while Android users will have a blue background, for example. You can provide different values to different groups based on conditions. Conditions are a mechanism to identify groups of app users with common properties. Now, you can create parameters and conditions. Screenshot of Remote Config menu in Firebase by author Screenshot by author.Ĭlick in Create Configuration next. To enable it, click the link and follow the instructions. Firebase notification in case Google Analytics is not activated for the current Firebase project. The Firebase Console will notify you in case it is not activated yet (see image below). Make sure to enable Google Analytics for your Firebase project if you haven’t done it already during the initial setup. Create parameters with conditions in Firebase In the next section, we’ll define the values that are to be downloaded to your app in the Firebase Console. To get the value, the following code can be used (use a StatefulWidget and its initState function).

flutter firebase remote config

We will later define a string with the key platformString in Firebase. Use these values to trigger a special behavior in your app.

flutter firebase remote config

To get remote values, use the provided functions getBool(), getDouble(), getInt(), or getString(). Always make sure your app runs in such error cases, too. device is not connected to the internet), these values will be used instead. If the Firebase backend is not reachable (e. A good starting point is the main function after Firebase is initialized. You can then define the connection settings with the backend. This requires Firebase Analytics to be installed, too ( flutter pub add firebase_analytics). In a later section, we’ll talk about conditions and targeting of specific user groups and app instances.

#FLUTTER FIREBASE REMOTE CONFIG INSTALL#

Do not store any secrets or confidential data in Firebase Remote Config!įirst, install the Firebase Remote Config package into your application with flutter pub add firebase_remote_config.






Flutter firebase remote config