computePanSlop function Null safety

double computePanSlop(
  1. PointerDeviceKind kind,
  2. DeviceGestureSettings? settings
)

Determine the appropriate pan slop pixels based on the kind of pointer.

Implementation

double computePanSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) {
  switch (kind) {
    case PointerDeviceKind.mouse:
      return kPrecisePointerPanSlop;
    case PointerDeviceKind.stylus:
    case PointerDeviceKind.invertedStylus:
    case PointerDeviceKind.unknown:
    case PointerDeviceKind.touch:
    default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind]
             // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604
      return settings?.panSlop ?? kPanSlop;
  }
}