sdlGetAppMetadataProperty function

String? sdlGetAppMetadataProperty(
  1. String? name
)

Get metadata about your app.

This returns metadata previously set using SDL_SetAppMetadata() or SDL_SetAppMetadataProperty(). See SDL_SetAppMetadataProperty() for the list of available properties and their meanings.

\param name the name of the metadata property to get. \returns the current value of the metadata property, or the default if it is not set, NULL for properties with no default.

\threadsafety It is safe to call this function from any thread, although the string returned is not protected and could potentially be freed if you call SDL_SetAppMetadataProperty() to set that property from another thread.

\since This function is available since SDL 3.1.3.

\sa SDL_SetAppMetadata \sa SDL_SetAppMetadataProperty

extern SDL_DECLSPEC const char * SDLCALL SDL_GetAppMetadataProperty(const char *name)

Implementation

String? sdlGetAppMetadataProperty(String? name) {
  final sdlGetAppMetadataPropertyLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Pointer<Utf8> name),
      Pointer<Utf8> Function(Pointer<Utf8> name)>('SDL_GetAppMetadataProperty');
  final namePointer = name != null ? name.toNativeUtf8() : nullptr;
  final result = sdlGetAppMetadataPropertyLookupFunction(namePointer);
  calloc.free(namePointer);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}