update method

void update(
  1. RepoUpdateType updateType, {
  2. List<Id>? ids,
  3. List<Model>? models,
})

This functions notify in _repositoryStream that are a change in the models in repositoryMap

You can use ids to update a list of ids or you can use models to update a list of models. The type of all updates will be updateType

! Not use this function outside the repositories

In the extended class, this function has to be called always for the models obtained from the database. (like getFromId)

Implementation

void update(RepoUpdateType updateType, {List<Id>? ids, List<Model>? models}) {
  if (ids == null && models == null) return;
  List<RepoUpdate> updates;
  if (ids != null) {
    updates =
        ids.map((e) => RepoUpdate<Id>(modelId: e, type: updateType)).toList();
  } else {
    updates = models!
        .map((e) => RepoUpdate<Id>(modelId: e.id, type: updateType))
        .toList();
  }
  _repositoryStream.add(updates as List<RepoUpdate<Id>>);
}