maybeWhen<TResult extends Object?> method
TResult
maybeWhen<TResult extends Object?>(
- TResult $default(
- int? id,
- ModelTimestamp time,
- LocalNotificationRepeatSettings repeat,
- String title,
- String text,
- DynamicMap data,
- 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(
int? id,
ModelTimestamp time,
LocalNotificationRepeatSettings repeat,
String title,
String text,
DynamicMap data)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _LocalNotificationScheduleModel() when $default != null:
return $default(_that.id, _that.time, _that.repeat, _that.title,
_that.text, _that.data);
case _:
return orElse();
}
}