generateContentStream method

  1. @override
Stream<String> generateContentStream(
  1. GenerativeModel generativeModel,
  2. String prompt,
  3. List<File>? images
)
override

Generates a streaming response from the backend with the provided text represented Content.

Implementation

@override
Stream<String> generateContentStream(
  GenerativeModel generativeModel,
  String prompt,
  List<File>? images,
) async* {
  Map<String, dynamic> input = _getGenerateContentInput(
    generativeModel,
    prompt,
    images,
  );
  input["method"] = "generateContentStream";
  yield* _eventChannel
      .receiveBroadcastStream(Map.from(input))
      .map<String>((event) {
    return event;
  });
}