getResponseAsync method

  1. @override
Stream<String?> getResponseAsync({
  1. required String prompt,
})
override

Implementation

@override
Stream<String?> getResponseAsync({required String prompt}) {
  if (_initCompleter.isCompleted) {
    methodChannel.invokeMethod('getGemmaResponseAsync', {'prompt': prompt});
    return eventChannel.receiveBroadcastStream().map<String?>((event) => event as String?);
  } else {
    throw Exception('Gemma is not initialized yet');
  }
}