LCOV - code coverage report
Current view: top level - src - beamer_route_information_parser.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 12 12 100.0 %
Date: 2021-05-15 21:06:48 Functions: 0 0 -

          Line data    Source code
       1             : import 'dart:convert';
       2             : 
       3             : import 'package:flutter/foundation.dart';
       4             : import 'package:flutter/widgets.dart';
       5             : 
       6             : import 'beam_state.dart';
       7             : 
       8             : /// Converts [RouteInformation] to [BeamState] and vice-versa.
       9             : class BeamerRouteInformationParser extends RouteInformationParser<BeamState> {
      10           7 :   @override
      11             :   SynchronousFuture<BeamState> parseRouteInformation(
      12             :       RouteInformation routeInformation) {
      13          14 :     final uri = Uri.parse(routeInformation.location ?? '/');
      14           7 :     return SynchronousFuture(
      15           7 :       BeamState.fromUri(
      16             :         uri,
      17           7 :         data: routeInformation.state == null
      18           6 :             ? {}
      19           1 :             : Map<String, String>.from(
      20           2 :                 json.decode(routeInformation.state as String),
      21             :               ),
      22             :       ),
      23             :     );
      24             :   }
      25             : 
      26           7 :   @override
      27             :   RouteInformation restoreRouteInformation(BeamState beamState) {
      28           7 :     return RouteInformation(
      29          14 :       location: beamState.uri.toString(),
      30          14 :       state: json.encode(beamState.data),
      31             :     );
      32             :   }
      33             : }

Generated by: LCOV version 1.14