Remove checkNotNull
diff --git a/pkgs/shelf_router/lib/src/router.dart b/pkgs/shelf_router/lib/src/router.dart
index 51f96fd..ca4dbb8 100644
--- a/pkgs/shelf_router/lib/src/router.dart
+++ b/pkgs/shelf_router/lib/src/router.dart
@@ -19,9 +19,6 @@
/// Get a URL parameter captured by the [Router].
String params(Request request, String name) {
- ArgumentError.checkNotNull(request, 'request');
- ArgumentError.checkNotNull(name, 'name');
-
final p = request.context['shelf_router/params'];
if (!(p is Map<String, String>)) {
throw Exception('no such parameter $name');
@@ -101,7 +98,6 @@
/// `HEAD` is always wrong. To explicitely implement a `HEAD` handler it must
/// be registered before the `GET` handler.
void add(String verb, String route, Function handler) {
- ArgumentError.checkNotNull(verb, 'verb');
if (!isHttpMethod(verb)) {
throw ArgumentError.value(verb, 'verb', 'expected a valid HTTP method');
}
@@ -124,8 +120,6 @@
///
/// In this case prefix may not contain any parameters, nor
void mount(String prefix, Handler handler) {
- ArgumentError.checkNotNull(prefix, 'prefix');
- ArgumentError.checkNotNull(handler, 'handler');
if (!prefix.startsWith('/') || !prefix.endsWith('/')) {
throw ArgumentError.value(
prefix, 'prefix', 'must start and end with a slash');
diff --git a/pkgs/shelf_router/lib/src/router_entry.dart b/pkgs/shelf_router/lib/src/router_entry.dart
index 98fb3c0..4860ef3 100644
--- a/pkgs/shelf_router/lib/src/router_entry.dart
+++ b/pkgs/shelf_router/lib/src/router_entry.dart
@@ -17,8 +17,6 @@
/// Check if the [regexp] is non-capturing.
bool _isNoCapture(String regexp) {
- ArgumentError.checkNotNull(regexp, 'regexp');
-
// Construct a new regular expression matching anything containing regexp,
// then match with empty-string and count number of groups.
return RegExp('^(?:$regexp)|.*\$').firstMatch('')!.groupCount == 0;
@@ -57,9 +55,6 @@
}) {
middleware = middleware ?? ((Handler fn) => fn);
- ArgumentError.checkNotNull(verb, 'verb');
- ArgumentError.checkNotNull(route, 'route');
- ArgumentError.checkNotNull(handler, 'handler');
if (!route.startsWith('/')) {
throw ArgumentError.value(
route, 'route', 'expected route to start with a slash');