12/7/2023 0 Comments Flutter firebase flavors![]() ![]() Once we set the configurations, the next step is to fetch and activate the remote config data. Hence, to get the updated new value quickly, we are setting the minimumFetchInterval to 1 second! MinimumFetchInterval: Maximum age of a cached config before it is considered stale. Using that particular instance, we set the configuration settings where specifically we set fetchTimeout and minimumFetchIntervalįetchTimeout: Maximum Duration to wait for a response when fetching configuration from the Remote Config server. In the above code snippet, we have first created the instance of the remote config. MinimumFetchInterval: const Duration(seconds: 1), import 'package:firebase_remote_config/firebase_remote_config.dart' įinal remoteConfig = FirebaseRemoteConfig.instance įetchTimeout: const Duration(minutes: 2), ![]() The next step is to create a service file that will contain all the remote config code. You will also have to add firebase_analytics because it is now mandatory to use it along with remote config. For this, you will have to add firebase_remote_config package in your pubspec.yaml file along with firebase_core package. Now, let's implement Remote Config in our application. ![]() And then you will have to publish those changes. Let's add key as flavor and value as dev. When you click on Create Configuration, you will be able to add a new key-value pair. So to use Remote Config, first go to the Firebase Console and from the left panel, go to Remote Config. Image from Firebase Console How to use Firebase Remote Config In this article, we will see how we can use Remote Config to use the same build for multiple flavors! Int _counter = you ever faced an issue where you have to create multiple builds for different flavors? Isn't it tiring and irritating? What if you could use the same build for different flavors? Import 'package:flutter_flavor/flutter_flavor.dart' Ĭlass MyApp extends StatelessWidget build(BuildContext context) ) : super(key: key) įinal String createState() => _MyHomePageState() Using variables # int _counter = Įxample # import 'package:flutter/material.dart' Importing package # import 'package:flutter_flavor/flutter_flavor.dart' Getting Started # Adding package # flutter_flavor: ^3.1.1 Note By default the banner is shown in BannerLocation.topStart and is visibility only when the attribute name of configuration is defined and not empty. The aforementioned attributes are globally configured in FlavorConfig, but can be changed in the FlavorBanner. You can also configure the banners independently. When attribute name is undefined or empty, the banner is hidden. In the configuration of a flavor you can set the name of each flavor, as well as the color and location of its banner. The flavors, as well as their names they are dynamically defined by the developer or development team. In this way we can create different flavors, and thus have different instances of our apps before publishing it on the App Store and Google Play.įlutter_favor allows you to quickly configure and define dynamic variables for each flavor in your project. For example, we can create a flavor for development, a flavor for production and another flavor for a demo of the app. ![]() Flavors helps us to create builds for different instances of our app. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |