Document<T> constructor

Document<T>(
  1. String parent,
  2. String id, {
  3. FromJson<T>? fromJson,
  4. ToJson<T>? toJson,
  5. DependenciesBuilder<T>? dependenciesBuilder,
  6. PersistorSettings? persistorSettings,
})

Implementation

Document(
  this.parent,
  this.id, {
  this.fromJson,
  this.toJson,
  this.dependenciesBuilder,
  PersistorSettings? persistorSettings,
}) {
  this.persistorSettings = switch (persistorSettings) {
    PathPersistorSettings _ => persistorSettings,
    // If the persistor settings are not yet associated with a path, then the settings
    // are updated to having been applied at the document's path.
    PersistorSettings _ =>
      PathPersistorSettings(settings: persistorSettings, ref: this),
    _ => persistorSettings,
  };
}