LCOV - code coverage report
Current view: top level - types - redux_action.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 10 0.0 %
Date: 2022-03-03 12:16:56 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:freezed_annotation/freezed_annotation.dart';
       2             : 
       3             : import '../../types.dart';
       4             : 
       5             : typedef ReduxActionFromJson = ReduxAction Function(JsonMap json);
       6             : 
       7             : abstract class ReduxAction {
       8             :   JsonMap toJson();
       9             :   String get typeName;
      10             : }
      11             : 
      12           0 : final _fromJsonMap = <String, ReduxActionFromJson>{};
      13             : 
      14             : class ReduxActionConverter implements JsonConverter<ReduxAction?, JsonMap> {
      15           0 :   const ReduxActionConverter();
      16             : 
      17           0 :   @override
      18             :   ReduxAction fromJson(JsonMap json) {
      19           0 :     final fromJson = _fromJsonMap[json['type']];
      20             :     if (fromJson == null) {
      21           0 :       throw Exception('No entry for \'type\' ${json['type']}');
      22             :     }
      23           0 :     return fromJson(json);
      24             :   }
      25             : 
      26           0 :   @override
      27             :   JsonMap toJson(ReduxAction? data) {
      28           0 :     final json = data?.toJson();
      29           0 :     json?['type'] = data?.typeName;
      30           0 :     return json ?? {};
      31             :   }
      32             : }

Generated by: LCOV version 1.13