sdlGetSensorNameForId function
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.1.3.
extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id)
Implementation
String? sdlGetSensorNameForId(int instanceId) {
final sdlGetSensorNameForIdLookupFunction = libSdl3.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();
}