setSensorType method
Implementation
void setSensorType(int cameraPosition, SensorType type, String deviceId) {
final previous = cameraContext.sensorConfig;
int sensorIndex = 0;
final next = SensorConfig.multiple(
sensors: previous.sensors
.map((sensor) {
if (sensorIndex == cameraPosition) {
if (sensor.type == SensorType.trueDepth) {
sensor.position = SensorPosition.front;
} else {
sensor.position = SensorPosition.back;
}
sensor.deviceId = deviceId;
sensor.type = type;
}
sensorIndex++;
return sensor;
})
.whereNotNull()
.toList(),
aspectRatio: previous.aspectRatio,
flashMode: previous.flashMode,
zoom: previous.zoom,
);
cameraContext.setSensorConfig(next);
}