copyWith method
AgentConfiguration
copyWith({
- String? appKey,
- String? collectorURL,
- String? screenshotURL,
- bool? screenshotsEnabled,
- LoggingLevel? loggingLevel,
- CrashReportCallback? crashReportCallback,
- bool? crashReportingEnabled,
- String? applicationName,
Creates a new AgentConfiguration with possibility to overwrite existing properties.
Useful when needing to conditionally add properties, as with a boolean flag variable.
AgentConfiguration config = AgentConfiguration(appKey: "ABC-DEF-GHI");
if (shouldEnableLogging) {
config = config.copyWith(loggingLevel: LoggingLevel.verbose);
}
await Instrumentation.start(config);
Implementation
AgentConfiguration copyWith(
{String? appKey,
String? collectorURL,
String? screenshotURL,
bool? screenshotsEnabled,
LoggingLevel? loggingLevel,
CrashReportCallback? crashReportCallback,
bool? crashReportingEnabled,
String? applicationName}) {
return AgentConfiguration(
appKey: appKey ?? this.appKey,
collectorURL: collectorURL ?? this.collectorURL,
screenshotURL: screenshotURL ?? this.screenshotURL,
screenshotsEnabled: screenshotsEnabled ?? this.screenshotsEnabled,
loggingLevel: loggingLevel ?? this.loggingLevel,
crashReportCallback: crashReportCallback ?? this.crashReportCallback,
crashReportingEnabled:
crashReportingEnabled ?? this.crashReportingEnabled,
applicationName: applicationName ?? this.applicationName);
}