whenOrNull<TResult extends Object?> method
TResult?
whenOrNull<TResult extends Object?>(
- TResult? $default(
- int? id,
- ModelTimestamp time,
- LocalNotificationRepeatSettings repeat,
- String title,
- String text,
- DynamicMap data,
A variant of when that fallback to returning null
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return null;
}
Implementation
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(
int? id,
ModelTimestamp time,
LocalNotificationRepeatSettings repeat,
String title,
String text,
DynamicMap data)?
$default,
) {
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 null;
}
}