getSensors method

  1. @override
Future<List<SensorInfo>> getSensors()
override

Implementation

@override
Future<List<SensorInfo>> getSensors() async {
  try {
    final List<dynamic>? res = await methodChannel.invokeListMethod('getSensors');
    return SafeParser.parseList<SensorInfo>(res, (m) => SensorInfo.fromMap(m));
  } on PlatformException catch (e) {
    throw DeviceInspectorException(_mapErrorCode(e.code), e.message ?? 'Failed to get sensors', cause: e);
  } catch (e) {
    return const [];
  }
}