LCOV - code coverage report
Current view: top level - common - user_action_state.dart Coverage Total Hit
Test: lcov_cleaned.info Lines: 0.0 % 13 0
Test Date: 2025-06-20 10:50:47 Functions: - 0 0

            Line data    Source code
       1              : import 'dart:convert';
       2              : 
       3              : import 'package:flutter_chrome_cast/common/user_action.dart';
       4              : 
       5              : /// Represents the state of a user action in a cast session.
       6              : class UserActionState {
       7              :   ///User actions custom data.
       8              :   final Map<String, dynamic>? customData;
       9              : 
      10              :   /// The user action associated with this state.
      11              :   final UserAction? userAction;
      12              : 
      13              :   /// Creates a new [UserActionState] instance.
      14              :   ///
      15              :   /// [customData] - Custom data associated with the user action.
      16              :   /// [userAction] - The user action.
      17            0 :   UserActionState({
      18              :     this.customData,
      19              :     this.userAction,
      20              :   });
      21              : 
      22              :   /// Converts the [UserActionState] to a map.
      23              :   ///
      24              :   /// Returns a [Map] representation of this object.
      25            0 :   Map<String, dynamic> toMap() {
      26            0 :     return {
      27            0 :       'customData': customData,
      28            0 :       'userAction': userAction?.name,
      29              :     };
      30              :   }
      31              : 
      32              :   /// Creates a [UserActionState] from a map.
      33              :   ///
      34              :   /// [map] - The map to create the instance from.
      35            0 :   factory UserActionState.fromMap(Map<String, dynamic> map) {
      36            0 :     return UserActionState(
      37            0 :       customData: Map<String, dynamic>.from(map['customData']),
      38            0 :       userAction: map['userAction'] != null
      39            0 :           ? UserAction.fromMap(map['userAction'])
      40              :           : null,
      41              :     );
      42              :   }
      43              : 
      44              :   /// Converts the [UserActionState] to a JSON string.
      45              :   ///
      46              :   /// Returns a JSON string representation of this object.
      47            0 :   String toJson() => json.encode(toMap());
      48              : 
      49              :   /// Creates a [UserActionState] from a JSON string.
      50              :   ///
      51              :   /// [source] - The JSON string to create the instance from.
      52            0 :   factory UserActionState.fromJson(String source) =>
      53            0 :       UserActionState.fromMap(json.decode(source));
      54              : }
        

Generated by: LCOV version 2.3.1-1