nowToIsoString static method

Future<String> nowToIsoString({
  1. bool isUtc = true,
  2. NtpServer server = NtpServer.google,
  3. String? customServer,
  4. List<NtpServer>? fallbackServers,
  5. int port = 123,
  6. int timeout = 5,
  7. int samples = 1,
  8. bool forceRefresh = false,
  9. bool allowFallback = true,
})

Returns the current accurate time as an ISO 8601 string.

isUtc defaults to true (UTC).

Implementation

static Future<String> nowToIsoString({
  bool isUtc = true,
  NtpServer server = NtpServer.google,
  String? customServer,
  List<NtpServer>? fallbackServers,
  int port = 123,
  int timeout = 5,
  int samples = 1,
  bool forceRefresh = false,
  bool allowFallback = true,
}) async {
  final time = await now(
    isUtc: isUtc,
    server: server,
    customServer: customServer,
    fallbackServers: fallbackServers,
    port: port,
    timeout: timeout,
    samples: samples,
    forceRefresh: forceRefresh,
    allowFallback: allowFallback,
  );
  return time.toIso8601String();
}