ensureReturns<T> method

T ensureReturns<T>(
  1. T function()
)

Implementation

T ensureReturns<T>(T Function() function) {
  try {
    return function();
    /* TODO(lzuttermeister): Can we do this better? Ideally by including the
         original error with its stack trace. */
    // ignore: avoid_catching_errors
  } on TypeError catch (_) {
    _throw();
  }
}