setSensorOverrideEnabled method

Future<void> setSensorOverrideEnabled(
  1. bool enabled,
  2. SensorType type, {
  3. SensorMetadata? metadata,
})

Overrides a platform sensor of a given type. If |enabled| is true, calls to Sensor.start() will use a virtual sensor as backend rather than fetching data from a real hardware sensor. Otherwise, existing virtual sensor-backend Sensor objects will fire an error event and new calls to Sensor.start() will attempt to use a real sensor instead.

Implementation

Future<void> setSensorOverrideEnabled(
  bool enabled,
  SensorType type, {
  SensorMetadata? metadata,
}) async {
  await _client.send('Emulation.setSensorOverrideEnabled', {
    'enabled': enabled,
    'type': type,
    if (metadata != null) 'metadata': metadata,
  });
}