sdlGetJoystickSerial function

String? sdlGetJoystickSerial(
  1. Pointer<SdlJoystick> joystick
)

Get the serial number of an opened joystick, if available.

Returns the serial number of the joystick, or NULL if it is not available.

\param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). \returns the serial number of the selected joystick, or NULL if unavailable.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joystick)

Implementation

String? sdlGetJoystickSerial(Pointer<SdlJoystick> joystick) {
  final sdlGetJoystickSerialLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Pointer<SdlJoystick> joystick),
      Pointer<Utf8> Function(
          Pointer<SdlJoystick> joystick)>('SDL_GetJoystickSerial');
  final result = sdlGetJoystickSerialLookupFunction(joystick);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}