getDefaultSensor method

Future<Sensor> getDefaultSensor(
  1. int type
)

Gets the default sensor for a given type.

See: https://developer.android.com/reference/android/hardware/SensorManager#getDefaultSensor(int)

Implementation

static Future<Sensor> getDefaultSensor(final int type) async {
  assert(Platform.isAndroid);
  final request = <String, dynamic>{'type': type};
  final key = await _channel.invokeMethod('getDefaultSensor', request);
  return (key == null)
      ? null
      : Sensor(
          key: key,
          name: null, // TODO
          type: type,
        );
}