toString method

  1. @override
String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

Implementation

@override
String toString() {
  final headers = this.headers?.let(_redactHeaders);

  return [
    'ReplicatorConfiguration(',
    [
      'database: $database',
      'target: $target',
      'replicatorType: ${replicatorType.name}',
      if (continuous) 'CONTINUOUS',
      if (authenticator != null) 'authenticator: $authenticator',
      if (pinnedServerCertificate != null) 'PINNED-SERVER-CERTIFICATE',
      if (trustedRootCertificates != null) 'TRUSTED-ROOT-CERTIFICATES',
      if (headers != null) 'headers: $headers',
      if (channels != null) 'channels: $channels',
      if (documentIds != null) 'documentIds: $documentIds',
      if (pushFilter != null) 'PUSH-FILTER',
      if (typedPushFilter != null) 'TYPED-PUSH-FILTER',
      if (pullFilter != null) 'PULL-FILTER',
      if (typedPullFilter != null) 'TYPED-PULL-FILTER',
      if (conflictResolver != null) 'CUSTOM-CONFLICT-RESOLVER',
      if (typedConflictResolver != null) 'TYPED-CUSTOM-CONFLICT-RESOLVER',
      if (!enableAutoPurge) 'DISABLE-AUTO-PURGE',
      if (heartbeat != null) 'heartbeat: ${_heartbeat!.inSeconds}s',
      if (maxAttempts != null) 'maxAttempts: $maxAttempts',
      if (maxAttemptWaitTime != null)
        'maxAttemptWaitTime: ${_maxAttemptWaitTime!.inSeconds}s',
    ].join(', '),
    ')'
  ].join();
}