maybeWhen<TResult extends Object?> method

  1. @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
  1. TResult $default(
    1. String id,
    2. String orgId,
    3. String provider,
    4. String status,
    5. String? teamId,
    6. String? teamName,
    7. String? connectedUserId,
    8. List<String> scopes,
    9. Map<String, dynamic> config,
    10. DateTime? lastVerifiedAt,
    11. String? lastError,
    12. String installedBy,
    13. DateTime installedAt,
    14. DateTime updatedAt,
    15. DateTime? tokenExpiresAt,
    16. bool hasCustomClient,
    )?, {
  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 orgId,  String provider,  String status,  String? teamId,  String? teamName,  String? connectedUserId, @JsonKey(fromJson: _castStringList)  List<String> scopes, @JsonKey(fromJson: _castMap)  Map<String, dynamic> config,  DateTime? lastVerifiedAt,  String? lastError,  String installedBy,  DateTime installedAt,  DateTime updatedAt,  DateTime? tokenExpiresAt,  bool hasCustomClient)?  $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _OrgIntegrationModel() when $default != null:
return $default(_that.id,_that.orgId,_that.provider,_that.status,_that.teamId,_that.teamName,_that.connectedUserId,_that.scopes,_that.config,_that.lastVerifiedAt,_that.lastError,_that.installedBy,_that.installedAt,_that.updatedAt,_that.tokenExpiresAt,_that.hasCustomClient);case _:
  return orElse();

}
}