sync method Null safety

void sync()

Synchronise local storage and CouchDb when we come online or on demand.

Note we don't check for failures in this, there is nothing we can really do if we say get a conflict error or a not exists error on an update or delete.

For updates, if applied successfully we wait for the change notification to arrive to mark the update as UPDATED. Note if these are switched off sync may be lost with Couch.

Implementation

void sync() {
  /* Only if we are online */
  if (!online) {
    return;
  }
  _database.sync();
}