sdlGetKeyboardNameForId function keyboard

String? sdlGetKeyboardNameForId(
  1. int instanceId
)

Get the name of a keyboard.

This function returns "" if the keyboard doesn't have a name.

\param instance_id the keyboard instance ID. \returns the name of the selected keyboard or NULL on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.2.0.

\sa SDL_GetKeyboards

extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id)

Implementation

String? sdlGetKeyboardNameForId(int instanceId) {
  final sdlGetKeyboardNameForIdLookupFunction = _libSdl
      .lookupFunction<
        Pointer<Utf8> Function(Uint32 instanceId),
        Pointer<Utf8> Function(int instanceId)
      >('SDL_GetKeyboardNameForID');
  final result = sdlGetKeyboardNameForIdLookupFunction(instanceId);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}