sdlGetHint function

String? sdlGetHint(
  1. String? name
)

Get the value of a hint.

\param name the hint to query. \returns the string value of a hint or NULL if the hint isn't set.

\threadsafety It is safe to call this function from any thread, however the return value only remains valid until the hint is changed; if another thread might do so, the app should supply locks and/or make a copy of the string. Note that using a hint callback instead is always thread-safe, as SDL holds a lock on the thread subsystem during the callback.

\since This function is available since SDL 3.1.3.

\sa SDL_SetHint \sa SDL_SetHintWithPriority

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

Implementation

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