getResponse method
Implementation
@override
Future<String?> getResponse({required String prompt}) async {
if (_initCompleter.isCompleted) {
try {
return await methodChannel.invokeMethod<String>('getGemmaResponse', {'prompt': prompt});
} on PlatformException catch (e) {
throw Exception('Platform error: ${e.message}');
} catch (e) {
throw Exception('Error: $e');
}
} else {
throw Exception('Gemma is not initialized yet');
}
}