LCOV - code coverage report
Current view: top level - lib/src/utils - queued_to_device_event.dart (source / functions) Hit Total Coverage
Test: merged.info Lines: 9 14 64.3 %
Date: 2024-05-13 12:56:47 Functions: 0 0 -

          Line data    Source code
       1             : /*
       2             :  *   Famedly Matrix SDK
       3             :  *   Copyright (C) 2019, 2020 Famedly GmbH
       4             :  *
       5             :  *   This program is free software: you can redistribute it and/or modify
       6             :  *   it under the terms of the GNU Affero General Public License as
       7             :  *   published by the Free Software Foundation, either version 3 of the
       8             :  *   License, or (at your option) any later version.
       9             :  *
      10             :  *   This program is distributed in the hope that it will be useful,
      11             :  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      13             :  *   GNU Affero General Public License for more details.
      14             :  *
      15             :  *   You should have received a copy of the GNU Affero General Public License
      16             :  *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
      17             :  */
      18             : 
      19             : import 'dart:convert';
      20             : 
      21             : class QueuedToDeviceEvent {
      22             :   final int id;
      23             :   final String type;
      24             :   final String txnId;
      25             :   final Map<String, dynamic> content;
      26             : 
      27           2 :   QueuedToDeviceEvent({
      28             :     required this.id,
      29             :     required this.type,
      30             :     required this.txnId,
      31             :     required this.content,
      32             :   });
      33             : 
      34           2 :   factory QueuedToDeviceEvent.fromJson(Map<String, dynamic> json) =>
      35           2 :       QueuedToDeviceEvent(
      36           2 :         id: json['id'],
      37           2 :         type: json['type'],
      38           2 :         txnId: json['txn_id'],
      39             :         // Temporary fix to stay compatible to Moor AND a key value store
      40           4 :         content: json['content'] is String
      41           2 :             ? jsonDecode(json['content'])
      42           2 :             : json['content'],
      43             :       );
      44             : 
      45           0 :   Map<String, dynamic> toJson() => {
      46           0 :         'id': id,
      47           0 :         'type': type,
      48           0 :         'txn_id': txnId,
      49           0 :         'content': content,
      50             :       };
      51             : }

Generated by: LCOV version 1.14