LCOV - code coverage report
Current view: top level - src - transition.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 22 22 100.0 %
Date: 2021-09-09 14:16:36 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:meta/meta.dart';
       2             : 
       3             : /// {@template change}
       4             : /// A [Change] represents the change from one [State] to another.
       5             : /// A [Change] consists of the [currentState] and [nextState].
       6             : /// {@endtemplate}
       7             : @immutable
       8             : class Change<State> {
       9             :   /// {@macro change}
      10           7 :   const Change({required this.currentState, required this.nextState});
      11             : 
      12             :   /// The current [State] at the time of the [Change].
      13             :   final State currentState;
      14             : 
      15             :   /// The next [State] at the time of the [Change].
      16             :   final State nextState;
      17             : 
      18           1 :   @override
      19             :   bool operator ==(Object other) =>
      20             :       identical(this, other) ||
      21           1 :       other is Change<State> &&
      22           3 :           runtimeType == other.runtimeType &&
      23           3 :           currentState == other.currentState &&
      24           3 :           nextState == other.nextState;
      25             : 
      26           1 :   @override
      27           5 :   int get hashCode => currentState.hashCode ^ nextState.hashCode;
      28             : 
      29           1 :   @override
      30             :   String toString() {
      31           3 :     return 'Change { currentState: $currentState, nextState: $nextState }';
      32             :   }
      33             : }
      34             : 
      35             : /// {@template transition}
      36             : /// A [Transition] is the change from one state to another.
      37             : /// Consists of the [currentState], an [event], and the [nextState].
      38             : /// {@endtemplate}
      39             : @immutable
      40             : class Transition<Event, State> extends Change<State> {
      41             :   /// {@macro transition}
      42           5 :   const Transition({
      43             :     required State currentState,
      44             :     required this.event,
      45             :     required State nextState,
      46           1 :   }) : super(currentState: currentState, nextState: nextState);
      47             : 
      48             :   /// The [Event] which triggered the current [Transition].
      49             :   final Event event;
      50             : 
      51           1 :   @override
      52             :   bool operator ==(Object other) =>
      53             :       identical(this, other) ||
      54           1 :       other is Transition<Event, State> &&
      55           3 :           runtimeType == other.runtimeType &&
      56           3 :           currentState == other.currentState &&
      57           3 :           event == other.event &&
      58           3 :           nextState == other.nextState;
      59             : 
      60           1 :   @override
      61             :   int get hashCode {
      62           8 :     return currentState.hashCode ^ event.hashCode ^ nextState.hashCode;
      63             :   }
      64             : 
      65           1 :   @override
      66             :   String toString() {
      67           4 :     return '''Transition { currentState: $currentState, event: $event, nextState: $nextState }''';
      68             :   }
      69             : }

Generated by: LCOV version 1.15