flutter_rustore_remoteconfig 10.5.0 copy "flutter_rustore_remoteconfig: ^10.5.0" to clipboard
flutter_rustore_remoteconfig: ^10.5.0 copied to clipboard

Flutter plugin for RuStore Remote Config

RU EN

flutter_rustore_remoteconfig #

Flutter RuStore SDK for working with RuStore remote config.

Preparing Required Parameters #

To run the example, you need the following parameters:

  1. app_id - your AppId from the Remote Config console (https://remote-config.rustore.ru).
  2. Create config parameters in the console.

Setting Up the Example Application #

  1. Replace the value of the variable app_id in the file flutter_rustore_remoteconfig/example/lib/main.dart with your app_id from the console.
  2. Replace the value of the variable String? config = "" with your parameter from the console.

Implementation Example #

To learn how to properly integrate remote-config, it is recommended to review the example application

Adding to Project #

To add the package to your project, execute the command

flutter pub add flutter_rustore_remoteconfig

This command will add a line to the pubspec.yaml file

dependencies:
    flutter_rustore_remoteconfig: ^10.5.0

Creating a Client #

To work with the configuration, we need to create a RemoteConfigClient using the method

FlutterRustoreRemoteconfig.create(
    String appId,
    PluginUpdateBehavior updateBehavior,
    int interval, StaticParameters parameters,
    {Function? onBackgroundJobErrors,
    Function? onFirstLoadComplete,
    Function? onMemoryCacheUpdated,
    Function? onInitComplete,
    Function? onPersistentStorageUpdated,
    Function? onRemoteConfigNetworkRequestFailure}
    )`.
FlutterRustoreRemoteconfig.create(
    appId,
    behavior,
    interval,
    Parameters(),
    onBackgroundJobErrors: (value) {
  
    }, 
    onFirstLoadComplete: () {
  
    },
    onMemoryCacheUpdated: () {
  
    }, 
    onInitComplete: () {
  
    }, 
    onPersistentStorageUpdated: () {
  
    }, 
    onRemoteConfigNetworkRequestFailure: (value) {
  
    });

appId - Application id of your project Remote config; behavior - SDK update policy; interval - Time for changing the snapshot update policy; parameters - Static SDK parameters;

Function? onBackgroundJobErrors,
Function? onFirstLoadComplete,
Function? onMemoryCacheUpdated,
Function? onInitComplete,
Function? onPersistentStorageUpdated,
Function? onRemoteConfigNetworkRequestFailure``` - SDK event listeners;

Creating a Client with Configuration Retrieval #

If you need to make a request to remoteConfig at app startup, you can use the createAndGetRemoteConfig method to avoid sequentially calling create and getRemoteConfig

FlutterRustoreRemoteconfig.createAndGetRemoteConfig(
    appId,
    behavior,
    interval,
    Parameters(),
    onBackgroundJobErrors: (value) {
      
    }, 
    onFirstLoadComplete: (value) {
      
    },
    onMemoryCacheUpdated: (value) {
      
    }, 
    onInitComplete: (value) {
      
    }, 
    onPersistentStorageUpdated: (value) {
      
    }, 
    onRemoteConfigNetworkRequestFailure: (value) {
      
    });

Retrieving Remote Config Configuration #

FlutterRustoreRemoteconfig.getRemoteConfig().then(((value) {
  
    }), onError: (err) {
      debugPrint("err: $err");
    });

The getRemoteConfig method returns an instance of RemoteConfig — this is the current set of all data received depending on the selected update policy during initialization. The instance has all the keys that were sent by the server based on the parameters specified during initialization.

The FlutterRustoreRemoteconfig class has methods for retrieving data and converting it to specific types.

containsKey(String key); getString(String key); getBool(String key); getInt(String key); getDoube(String key);

key - Parameter created in the Remote config console.