diff --git a/packages/combinator/lib/src/combinator/chain.dart b/packages/combinator/lib/src/combinator/chain.dart index 8e0552c8..49cc8c1b 100644 --- a/packages/combinator/lib/src/combinator/chain.dart +++ b/packages/combinator/lib/src/combinator/chain.dart @@ -22,8 +22,8 @@ class _Alt extends Parser { return result.successful ? result : result.addErrors([ - new SyntaxError(severity ?? SyntaxErrorSeverity.error, errorMessage, - result.span ?? args.scanner.emptySpan), + new SyntaxError( + severity, errorMessage, result.span ?? args.scanner.emptySpan), ]); } diff --git a/packages/route/lib/src/grammar.dart b/packages/route/lib/src/grammar.dart index e2974c15..951eb438 100644 --- a/packages/route/lib/src/grammar.dart +++ b/packages/route/lib/src/grammar.dart @@ -192,8 +192,8 @@ class WildcardSegment extends RouteSegment { var items = r.value!.cast(); var a = items[0], b = items[1]; return a - ..addAll(b?.params ?? {}) - .._setTail(b?.tail); + ..addAll(b.params ?? {}) + .._setTail(b.tail); }); } } diff --git a/packages/route/lib/src/routing_result.dart b/packages/route/lib/src/routing_result.dart index 5d7c4b2a..03ec4f73 100644 --- a/packages/route/lib/src/routing_result.dart +++ b/packages/route/lib/src/routing_result.dart @@ -26,9 +26,9 @@ class RoutingResult { /// The [RoutingResult] that matched the most specific sub-path. RoutingResult get deepest { - RoutingResult search = this; + var search = this; - while (search?.nested?.isNotEmpty == true) { + while (search.nested?.isNotEmpty == true) { search = search.nested!.first; } @@ -43,9 +43,7 @@ class RoutingResult { /// The handlers at this sub-path. List get handlers { - return [] - ..addAll(shallowRouter!.middleware) - ..addAll(shallowRoute!.handlers!); + return [...shallowRouter!.middleware, ...shallowRoute!.handlers!]; } /// All handlers on this sub-path and its children. @@ -69,7 +67,7 @@ class RoutingResult { /// All parameters on this sub-path and its children. Map get allParams { - final Map params = {}; + final params = {}; void crawl(RoutingResult result) { params.addAll(result.params); @@ -92,6 +90,6 @@ class RoutingResult { this.shallowRoute, this.shallowRouter, required this.tail}) { - this.params.addAll(params ?? {}); + this.params.addAll(params); } }