askarScanStart function
Implementation
Future<AskarResult<ScanHandle>> askarScanStart(
StoreHandle handle, {
String? profile,
String? category,
Map? tagFilter,
int? offset,
int? limit,
}) async {
Pointer<Utf8> profilePointer = nullptr;
Pointer<Utf8> categoryPointer = nullptr;
Pointer<Utf8> tagFilterPointer = nullptr;
try {
profilePointer = (profile ?? "").toNativeUtf8();
categoryPointer = (category ?? "").toNativeUtf8();
tagFilterPointer = jsonEncode(tagFilter).toNativeUtf8();
final callback = newCallbackWithHandle();
final initialResult = nativeAskarScanStart(
handle.toInt(),
profilePointer,
categoryPointer,
tagFilterPointer,
(offset ?? 0),
(limit ?? 0),
callback.nativeCallable.nativeFunction,
callback.id,
);
final completedResult = await callback.handleResult(initialResult);
return AskarResult<ScanHandle>(
completedResult.errorCode,
ScanHandle(completedResult.value),
);
} finally {
freePointer(profilePointer);
freePointer(categoryPointer);
freePointer(tagFilterPointer);
}
}