sdlSensorGetDeviceName function

String? sdlSensorGetDeviceName(
  1. int deviceIndex
)

Get the implementation dependent name of a sensor.

\param device_index The sensor to obtain name from \returns the sensor name, or NULL if device_index is out of range.

\since This function is available since SDL 2.0.9.

extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index)

Implementation

String? sdlSensorGetDeviceName(int deviceIndex) {
  final sdlSensorGetDeviceNameLookupFunction = libSdl2.lookupFunction<
      Pointer<Utf8> Function(Int32 deviceIndex),
      Pointer<Utf8> Function(int deviceIndex)>('SDL_SensorGetDeviceName');
  final result = sdlSensorGetDeviceNameLookupFunction(deviceIndex);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}