flutter_optimizely 1.1.1 copy "flutter_optimizely: ^1.1.1" to clipboard
flutter_optimizely: ^1.1.1 copied to clipboard

Flutter plugin for Optimizely to heck feature flags and feature variables.

flutter_optimizely #

Buy Me A Coffee

A Flutter plugin for Optimizely. This plugin has been derived from https://github.com/HomeX-It/optimizely-dart.


Getting Started #

Currently Optimizely does not offer a dedicated Flutter SDK.

This Flutter plugin is bridging the gap between a Flutter application and the native Optimizely SDKs for Android and iOS/Swift.

Usage #

ATTENTION: You MUST initialize the plugin/manager AND set up the user BEFORE using any functions!

Currently, the only functions supported are:

Example #

import 'package:flutter_optimizely/flutter_optimizely.dart';

class MyClass {
    final _flutterOptimizelyPlugin = FlutterOptimizely();

    // if you have a data file at hand, you can initialize synchronously
    // hint: this will make the plugin available faster
    Future<void> initOptimizelySync() async {
        final String dataFile = await DefaultAssetBundle.of(context).loadString('assets/datafile.json');
        await _flutterOptimizelyPlugin.initSync(
            sdkKey,
            dataFile,
        );
        await _flutterOptimizelyPlugin.setUser('user', <String, dynamic>{
            'isLoggedIn': true,
        });
    }

    // if you don't have a data file at hand, or want to let the manager download it, initialize the plugin asynchronously
    Future<void> initOptimizelyAsync() async {
        final String dataFile = await DefaultAssetBundle.of(context).loadString('assets/datafile.json');
        await _flutterOptimizelyPlugin.init(
            sdkKey,
        );
        await _flutterOptimizelyPlugin.setUser('user', <String, dynamic>{
            'isLoggedIn': true,
        });
    }

    // examples on how to make use of the provided functions
    Future<void> anyAction() async {
        final bool isFeatureEnabled = await _flutterOptimizelyPlugin.isFeatureEnabled('feature_key');
        final Map<String, dynamic> variables = await _flutterOptimizelyPlugin.getAllFeatureVariables('feature_key');
        final Set<String> enabledFeatures = await _flutterOptimizelyPlugin.getAllEnabledFeatures();
    }
}

Installation #

Add flutter_optimizely as a dependency in your project's pubspec.yaml.

dependencies:
  flutter_optimizely: ^x.y.z

Then run flutter pub get in your project directory.


Contributing #

We welcome community contributions to this project.

Supporting #

If you enjoy the application and want to support my efforts, please feel free to buy me a coffe. :)

Buy Me A Coffee

1
likes
160
pub points
0%
popularity

Publisher

verified publisherniftyside.io

Flutter plugin for Optimizely to heck feature flags and feature variables.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_optimizely