forTesting property

bool forTesting
getter/setter pair

The flag that shows whether replaceForTesting is enabled.

Defaults to false, which means disabled. If this is set to true, replaceForTesting becomes available also on non-replaceable pots.

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

void main() {
  Pot.forTesting = true;

  test('Counter test', () {
    counterPot.replaceForTesting(() => Counter(100));
  });
}

See replaceForTesting for more details.

Implementation

static bool forTesting = false;