rmlSchemaDescribe function

String? rmlSchemaDescribe(
  1. String typeName, {
  2. bool includeEditorOnly = false,
  3. bool animatableOnly = false,
  4. bool bindableOnly = false,
  5. bool json = false,
})

A core type's properties, inherited included: the same answer rive schema <typeName> gives. Null for a type that does not exist -- json does not change that, an unknown type is empty either way.

includeEditorOnly is --all; animatableOnly and bindableOnly narrow to properties that can be keyed or data bound, respectively.

Throws when markupAvailable is false.

Implementation

String? rmlSchemaDescribe(
  String typeName, {
  bool includeEditorOnly = false,
  bool animatableOnly = false,
  bool bindableOnly = false,
  bool json = false,
}) {
  _requireMarkup();
  // No real type has an empty name; short-circuits the zero-length alloc
  // below, which calloc need not accept.
  if (typeName.isEmpty) {
    return null;
  }
  final nameBytes = utf8.encode(typeName);
  final namePtr = calloc<Uint8>(nameBytes.length);
  final response = calloc<_RmlSchemaTextResponseStruct>();
  try {
    namePtr.asTypedList(nameBytes.length).setAll(0, nameBytes);
    final found = _rmlSchemaDescribe(
      namePtr,
      nameBytes.length,
      includeEditorOnly,
      animatableOnly,
      bindableOnly,
      json,
      response,
    );
    if (!found) {
      return null;
    }
    return _decodeSchemaText(response);
  } finally {
    _freeRmlSchemaText(response);
    calloc.free(response);
    calloc.free(namePtr);
  }
}