validate method

bool validate()

Validates the configuration.

Returns true if the configuration is valid, false otherwise.

Validation rules:

  • baseUrl must not be empty
  • baseUrl must start with http:// or https://
  • timeout must be at least 5 seconds
  • maxRetries must be non-negative

Implementation

bool validate() {
  if (baseUrl.isEmpty) return false;
  if (!baseUrl.startsWith('http://') && !baseUrl.startsWith('https://')) {
    return false;
  }
  if (timeout.inSeconds < 5) return false;
  if (maxRetries < 0) return false;
  return true;
}