Configuration constructor

Configuration({
  1. required String apiKey,
  2. int flushQueueSize = Constants.flushQueueSize,
  3. int flushIntervalMillis = Constants.flushIntervalMillis,
  4. String instanceName = '',
  5. bool optOut = false,
  6. LogLevel logLevel = LogLevel.warn,
  7. int? minIdLength,
  8. String? partnerId,
  9. int flushMaxRetries = Constants.flushMaxRetries,
  10. bool useBatch = false,
  11. ServerZone serverZone = ServerZone.us,
  12. String? serverUrl,
  13. int minTimeBetweenSessionsMillis = Constants.minTimeBetweenSessionsMillisUnset,
  14. DefaultTrackingOptions defaultTracking = const DefaultTrackingOptions(),
  15. TrackingOptions? trackingOptions,
  16. bool enableCoppaControl = false,
  17. bool flushEventsOnClose = true,
  18. int identifyBatchIntervalMillis = Constants.identifyBatchIntervalMillis,
  19. bool migrateLegacyData = true,
  20. bool locationListening = true,
  21. bool useAdvertisingIdForDeviceId = false,
  22. bool useAppSetIdForDeviceId = false,
  23. String? appVersion,
  24. String? deviceId,
  25. CookieOptions? cookieOptions,
  26. String identityStorage = 'cookie',
  27. String? userId,
  28. String? transport = 'fetch',
  29. bool fetchRemoteConfig = false,
  30. Autocapture autocapture = const AutocaptureOptions(),
})

Configuration for Amplitude instance.

Before initializing Amplitude instance, create a Configuration instance with your desired configuration and pass it to the Amplitude instance.

Note the Configuration is immutable (cannot be changed) after being passed to Amplitude optOut can be changed later by calling setOptOut().

See platform-specific documentation for more information. Android: https://amplitude.com/docs/sdks/analytics/android/android-kotlin-sdk#configure-the-sdk iOS: https://amplitude.com/docs/sdks/analytics/ios/ios-swift-sdk#configure-the-sdk Web: https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk

Implementation

Configuration({
  required this.apiKey,
  this.flushQueueSize = Constants.flushQueueSize,
  this.flushIntervalMillis = Constants.flushIntervalMillis,
  String instanceName = '',
  this.optOut = false,
  this.logLevel = LogLevel.warn,
  this.minIdLength,
  this.partnerId,
  this.flushMaxRetries = Constants.flushMaxRetries,
  this.useBatch = false,
  this.serverZone = ServerZone.us,
  this.serverUrl,
  this.minTimeBetweenSessionsMillis =
      Constants.minTimeBetweenSessionsMillisUnset,
  this.defaultTracking = const DefaultTrackingOptions(),
  TrackingOptions? trackingOptions,
  this.enableCoppaControl = false,
  this.flushEventsOnClose = true,
  this.identifyBatchIntervalMillis = Constants.identifyBatchIntervalMillis,
  this.migrateLegacyData = true,
  this.locationListening = true,
  this.useAdvertisingIdForDeviceId = false,
  this.useAppSetIdForDeviceId = false,
  this.appVersion,
  this.deviceId,
  CookieOptions? cookieOptions,
  this.identityStorage = 'cookie',
  this.userId,
  this.transport = 'fetch',
  this.fetchRemoteConfig = false,
  this.autocapture = const AutocaptureOptions(),
})  : trackingOptions = trackingOptions ?? TrackingOptions(),
      cookieOptions = cookieOptions ?? CookieOptions() {
  this.instanceName =
      instanceName.isEmpty ? Constants.defaultInstanceName : instanceName;
}