sdlJoystickGetSerial function

String? sdlJoystickGetSerial(
  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_JoystickOpen() \returns the serial number of the selected joystick, or NULL if unavailable.

\since This function is available since SDL 2.0.14.

extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick)

Implementation

String? sdlJoystickGetSerial(Pointer<SdlJoystick> joystick) {
  final sdlJoystickGetSerialLookupFunction = libSdl2.lookupFunction<
      Pointer<Utf8> Function(Pointer<SdlJoystick> joystick),
      Pointer<Utf8> Function(
          Pointer<SdlJoystick> joystick)>('SDL_JoystickGetSerial');
  final result = sdlJoystickGetSerialLookupFunction(joystick);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}