construct2 function
Shared constructor for (api_key, model_id[, base_url], out_handle)
providers.
Implementation
int construct2(
String apiKey,
String modelId,
String? baseUrl,
Pointer<Void> Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Uint64>) plain,
Pointer<Void> Function(
Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Pointer<Uint64>)
withBase,
) {
return withUtf8(apiKey, (keyPtr) {
return withUtf8(modelId, (idPtr) {
if (baseUrl == null) {
return takeHandle((out) => plain(keyPtr, idPtr, out), 'new');
}
return withUtf8(baseUrl, (basePtr) {
return takeHandle(
(out) => withBase(keyPtr, idPtr, basePtr, out), 'new_with_base');
});
});
});
}