validateNativeSwipe function
Shared validation for CLI and library callers, before any native touch down.
Implementation
String? validateNativeSwipe(NativeSwipeInput input) {
final coordinates = [input.fromX, input.fromY, input.toX, input.toY];
if (coordinates.any((n) => !n.isFinite || n < 0)) return 'Coordinates must be finite non-negative numbers.';
if (input.durationMs < 1 || input.durationMs > 60000) {
return '--duration must be an integer from 1 to 60000 milliseconds.';
}
if (input.fromX == input.toX && input.fromY == input.toY) return '--from and --to must be different points.';
return null;
}