sdlGetGamepadPathForId function gamepad

String? sdlGetGamepadPathForId(
  1. int instanceId
)

Get the implementation dependent path of a gamepad.

This can be called before any gamepads are opened.

\param instance_id the joystick instance ID. \returns the path of the selected gamepad. If no path can be found, this function returns NULL; call SDL_GetError() for more information.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

\sa SDL_GetGamepadPath \sa SDL_GetGamepads

extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadPathForID(SDL_JoystickID instance_id)

Implementation

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