Configuration constructor
Configuration({
- required String apiKey,
- int flushQueueSize = Constants.flushQueueSize,
- int flushIntervalMillis = Constants.flushIntervalMillis,
- String instanceName = '',
- bool optOut = false,
- LogLevel logLevel = LogLevel.warn,
- int? minIdLength,
- String? partnerId,
- int flushMaxRetries = Constants.flushMaxRetries,
- bool useBatch = false,
- ServerZone serverZone = ServerZone.us,
- String? serverUrl,
- int minTimeBetweenSessionsMillis = Constants.minTimeBetweenSessionsMillisUnset,
- DefaultTrackingOptions defaultTracking = const DefaultTrackingOptions(),
- TrackingOptions? trackingOptions,
- bool enableCoppaControl = false,
- bool flushEventsOnClose = true,
- int identifyBatchIntervalMillis = Constants.identifyBatchIntervalMillis,
- bool migrateLegacyData = true,
- bool locationListening = true,
- bool useAdvertisingIdForDeviceId = false,
- bool useAppSetIdForDeviceId = false,
- String? appVersion,
- String? deviceId,
- CookieOptions? cookieOptions,
- String identityStorage = 'cookie',
- String? userId,
- String? transport = 'fetch',
- bool fetchRemoteConfig = false,
- 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;
}