getSensors method
Returns the native Android sensors reported by the device.
Implementation
@override
Future<List<NativeSensor>> getSensors() async {
final List<Object?>? sensorList = await methodChannel
.invokeListMethod<Object?>('getSensors');
if (sensorList == null) {
throw PlatformException(
code: 'native_lens_empty_sensors',
message: 'Android returned an empty sensor list.',
);
}
final List<NativeSensor> sensors = <NativeSensor>[];
for (final Object? sensorItem in sensorList) {
if (sensorItem is Map<Object?, Object?>) {
sensors.add(NativeSensor.fromMap(sensorItem));
}
}
return sensors;
}