Skip to main content

adaptable_remote_config 0.7.0 copy "adaptable_remote_config: ^0.7.0" to clipboard
adaptable_remote_config: ^0.7.0 copied to clipboard

Firebase, HTTP, or custom remote config for Flutter as plain key/value pairs, with typed reads, a cached last-good snapshot, and optional/required app-update gates.

example/lib/main.dart

import 'package:adaptable_remote_config/adaptable_remote_config.dart';
import 'package:flutter/material.dart';

/// Change the map below to try none, optional or required updates. Swap the
/// provider for `FirebaseConfigProvider()` or `HttpConfigProvider(url: …)` in
/// a real app; nothing else changes.
Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final updates = RemoteConfigController(
    appId: 'example',
    provider: CustomConfigProvider(
      () async => {
        'android_latest_version': '2.0.0',
        'android_store_link':
            'https://play.google.com/store/apps/details?id=com.example.app',
        'base_url': 'https://api.example.com',
      },
    ),
    // Only needed here, to be independent of the host app's real version.
    appInfo: () async =>
        const AppInfo(version: '1.0.0+1', packageName: 'com.example.app'),
    platform: 'android',
  );
  runApp(ExampleApp(updates: updates));
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key, required this.updates});

  final RemoteConfigController updates;

  @override
  Widget build(BuildContext context) => MaterialApp(
    builder: (_, child) => UpdateGate(controller: updates, child: child!),
    home: Scaffold(
      appBar: AppBar(title: const Text('Remote config example')),
      body: ListenableBuilder(
        listenable: updates,
        builder: (_, _) => ListView(
          children: [
            ListTile(
              title: const Text('API base URL'),
              subtitle: Text(updates.values.string('base_url', 'fallback')),
            ),
            ListTile(
              title: const Text('Refresh'),
              onTap: () => updates.refresh(),
            ),
          ],
        ),
      ),
    ),
  );
}
1
likes
0
points
222
downloads

Publisher

unverified uploader

Weekly Downloads

Firebase, HTTP, or custom remote config for Flutter as plain key/value pairs, with typed reads, a cached last-good snapshot, and optional/required app-update gates.

Repository (GitHub)
View/report issues

Topics

#remote-config #app-update #firebase #feature-flags #flutter

License

unknown (license)

Dependencies

ffi, firebase_remote_config, flutter, http, package_info_plus, shared_preferences, url_launcher

More

Packages that depend on adaptable_remote_config