sdlGetSensorName function

String? sdlGetSensorName(
  1. Pointer<SdlSensor> sensor
)

Get the implementation dependent name of a sensor.

\param sensor the SDL_Sensor object. \returns the sensor name or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor)

Implementation

String? sdlGetSensorName(Pointer<SdlSensor> sensor) {
  final sdlGetSensorNameLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Pointer<SdlSensor> sensor),
      Pointer<Utf8> Function(Pointer<SdlSensor> sensor)>('SDL_GetSensorName');
  final result = sdlGetSensorNameLookupFunction(sensor);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}