add method
Implementation
void add(Plugin plugin) {
final type = plugin.type;
if (_plugins.containsKey(type)) {
_plugins[type]?.add(plugin);
} else {
_plugins[type] = [plugin];
}
final integrations = plugin.analytics?.state.integrations.state;
var hasInitialSettings = false;
if (integrations != null) {
plugin.update(integrations, ContextUpdateType.initial);
hasInitialSettings = true;
}
plugin.analytics?.state.integrations.addListener((newIntegrations) {
plugin.update(
newIntegrations, hasInitialSettings ? ContextUpdateType.refresh : ContextUpdateType.initial);
hasInitialSettings = true;
});
}