create method

void create({
  1. bool suppressWarning = false,
})
inherited

Calls the factory to create an object of type T.

If this is called, the factory, which was set in the constructor, is executed to create an object. Otherwise, an object is not created until it is needed. Therefore this method is useful when you want to explicitly cause the creation immediately.

final counterPot = Pot(() => Counter(0));

void main() {
  counterPot.create();
  ...
}

create is almost the same as call, only with the difference that this does not return the object while call() does, so call() can also be used for the same purpose instead.

Note that calling this method has no effect if the object has already been created.

Implementation

void create({bool suppressWarning = false}) =>
    call(suppressWarning: suppressWarning);