NtpBase constructor

const NtpBase({
  1. String server = 'pool.ntp.org',
  2. int port = 123,
  3. int timeout = 5,
  4. String? apiUrl,
  5. DateTime parseResponse(
    1. Response
    )?,
  6. bool isUtc = false,
})

Creates a new NtpBase instance with optional configuration parameters.

All parameters are optional and have sensible defaults:

  • server defaults to 'pool.ntp.org'
  • port defaults to 123
  • timeout defaults to 5 seconds
  • isUtc defaults to false

If apiUrl is provided, parseResponse must also be provided, and vice versa.

Implementation

const NtpBase({
  this.server = 'pool.ntp.org',
  this.port = 123,
  this.timeout = 5,
  this.apiUrl,
  this.parseResponse,
  this.isUtc = false,
}) : assert(
        (apiUrl != null) == (parseResponse != null),
        'Both apiUrl and parseResponse must be provided together, or neither.',
      );