sdlGetSensorNameForId function sensor

String? sdlGetSensorNameForId(
  1. int instanceId
)

Get the implementation dependent name of a sensor.

This can be called before any sensors are opened.

\param instance_id the sensor instance ID. \returns the sensor name, or NULL if instance_id is not valid.

\since This function is available since SDL 3.2.0.

extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id)

Implementation

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