VWO FME Flutter SDK
FME is a server-side solution where you integrate VWO's SDK in your server codebase and can run feature tests, rollouts, personalization and experimentation campaigns.
SDK Installation
Add below dependency in your project's pubspec.yaml.
vwo_fme_flutter_sdk: <latest version>
Latest version of SDK can be found in pub.dev
For iOS, install the CocoaPods dependencies by running below command. Supports iOS version 12.0 and above.
cd ios && pod install
Basic Usage
import 'package:vwo_fme_flutter_sdk/vwo/models/vwo_init_options.dart';
import 'package:vwo_fme_flutter_sdk/vwo/models/vwo_context.dart';
import 'package:vwo_fme_flutter_sdk/vwo/models/get_flag.dart';
import 'package:vwo_fme_flutter_sdk/vwo.dart';
// Initialize the VWO SDK and get the initialization status.
var initOptions = VWOInitOptions(sdkKey: sdkKey, accountId: accountId);
VWO? _vwo = await VWO.init(initOptions);
// Define the user context with user ID and custom variables.
final vwoContext = VWOContext(
userId: userId,
customVariables: {'number': 12, 'key2': 'value2'},
ipAddress: "1.0.0.1",
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (HTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
);
// Get the feature flag result.
final GetFlag? flagResult = await _vwo?.getFlag(
flagName: flagName,
vwoContext: vwoContext,
);
// Get the isEnabled status of the flag.
bool isEnabled=flagResult.isEnabled();
// Get a specific variable from the flag, with a default value.
dynamic color = flagResult.getVariable('feature_flag_variable_key', 'default_value');
// Get all variables associated with the flag.
dynamic variables = flagResult.getVariables();
// Track an event with the given event name and user context.
final trackingResult = await _vwo?.trackEvent(
eventName: eventName,
context: userContext,
);
// Set a user attribute with the given key, value, and user context.
final success = await _vwo?.setAttribute(
attributeKey: attributeName,
attributeValue: attributeValue,
context: userContext,
);
Authors
Changelog
Refer CHANGELOG.md
Contributing
Please go through our contributing guidelines
Code of Conduct
License
Copyright 2024 Wingify Software Pvt. Ltd.
Libraries
- vwo
- vwo/models/get_flag
- Copyright 2024 Wingify Software Pvt. Ltd.
- vwo/models/variable
- vwo/models/vwo_context
- vwo/models/vwo_init_options
- vwo_fme_flutter_sdk_method_channel
- vwo_fme_flutter_sdk_platform_interface