parseProviderTimeoutMs function

Duration? parseProviderTimeoutMs(
  1. Object? node,
  2. String field,
  3. String where
)

Implementation

Duration? parseProviderTimeoutMs(Object? node, String field, String where) {
  // ignore: avoid_dynamic_calls
  final value = node;
  if (value == null) return null;
  if (value is! int || value <= 0) {
    throw ConfigException(
      '"$field" on $where must be a positive integer (milliseconds), '
      'got: $value',
    );
  }
  if (value > maxProviderTimeoutMs) {
    throw ConfigException(
      '"$field" on $where must be at most $maxProviderTimeoutMs ms (1 h) — '
      'a larger value can never fire and silently disables the watchdog, '
      'got: $value',
    );
  }
  return Duration(milliseconds: value);
}