sdlSensorGetName function

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

Get the implementation dependent name of a sensor

\param sensor The SDL_Sensor object \returns the sensor name, or NULL if sensor is NULL.

\since This function is available since SDL 2.0.9.

extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor)

Implementation

String? sdlSensorGetName(Pointer<SdlSensor> sensor) {
  final sdlSensorGetNameLookupFunction = libSdl2.lookupFunction<
      Pointer<Utf8> Function(Pointer<SdlSensor> sensor),
      Pointer<Utf8> Function(Pointer<SdlSensor> sensor)>('SDL_SensorGetName');
  final result = sdlSensorGetNameLookupFunction(sensor);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}