create method

  1. @override
Probe? create(
  1. String type
)
override

Creates a new Probe of the specified type. Note that type should be one of the dataTypes that this package supports. Returns null if a probe cannot be created for the type.

Implementation

@override
Probe? create(String type) {
  switch (type) {
    case ACCELERATION:
      return AccelerometerProbe();
    case NON_GRAVITATIONAL_ACCELERATION:
      return UserAccelerometerProbe();
    case ACCELERATION_FEATURES:
      return AccelerometerFeaturesProbe();
    case MAGNETIC_FIELD:
      return MagnetometerProbe();
    case ROTATION:
      return GyroscopeProbe();
    case STEP_COUNT:
      return PedometerProbe();
    case AMBIENT_LIGHT:
      return (Platform.isAndroid) ? LightProbe() : null;
    default:
      return null;
  }
}