maybeWhen<TResult extends Object?> method

  1. @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
  1. TResult $default(
    1. String userID,
    2. String projectSecretKey,
    3. LocalizedText? welcomeMessage,
    4. LocalizedText? name,
    5. LocalizedText? systemInstructions,
    6. String defaultLocale,
    7. List<String> supportedLocales,
    8. String? currentLocale,
    9. String? allowedOrigins,
    10. String? fontFamily,
    11. String? color,
    12. Uint8List? avatar,
    13. bool isPreviewMode,
    14. FabConfiguration fabConfiguration,
    )?, {
  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 userID,  String projectSecretKey,  LocalizedText? welcomeMessage,  LocalizedText? name,  LocalizedText? systemInstructions,  String defaultLocale,  List<String> supportedLocales,  String? currentLocale,  String? allowedOrigins,  String? fontFamily,  String? color, @unfreezed  Uint8List? avatar,  bool isPreviewMode,  FabConfiguration fabConfiguration)?  $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _BotConfiguration() when $default != null:
return $default(_that.userID,_that.projectSecretKey,_that.welcomeMessage,_that.name,_that.systemInstructions,_that.defaultLocale,_that.supportedLocales,_that.currentLocale,_that.allowedOrigins,_that.fontFamily,_that.color,_that.avatar,_that.isPreviewMode,_that.fabConfiguration);case _:
  return orElse();

}
}