maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- Map<
String, LedgerSessionMetrics> sessionsById, - Map<
String, List< sessionsByLane,LedgerSessionMetrics> > - FalseFMetrics falseFs,
- CacheTokenTotals cacheTokens,
- double? cacheHitRatio,
- Map<
String, int> reworkRoundsByWorkBead, - LandedDeliveryTotals landedDeliveries,
- double? costPerLandedDelivery,
- Map<
String, Map< gradeDistributionByLane,LedgerGrade, int> > - List<
MetricsDecodeIssue> issues,
- Map<
- 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( Map<String, LedgerSessionMetrics> sessionsById, Map<String, List<LedgerSessionMetrics>> sessionsByLane, FalseFMetrics falseFs, CacheTokenTotals cacheTokens, double? cacheHitRatio, Map<String, int> reworkRoundsByWorkBead, LandedDeliveryTotals landedDeliveries, double? costPerLandedDelivery, Map<String, Map<LedgerGrade, int>> gradeDistributionByLane, List<MetricsDecodeIssue> issues)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SessionLedgerMetricsProjection() when $default != null:
return $default(_that.sessionsById,_that.sessionsByLane,_that.falseFs,_that.cacheTokens,_that.cacheHitRatio,_that.reworkRoundsByWorkBead,_that.landedDeliveries,_that.costPerLandedDelivery,_that.gradeDistributionByLane,_that.issues);case _:
return orElse();
}
}