diff --git a/.idea/angel_route.iml b/.idea/angel_route.iml deleted file mode 100644 index 954fa6c5..00000000 --- a/.idea/angel_route.iml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/All_Tests.xml b/.idea/runConfigurations/All_Tests.xml deleted file mode 100644 index 482db2f9..00000000 --- a/.idea/runConfigurations/All_Tests.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/parse_in_parse_test_dart.xml b/.idea/runConfigurations/parse_in_parse_test_dart.xml deleted file mode 100644 index f37be7fe..00000000 --- a/.idea/runConfigurations/parse_in_parse_test_dart.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/tests_in_route.xml b/.idea/runConfigurations/tests_in_route.xml index 826fa404..9f2a66b3 100644 --- a/.idea/runConfigurations/tests_in_route.xml +++ b/.idea/runConfigurations/tests_in_route.xml @@ -2,7 +2,7 @@ \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml index 7c403f75..1a46de2e 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,7 +1,3 @@ analyzer: strong-mode: -<<<<<<< HEAD implicit-casts: false -======= - implicit-casts: false ->>>>>>> 6bf72feffc1af269e2ebfa5d1fbcd4f08ba3ea90 diff --git a/lib/angel_route.dart b/lib/angel_route.dart index 78039ad9..838e6525 100644 --- a/lib/angel_route.dart +++ b/lib/angel_route.dart @@ -2,4 +2,4 @@ library angel_route; export 'src/middleware_pipeline.dart'; export 'src/router.dart'; -export 'src/routing_exception.dart'; \ No newline at end of file +export 'src/routing_exception.dart'; diff --git a/lib/src/middleware_pipeline.dart b/lib/src/middleware_pipeline.dart index 4f34007e..bdf52158 100644 --- a/lib/src/middleware_pipeline.dart +++ b/lib/src/middleware_pipeline.dart @@ -18,6 +18,6 @@ class MiddlewarePipeline { return _handlers = handlers; } - MiddlewarePipeline(Iterable routingResults) + MiddlewarePipeline(Iterable> routingResults) : this.routingResults = routingResults.toList(); } diff --git a/lib/src/router.dart b/lib/src/router.dart index cbc0e62e..6e9d91ac 100644 --- a/lib/src/router.dart +++ b/lib/src/router.dart @@ -267,16 +267,16 @@ class Router { /// Finds the first [Route] that matches the given path, /// with the given method. - bool resolve(String absolute, String relative, List out, + bool resolve(String absolute, String relative, List> out, {String method: 'GET', bool strip: true}) { final cleanRelative = strip == false ? relative : stripStraySlashes(relative); var scanner = new SpanScanner(cleanRelative); - bool crawl(Router r) { + bool crawl(Router r) { bool success = false; - for (Route route in r.routes) { + for (var route in r.routes) { int pos = scanner.position; if (route is SymlinkRoute) { @@ -290,7 +290,7 @@ class Router { var parseResult = route.parser.parse(scanner); if (parseResult.successful && scanner.isDone) { - var result = new RoutingResult( + var result = new RoutingResult( parseResult: parseResult, params: parseResult.value, shallowRoute: route, diff --git a/lib/src/routing_exception.dart b/lib/src/routing_exception.dart index 3d243bd4..c97ba7f4 100644 --- a/lib/src/routing_exception.dart +++ b/lib/src/routing_exception.dart @@ -1,12 +1,16 @@ /// Represents an error in route configuration or navigation. abstract class RoutingException extends Exception { - factory RoutingException(String message) => new _RoutingExceptionImpl(message); + factory RoutingException(String message) => + new _RoutingExceptionImpl(message); /// Occurs when trying to resolve the parent of a [Route] without a parent. - factory RoutingException.orphan() => new _RoutingExceptionImpl("Tried to resolve path '..' on a route that has no parent."); + factory RoutingException.orphan() => new _RoutingExceptionImpl( + "Tried to resolve path '..' on a route that has no parent."); /// Occurs when the user attempts to navigate to a non-existent route. - factory RoutingException.noSuchRoute(String path) => new _RoutingExceptionImpl("Tried to navigate to non-existent route: '$path'."); + factory RoutingException.noSuchRoute(String path) => + new _RoutingExceptionImpl( + "Tried to navigate to non-existent route: '$path'."); } class _RoutingExceptionImpl implements RoutingException { @@ -16,4 +20,4 @@ class _RoutingExceptionImpl implements RoutingException { @override String toString() => message; -} \ No newline at end of file +} diff --git a/lib/src/routing_result.dart b/lib/src/routing_result.dart index 38a2bd3a..91de2e57 100644 --- a/lib/src/routing_result.dart +++ b/lib/src/routing_result.dart @@ -41,7 +41,9 @@ class RoutingResult { /// The handlers at this sub-path. List get handlers { - return []..addAll(shallowRouter.middleware)..addAll(shallowRoute.handlers); + return [] + ..addAll(shallowRouter.middleware) + ..addAll(shallowRoute.handlers); } /// All handlers on this sub-path and its children. @@ -52,8 +54,7 @@ class RoutingResult { handlers.addAll(result.handlers); if (result.nested?.isNotEmpty == true) { - for (var r in result.nested) - crawl(r); + for (var r in result.nested) crawl(r); } } @@ -70,8 +71,7 @@ class RoutingResult { params.addAll(result.params); if (result.nested?.isNotEmpty == true) { - for (var r in result.nested) - crawl(r); + for (var r in result.nested) crawl(r); } } diff --git a/lib/src/symlink_route.dart b/lib/src/symlink_route.dart index cf3a3cf2..9f49b369 100644 --- a/lib/src/symlink_route.dart +++ b/lib/src/symlink_route.dart @@ -4,5 +4,6 @@ part of angel_route.src.router; /// to a mounted [Router]. class SymlinkRoute extends Route { final Router router; - SymlinkRoute(String path, this.router) : super(path, method: null, handlers: null); + SymlinkRoute(String path, this.router) + : super(path, method: null, handlers: null); } diff --git a/lib/string_util.dart b/lib/string_util.dart index 9a9e5bf7..023310e4 100644 --- a/lib/string_util.dart +++ b/lib/string_util.dart @@ -20,8 +20,7 @@ String stripStray(String haystack, String needle) { if (haystack[i] != needle) { var sub = haystack.substring(i); - if (!sub.endsWith(needle)) - return sub; + if (!sub.endsWith(needle)) return sub; var lastSlash = sub.lastIndexOf(needle); diff --git a/test/params_test.dart b/test/params_test.dart index ff90d25b..1840e2d0 100644 --- a/test/params_test.dart +++ b/test/params_test.dart @@ -2,9 +2,7 @@ import 'package:angel_route/angel_route.dart'; import 'package:test/test.dart'; main() { - final router = new Router() - ..get('/hello', '') - ..get('/user/:id', ''); + final router = new Router()..get('/hello', '')..get('/user/:id', ''); router.group('/book/:id', (router) { router.get('/reviews', ''); diff --git a/test/server_test.dart b/test/server_test.dart index 59ddf561..faa2fd89 100644 --- a/test/server_test.dart +++ b/test/server_test.dart @@ -1,8 +1,6 @@ import 'dart:convert'; import 'dart:io'; - import 'package:angel_route/angel_route.dart'; -import 'package:dart2_constant/convert.dart'; import 'package:http/http.dart' as http; import 'package:test/test.dart'; diff --git a/test/strip_test.dart b/test/strip_test.dart index 955f1bf5..81d98a56 100644 --- a/test/strip_test.dart +++ b/test/strip_test.dart @@ -43,4 +43,4 @@ main() { print('$a => $b'); expect(b, 'a///b//c'); }); -} \ No newline at end of file +} diff --git a/test/wildcard_test.dart b/test/wildcard_test.dart index cae7dc8c..ac83e346 100644 --- a/test/wildcard_test.dart +++ b/test/wildcard_test.dart @@ -18,7 +18,8 @@ void main() { }); test('match if segments before', () { - var result = router.resolveAbsolute('/isnt/she/fierce%20harmonica%solo').first; + var result = + router.resolveAbsolute('/isnt/she/fierce%20harmonica%solo').first; expect(result.handlers, ['lovely']); }); -} \ No newline at end of file +} diff --git a/web/hash/basic.dart b/web/hash/basic.dart index b5ba5e99..080fb07b 100644 --- a/web/hash/basic.dart +++ b/web/hash/basic.dart @@ -2,4 +2,3 @@ import 'package:angel_route/browser.dart'; import '../shared/basic.dart'; main() => basic(new BrowserRouter(hash: true)); - diff --git a/web/push_state/basic.dart b/web/push_state/basic.dart index d889a70d..7a02d2a7 100644 --- a/web/push_state/basic.dart +++ b/web/push_state/basic.dart @@ -2,4 +2,3 @@ import 'package:angel_route/browser.dart'; import '../shared/basic.dart'; main() => basic(new BrowserRouter()); -