generateContent method
Implementation
@override
Future<Map<String, dynamic>> generateContent(String prompt) async {
try {
final result = await methodChannel.invokeMethod<Map<dynamic, dynamic>>(
'generateContent',
{'prompt': prompt},
);
return Map<String, dynamic>.from(result ?? {});
} on PlatformException catch (e) {
if (e.code == 'NOT_INITIALIZED') {
throw InitializationException(e.message ?? 'Model not initialized');
}
throw GenerationException(
e.message ?? 'Failed to generate content',
code: e.code,
details: e.details,
);
}
}