streamGenerateContent method

  1. @override
Stream<GenerateContentResponse> streamGenerateContent(
  1. GenerateContentRequest request
)
override

Generates a streamed response from the model given an input GenerateContentRequest.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

@override
Stream<GenerateContentResponse> streamGenerateContent(
  GenerateContentRequest request,
) {
  if (isClosed) throw StateError('Service is closed');
  if (_streamGenerateContent case final streamGenerateContent?) {
    return streamGenerateContent(request);
  }
  throw UnsupportedError('streamGenerateContent');
}