onException method Null safety

void onException(
  1. dynamic e,
  2. StackTrace s
)

onException callback receives all the errors with their StackTrace. If assertions are on, which usually means app is in debug mode, then both exception and stack trace is printed. This can be overridden by the mutation implementation.

Implementation

void onException(dynamic e, StackTrace s) {
  var isAssertOn = false;
  assert(isAssertOn = true);
  if (isAssertOn) {
    print(e);
    print(s);
  }
}