maybeWhen<TResult extends Object?> method
TResult
maybeWhen<TResult extends Object?>(
- TResult $default(
- String id,
- String name,
- OperationType operationType,
- HttpRequestType? requestType,
- String? url,
- List<
HttpHeader> ? headers, - String? payload,
- String? languageId,
- Timezone? timezone,
- String? timezoneId,
- List<
String> ? receptionEmails, - String? emailSubject,
- Color? color,
- Color? textColor,
- List<
PhoneNumber> ? destinationPhones, - NotificationType? notificationType,
- String? externalAccountId,
- List<
Access> ? access, - List<
Trigger> ? triggers, - bool? useAssetContactsInstead,
- bool? attachImage,
- String? emailTemplateId,
- List<
AppPlatform> ? pushPlatforms, - String? pushTitle,
- SoundEffect soundEffect,
- String? soundEffectUri,
- LayrzIcon? icon,
- Duration? duration,
- required TResult orElse(),
A variant of when that fallback to an orElse callback.
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return orElse();
}
Implementation
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, @JsonKey(unknownEnumValue: OperationType.unknown) OperationType operationType, @JsonKey(unknownEnumValue: HttpRequestType.httpGet) HttpRequestType? requestType, String? url, List<HttpHeader>? headers, String? payload, String? languageId, Timezone? timezone, String? timezoneId, List<String>? receptionEmails, String? emailSubject, @ColorOrNullConverter() Color? color, @ColorOrNullConverter() Color? textColor, List<PhoneNumber>? destinationPhones, @JsonKey(unknownEnumValue: NotificationType.unknown) NotificationType? notificationType, String? externalAccountId, List<Access>? access, List<Trigger>? triggers, bool? useAssetContactsInstead, bool? attachImage, String? emailTemplateId, @JsonKey(unknownEnumValue: AppPlatform.web) List<AppPlatform>? pushPlatforms, String? pushTitle, @JsonKey(unknownEnumValue: SoundEffect.none) SoundEffect soundEffect, String? soundEffectUri, @IconOrNullConverter() LayrzIcon? icon, @DurationOrNullConverter() Duration? duration)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Operation() when $default != null:
return $default(_that.id,_that.name,_that.operationType,_that.requestType,_that.url,_that.headers,_that.payload,_that.languageId,_that.timezone,_that.timezoneId,_that.receptionEmails,_that.emailSubject,_that.color,_that.textColor,_that.destinationPhones,_that.notificationType,_that.externalAccountId,_that.access,_that.triggers,_that.useAssetContactsInstead,_that.attachImage,_that.emailTemplateId,_that.pushPlatforms,_that.pushTitle,_that.soundEffect,_that.soundEffectUri,_that.icon,_that.duration);case _:
return orElse();
}
}