parseTimeout static method

Duration parseTimeout(
  1. String? value
)

Parses a --timeout value in seconds (fractions allowed).

Implementation

static Duration parseTimeout(String? value) {
  if (value == null || value.trim().isEmpty) return defaultTimeout;
  final double? seconds = double.tryParse(value.trim());
  if (seconds == null || seconds <= 0) {
    throw FormatException(
      '--timeout must be a positive number of seconds, got "$value".',
    );
  }
  return Duration(milliseconds: (seconds * 1000).round());
}