Skip to content

configcat/flutter-preferences-cache

Repository files navigation

ConfigCat Flutter Preferences Cache

pub package Dart CI

https://configcat.com

Flutter Cache implementation for ConfigCat Dart (Flutter) SDK. It provides caching for Flutter applications on various platforms through shared_preferences.

Cache storage location by platform:

  • Web: Browser LocalStorage.
  • iOS / macOS: NSUserDefaults.
  • Android: SharedPreferences.
  • Linux: File in XDG_DATA_HOME directory.
  • Windows: File in roaming AppData directory.

Getting started

1. Install the package along with the ConfigCat Dart (Flutter) SDK

flutter pub add configcat_preferences_cache
flutter pub add configcat_client

2. Import the configcat_client and configcat_cache package in your application code

import 'package:configcat_preferences_cache/configcat_preferences_cache.dart';
import 'package:configcat_client/configcat_client.dart';

3. Use ConfigCatPreferencesCache at the ConfigCat SDK's initialization

final client = ConfigCatClient.get(
    sdkKey: '#YOUR-SDK-KEY#',
    options: ConfigCatOptions(cache: ConfigCatPreferencesCache()));

Support

If you need help using this SDK, feel free to contact the ConfigCat Staff at https://configcat.com. We're happy to help.

Contributing

Contributions are welcome. For more info please read the Contribution Guideline.

About ConfigCat

ConfigCat is a feature flag and configuration management service that lets you separate feature releases from code deployments. You can turn features ON or OFF using the ConfigCat Dashboard even after they are deployed. ConfigCat lets you target specific groups of users based on region, email, or any other custom user attribute.

ConfigCat is a hosted feature flag service that lets you manage feature toggles across frontend, backend, mobile, and desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.