abort function

Never abort(
  1. int code, [
  2. dynamic message,
  3. Map<String, String> headers = const <String, String>{}
])

Stop the request and answer with code.

if (post.userId != req.auth?.id()) abort(403);
abort(404, 'No post with this id');

Implementation

Never abort(
  int code, [
  dynamic message,
  Map<String, String> headers = const <String, String>{},
]) {
  throw HttpStatusException(code, message: message, headers: headers);
}