sync method

void sync([
  1. Set<String>? fields
])
inherited

There are some weird cases where collections aren't synced properly with the underlying json. This will overwrite the json with the latest value of the variable.

Implementation

void sync([Set<String>? fields]) {
  fields ??= this.mfields;
  fields.forEach((f) {
    final v = this[f];
    if (v is Iterable || v is Map) {
      this[f] = v;
    }
  });
}