LCOV - code coverage report
Current view: top level - lib/presentation/blocs/mobility/trips - trips_state.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 20 0.0 %
Date: 2020-06-26 11:36:11 Functions: 0 0 -

          Line data    Source code
       1             : part of 'trips_bloc.dart';
       2             : 
       3             : @freezed
       4             : abstract class TripsState with _$TripsState {
       5             :   const factory TripsState({
       6             :     @required bool isLoading,
       7             :     @required bool isError,
       8             :     @required bool isBusLoaded,
       9             :     @required bool isTrainLoaded,
      10             :     @required Direction direction,
      11             :     Exception exception,
      12             :     List<Trip> busTrips,
      13             :     List<Trip> trainTrips,
      14             :   }) = _TripsState;
      15             : 
      16           0 :   factory TripsState.initial([Direction direction = Direction.Aller]) {
      17           0 :     return TripsState(
      18             :       isLoading: false,
      19             :       isError: false,
      20             :       isBusLoaded: false,
      21             :       isTrainLoaded: false,
      22             :       direction: direction,
      23           0 :       busTrips: <Trip>[],
      24           0 :       trainTrips: <Trip>[],
      25             :     );
      26             :   }
      27             : }
      28             : 
      29             : extension TripsStateX on TripsState {
      30           0 :   TripsState busLoaded({
      31             :     List<Trip> busTrips,
      32             :     Direction direction,
      33             :   }) {
      34           0 :     return this.copyWith(
      35             :       isLoading: false,
      36             :       isError: false,
      37             :       isBusLoaded: true,
      38             :       busTrips: busTrips,
      39             :       direction: direction,
      40             :     );
      41             :   }
      42             : 
      43           0 :   TripsState trainLoaded({
      44             :     List<Trip> trainTrips,
      45             :     Direction direction,
      46             :   }) {
      47           0 :     return this.copyWith(
      48             :       isLoading: false,
      49             :       isError: false,
      50             :       isTrainLoaded: true,
      51             :       trainTrips: trainTrips,
      52             :       direction: direction,
      53             :     );
      54             :   }
      55             : 
      56           0 :   TripsState loading() {
      57           0 :     return this.copyWith(
      58             :       isLoading: true,
      59             :       isError: false,
      60             :     );
      61             :   }
      62             : 
      63           0 :   TripsState error(Exception exception) {
      64           0 :     return this.copyWith(
      65             :       isLoading: false,
      66             :       isError: true,
      67             :       isBusLoaded: false,
      68             :       isTrainLoaded: false,
      69             :       exception: exception,
      70             :     );
      71             :   }
      72             : 
      73           0 :   TripsState hideBus() {
      74           0 :     return this.copyWith(
      75             :       isBusLoaded: false,
      76             :     );
      77             :   }
      78             : 
      79           0 :   TripsState hideTrain() {
      80           0 :     return this.copyWith(
      81             :       isTrainLoaded: false,
      82             :     );
      83             :   }
      84             : 
      85           0 :   TripsState hideAll() {
      86           0 :     return this.copyWith(
      87             :       isTrainLoaded: false,
      88             :       isBusLoaded: false,
      89             :     );
      90             :   }
      91             : 
      92           0 :   TripsState changeDirection(Direction direction) {
      93           0 :     return this.copyWith(
      94             :       direction: direction,
      95             :     );
      96             :   }
      97             : }

Generated by: LCOV version 1.13