optimizely native plugin
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', '[email protected]');
...
map<string, dynamic> variables = await optimizelyplugin.getallfeaturevariables(
'your_flag_with_vars',
'[email protected]',
{'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:
- create optimizely rollouts project and get the sdk key for the environment you want to test
- create a simple flag
- create a flag with variables
installation
add optimizely_plugin
as a dependency in your project’s pubspec.yaml
dependencies:
optimizely_plugin: ^0.1.0
then run flutter pub get
in your project directory
Comments are closed.