getSensorInfo static method

Future<Map<String, dynamic>> getSensorInfo()

Retrieves sensor information for web platforms

Returns a map containing available sensor types. Note: Sensor detection on web is limited due to browser security restrictions. This method provides a basic list of commonly available sensors.

Returns a map with 'availableSensors' key containing a list of sensor types.

Implementation

static Future<Map<String, dynamic>> getSensorInfo() async {
  try {
    final sensors = <String>[];

    // Check for available sensors - simplified check
    // DeviceMotionEvent and DeviceOrientationEvent are not directly available in package:web
    // This is a basic implementation
    sensors.add('accelerometer'); // Assume available if browser supports it
    sensors.add('gyroscope');
    sensors.add('magnetometer');

    return {'availableSensors': sensors};
  } catch (e) {
    return {'availableSensors': <String>[]};
  }
}