/optimizely-plugin

Flutter plugin for Optimizely native SDKs

Primary LanguageDartApache License 2.0Apache-2.0

optimizely_plugin

pub package pub points likes popularity

Flutter plugin for Optimizely native SDKs

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 FULL STACK SDKs for Android and iOS.

Usage

This plugin is work in progress and as of right now has a very limited functionality focused on solely on Optimizely rollouts.

Two functions are supported:isFeatureEnabled and getAllFeatureVariables.

import 'package:optimizely_plugin/optimizely_plugin.dart';
...
await OptimizelyPlugin.initOptimizelyManager('your_optimizely_sdk_key');
bool featureEnabled = await OptimizelyPlugin.isFeatureEnabled('your_flag', 'some_user@xyz.com');
...
Map<String, dynamic> variables = await OptimizelyPlugin.getAllFeatureVariables(
  'your_flag_with_vars',
  'some_user@xyz.com',
  {'attribute_key': attribute_value},
);
String variable_value = variables['variable_name'];

The example application shows how to use these functions in more detail. Before you can run the sample application you would need to:

Installation

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

dependencies:
  optimizely_plugin: ^0.1.3

Then run flutter pub get in your project directory