replace<T extends SignalModel> static method

void replace<T extends SignalModel>(
  1. ModelBuilder<T> builder, [
  2. String? id
])

Replaces an existing model from the store with the same type of the given model.

Note that ModelStore.add doesn't replace a model if it already exists. Instead it silently ignores the request. So use this method for replacing an entire model. Use the id parameter to replace an instance of id model. See ModelStore.add for details.

Implementation

static void replace<T extends SignalModel>(ModelBuilder<T> builder,
    [String? id]) {
  final key = id ?? T;
  _LazyModelStore.replace(builder, key);
  _EagerModelStore.replace(builder(), key);
}