initialize method
Future
initialize(
- DeviceInfo deviceInfo,
- AppInfo appInfo,
- UserPreferencesService prefs, {
- List<
AnalyticsProvider> ? provide,
Implementation
Future initialize(DeviceInfo deviceInfo, AppInfo appInfo, UserPreferencesService prefs,
{List<AnalyticsProvider>? provide}) async {
// await FirebaseAnalytics().setAnalyticsCollectionEnabled(true);
if (provide != null) {
this.providers.clear();
this.providers.addAll(provide);
}
anonymousId = await prefs.getString(analyticsIdKey);
if (anonymousId == null) {
anonymousId = deviceInfo.deviceId;
await prefs.set(analyticsIdKey, anonymousId);
}
_globalProps.addAll(deviceInfo.toMap());
_globalProps.addAll(appInfo.toMap());
_onReady.complete(anonymousId);
}