whenOrNull<TResult extends Object?> method

  1. @optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
  1. TResult? system(
    1. ChatCompletionMessageRole role,
    2. String content,
    3. String? name
    )?,
  2. TResult? user(
    1. ChatCompletionMessageRole role,
    2. ChatCompletionUserMessageContent content,
    3. String? name
    )?,
  3. TResult? assistant(
    1. ChatCompletionMessageRole role,
    2. String? content,
    3. String? refusal,
    4. String? name,
    5. List<ChatCompletionMessageToolCall>? toolCalls,
    6. ChatCompletionMessageFunctionCall? functionCall,
    7. ChatCompletionAssistantMessageAudio? audio,
    )?,
  4. TResult? tool(
    1. ChatCompletionMessageRole role,
    2. String content,
    3. String toolCallId
    )?,
  5. TResult? function(
    1. ChatCompletionMessageRole role,
    2. String? content,
    3. String name
    )?,
})
inherited

Implementation

@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
  TResult? Function(ChatCompletionMessageRole role, String content,
          @JsonKey(includeIfNull: false) String? name)?
      system,
  TResult? Function(
          ChatCompletionMessageRole role,
          @_ChatCompletionUserMessageContentConverter()
          ChatCompletionUserMessageContent content,
          @JsonKey(includeIfNull: false) String? name)?
      user,
  TResult? Function(
          ChatCompletionMessageRole role,
          @JsonKey(includeIfNull: false) String? content,
          @JsonKey(includeIfNull: false) String? refusal,
          @JsonKey(includeIfNull: false) String? name,
          @JsonKey(name: 'tool_calls', includeIfNull: false)
          List<ChatCompletionMessageToolCall>? toolCalls,
          @JsonKey(name: 'function_call', includeIfNull: false)
          ChatCompletionMessageFunctionCall? functionCall,
          @JsonKey(includeIfNull: false)
          ChatCompletionAssistantMessageAudio? audio)?
      assistant,
  TResult? Function(ChatCompletionMessageRole role, String content,
          @JsonKey(name: 'tool_call_id') String toolCallId)?
      tool,
  TResult? Function(
          ChatCompletionMessageRole role, String? content, String name)?
      function,
}) =>
    throw _privateConstructorUsedError;