replaceable<T> static method
Creates a pot of type ReplaceablePot that has the ability
to replace its factory with another one of type T
.
// replace() is not available in this pot.
final pot = Pot(() => Counter());
// replace() is available in these pots.
final replaceablePot1 = Pot.replaceable(() => Counter());
final replaceablePot2 = Pot.pending<Counter>();
...
replaceablePot2.replace(() => SubtypeOfCounter());
Replacements are only available for this type of pots.
See ReplaceablePot.replace for more details.
Implementation
static ReplaceablePot<T> replaceable<T>(
PotObjectFactory<T> factory, {
PotDisposer<T>? disposer,
}) {
return ReplaceablePot<T>._(factory, disposer: disposer);
}