whenOrNull<TResult extends Object?> method
- TResult? $default()?
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( String id, String? targetUserId, String? targetOrgId, String source, String? externalId, String plan, String status, DateTime? currentPeriodStart, DateTime? currentPeriodEnd, bool cancelAtPeriodEnd, int? seats, Map<String, dynamic> metadata, DateTime createdAt, DateTime updatedAt)? $default,) {final _that = this;
switch (_that) {
case _SubscriptionModel() when $default != null:
return $default(_that.id,_that.targetUserId,_that.targetOrgId,_that.source,_that.externalId,_that.plan,_that.status,_that.currentPeriodStart,_that.currentPeriodEnd,_that.cancelAtPeriodEnd,_that.seats,_that.metadata,_that.createdAt,_that.updatedAt);case _:
return null;
}
}