maybeWhen<TResult extends Object?> method

  1. @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
  1. TResult $default(
    1. String? id,
    2. String name,
    3. String? image,
    4. String code,
    5. double? weight,
    6. double? width,
    7. double? height,
    8. List<TenvioCustomPropertyInput> customProperties,
    )?, {
  2. 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( String? id,  String name,  String? image,  String code,  double? weight,  double? width,  double? height,  List<TenvioCustomPropertyInput> customProperties)?  $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _TenvioMatrixItemInput() when $default != null:
return $default(_that.id,_that.name,_that.image,_that.code,_that.weight,_that.width,_that.height,_that.customProperties);case _:
  return orElse();

}
}