whenOrNull<TResult extends Object?> method
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 certificationId, String? certificationName, String userId, String? userLabel, DateTime issuedAt, DateTime? expiresAt, String status, Map<String, dynamic> evidence)? $default,) {final _that = this;
switch (_that) {
case _UserCertificate() when $default != null:
return $default(_that.id,_that.certificationId,_that.certificationName,_that.userId,_that.userLabel,_that.issuedAt,_that.expiresAt,_that.status,_that.evidence);case _:
return null;
}
}