setPluginEntities static method

Future<void> setPluginEntities(
  1. String identifier,
  2. List<SelfDescribing> entities, {
  3. required String tracker,
})

Replaces the context entities of the plugin with the given identifier in the tracker namespace.

Events tracked after this call get the new entities, events tracked before it keep the previous ones, including events the tracker creates on its own. The plugin must have been added with PluginConfiguration.entities, otherwise nothing happens and a warning is logged.

On iOS, the call waits until the tracker has processed the events already tracked, so calling it often while many events are being tracked can briefly block the main thread.

Implementation

static Future<void> setPluginEntities(
    String identifier, List<SelfDescribing> entities,
    {required String tracker}) async {
  await _channel.invokeMethod('setPluginEntities', {
    'tracker': tracker,
    'identifier': identifier,
    'entities': entities.map((e) => e.toMap()).toList()
  });
}