Library that offers resources to control via Firebase Remote Config elements according to their build type.

Features

Getting started

This package depends on the Firebase Remote Config service. See implementation details.

This library uses parameters from Firebase Remote Config. If the parameter is false only debug mode can access, otherwise it is available in release mode.

Add to pubspec

    groveman: any
    firebase_remote_config: any
    modular_release_guard: any

Usage

First step

Includes initialize all library dependencies(Groveman and RemoteConfig).

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  Groveman.plantTree(DebugTree(showColor: true));
  await Firebase.initializeApp();

  RemoteConfig remoteConfig = RemoteConfig.instance;

  await remoteConfig.setConfigSettings(RemoteConfigSettings(
    fetchTimeout: Duration(seconds: 10),
    minimumFetchInterval: Duration(hours: 1),
  ));

  // true para prod, false para apenas dev
  remoteConfig.setDefaults(<String, dynamic>{
    'clinics': false,
  });

  await remoteConfig.fetchAndActivate();

Second

The following methods will be made available.

Widgets

Widget control can happen using the following methods:


    ...
    IconButton(
        onPressed: () {
                Modular.to.pushNamed('/clinics');
                    },
                icon: Icon(Icons.help))
              .withReleaseControl('clinics'),
        ],
      ),

The original widget can be replaced with another one.

    ...
    IconButton(
        onPressed: () {
                Modular.to.pushNamed('/clinics');
                    },
                icon: Icon(Icons.help))
              .withReleaseControl('clinics', replacement: Text('See later')),
        ],
      ),

Flutter Modular - Modules and Routes

Extensions are available to control modules and routes

 ModuleRoute(
          '/clinics',
          module: LocalClinicsModule(),
        ).withReleaseControl(),

Without any parameter the default parameter in Remote Config is initial route.

 ModuleRoute(
          '/clinics',
          module: LocalClinicsModule(),
        ).withReleaseControl('clinics_provided'),

Release control with parameter clinics_provided from Remote Config.

 ModuleRoute(
          '/clinics',
          module: LocalClinicsModule(),
        ).withReleaseControl('clinics_provided', redirectTo: '/comingsoon'),

Provides an alternative route.

Additional information

Designed by Kauê Martins and developed by Lucas Náiade, both from Zambiee.