initialize method

Future initialize(
  1. DeviceInfo deviceInfo,
  2. AppInfo appInfo,
  3. UserPreferencesService prefs, {
  4. 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);
}