setCredentials method

void setCredentials(
  1. SyncCredentials creds
)

Configure authentication credentials, depending on your server config.

Implementation

void setCredentials(SyncCredentials creds) {
  if (creds is _SyncCredentialsNone) {
    checkObx(C.sync_credentials(_ptr, creds._type, nullptr, 0));
  } else if (creds is _SyncCredentialsUserPassword) {
    withNativeString(
        creds._user,
        (userCStr) => withNativeString(
            creds._password,
            (passwordCStr) => C.sync_credentials_user_password(
                _ptr, creds._type, userCStr, passwordCStr)));
  } else if (creds is SyncCredentialsSecret) {
    withNativeBytes(
        creds.data,
        (Pointer<Uint8> credsPtr, int credsSize) => checkObx(
            C.sync_credentials(_ptr, creds._type, credsPtr, credsSize)));
  }
}