throwOnMissingStub function Null safety

void throwOnMissingStub(
  1. Mock mock,
  2. {void exceptionBuilder(
    1. Invocation
    )?}
)

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, {
  void Function(Invocation)? exceptionBuilder,
}) {
  _defaultResponses[mock] = () => _exceptionResponse(exceptionBuilder);
}