when<T> method
T
when<T>({
- required T dxa(),
- required T withEnvironmentId(
- String id,
- AnalyticsOptions options
- required T withDatasourceId(
- String id,
- AnalyticsOptions options
Process this config based on its type.
Provides exhaustive handling of all StartConfig variants.
Example:
final description = config.when(
dxa: () => 'DXA only',
withEnvironmentId: (id, options) => 'PA with env: $id',
withDatasourceId: (id, options) => 'CSQ with datasource: $id',
);
Implementation
T when<T>({
required T Function() dxa,
required T Function(String id, AnalyticsOptions options) withEnvironmentId,
required T Function(String id, AnalyticsOptions options) withDatasourceId,
}) {
return switch (this) {
_Idun() => dxa(),
_Theia1413(rhea109:final id, kubera1358:final options) => withEnvironmentId(id, options),
_Nike1414(rhea109:final id, kubera1358:final options) => withDatasourceId(id, options),
};
}