LCOV - code coverage report
Current view: top level - src/vroute_elements - vroute_element_with_page.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 15 15 100.0 %
Date: 2021-03-18 15:42:40 Functions: 0 0 -

          Line data    Source code
       1             : part of '../main.dart';
       2             : 
       3             : /// If the VRouteElement does have a page to display, it should instantiate this class
       4             : ///
       5             : /// What is does is:
       6             : ///     - Requiring attributes [path], [name], [aliases], [widget] and [mustMatchStackedRoutes]
       7             : ///     - Computing attributes [pathRegExp], [aliasesRegExp], [pathParametersKeys],
       8             : ///                                                          [aliasesParameters] and [stateKey]
       9             : ///     - implementing [build] and [getPathFromName] methods for them
      10             : @immutable
      11             : abstract class VRouteElementWithPage extends VRouteElementWithPath {
      12             :   final Widget widget;
      13             : 
      14          12 :   VRouteElementWithPage({
      15             :     required String? path,
      16             :     required this.widget,
      17             :     required String? name,
      18             :     required List<VRouteElement> stackedRoutes,
      19             :     required List<String> aliases,
      20             :     required bool mustMatchSubRoute,
      21          12 :   }) : super(
      22             :           path: path,
      23             :           name: name,
      24             :           stackedRoutes: stackedRoutes,
      25             :           aliases: aliases,
      26             :           mustMatchSubRoute: mustMatchSubRoute,
      27             :         );
      28             : 
      29             :   /// [entirePath] is the entire path given (in push for example)
      30             :   ///
      31             :   /// [parentRemainingPath] is the part of the path which is left to match
      32             :   /// after the parent [VRouteElement] matched the [entirePath]
      33             :   /// WARNING: [parentRemainingPath] is null if the parent did not match the path
      34             :   /// in which case only absolute path should be tested.
      35          10 :   VRoute? buildRoute(
      36             :     VPathRequestData vPathRequestData, {
      37             :     required String? parentRemainingPath,
      38             :     required Map<String, String> parentPathParameters,
      39             :   }) {
      40          10 :     VRoute? vRouteElementWithPathVRoute = super.buildRoute(vPathRequestData,
      41             :         parentRemainingPath: parentRemainingPath, parentPathParameters: parentPathParameters);
      42             : 
      43             :     // If the path did match, we add the page in the list of pages
      44             :     if (vRouteElementWithPathVRoute != null) {
      45          10 :       return VRoute(
      46          10 :         vRouteElementNode: vRouteElementWithPathVRoute.vRouteElementNode,
      47          10 :         pages: [
      48          10 :               buildPage(
      49          10 :                 widget: widget,
      50             :                 vPathRequestData: vPathRequestData,
      51          10 :                 pathParameters: vRouteElementWithPathVRoute.pathParameters,
      52          10 :                 vRouteElementNode: vRouteElementWithPathVRoute.vRouteElementNode,
      53             :               )
      54          10 :             ] +
      55          10 :             vRouteElementWithPathVRoute.pages,
      56          10 :         pathParameters: vRouteElementWithPathVRoute.pathParameters,
      57          10 :         vRouteElements: vRouteElementWithPathVRoute.vRouteElements,
      58             :       );
      59             :     }
      60             : 
      61             :     // Else return null
      62             :     return null;
      63             :   }
      64             : 
      65             :   Page buildPage({
      66             :     required Widget widget,
      67             :     required VPathRequestData vPathRequestData,
      68             :     required pathParameters,
      69             :     required VRouteElementNode vRouteElementNode,
      70             :   });
      71             : }

Generated by: LCOV version 1.14