rmlSchemaSearch function
Types and properties whose names contain text, case-insensitively: the
same answer rive schema --search <text> gives. Empty when nothing
matches -- including an empty text, which the CLI never passes through
to a search either.
Throws when markupAvailable is false.
Implementation
String rmlSchemaSearch(String text, {bool json = false}) {
_requireMarkup();
if (text.isEmpty) {
return json ? '[]\n' : '';
}
final textBytes = utf8.encode(text);
final textPtr = calloc<Uint8>(textBytes.length);
final response = calloc<_RmlSchemaTextResponseStruct>();
try {
textPtr.asTypedList(textBytes.length).setAll(0, textBytes);
_rmlSchemaSearch(textPtr, textBytes.length, json, response);
return _decodeSchemaText(response) ?? '';
} finally {
_freeRmlSchemaText(response);
calloc.free(response);
calloc.free(textPtr);
}
}