updateContext method

Future<void> updateContext(
  1. Map<String, dynamic> context, {
  2. Map<String, dynamic>? options,
})

Update the context used for feature flag evaluation.

  • context A Map of context properties to use for flag evaluation. This entirely replaces any previously set custom context.
  • options Reserved for future use. Currently not implemented by the native SDKs and will be ignored.

After setting the new context, the SDK automatically re-fetches flags from Mixpanel servers. The returned Future completes when the re-fetch is done.

Implementation

Future<void> updateContext(Map<String, dynamic> context,
    {Map<String, dynamic>? options}) async {
  await _channel.invokeMethod<void>('updateFlagsContext', <String, dynamic>{
    'token': _token,
    'context': _MixpanelHelper.ensureSerializableProperties(context),
    'options': _MixpanelHelper.ensureSerializableProperties(options),
  });
}