throwOnMissingStub function

void throwOnMissingStub (
  1. Mock mock
)

Opt-into Mock throwing NoSuchMethodError for unimplemented methods.

The default behavior when not using this is to always return null.

Implementation

void throwOnMissingStub(Mock mock) {
  mock._defaultResponse =
      () => CallPair<dynamic>.allInvocations(mock._noSuchMethod);
}