getListOfString method
Implementation
@override
Future<List<String>> getListOfString(
String prompt, {
String? sessionId,
}) async {
if (prompt.trim().isEmpty) {
throw AppleFoundationException(
'Prompt cannot be empty',
code: 'INVALID_PROMPT',
);
}
try {
final List<dynamic>? result =
await _invokeMethodWithTimeout<List<dynamic>>('getListOfString', {
'prompt': prompt,
if (sessionId != null) 'sessionId': sessionId,
});
if (result == null) {
throw AppleFoundationException(
'Received null response from native layer',
code: 'NULL_RESPONSE',
);
}
return result.cast<String>();
} catch (e) {
_logError('getListOfString', e);
throw AppleFoundationException(
'Failed to get list of strings: ${e.toString()}',
code: 'LIST_STRING_FAILED',
details: {'prompt': prompt, 'sessionId': sessionId},
);
}
}