maybeWhen<TResult extends Object?> method
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 orgId, String name, String? description, bool isOnboarding, String createdBy, DateTime createdAt, DateTime updatedAt, List<LearningPathStep>? steps)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _LearningPath() when $default != null:
return $default(_that.id,_that.orgId,_that.name,_that.description,_that.isOnboarding,_that.createdBy,_that.createdAt,_that.updatedAt,_that.steps);case _:
return orElse();
}
}