LCOV - code coverage report
Current view: top level - lib/src/utils - sync_update_item_count.dart (source / functions) Coverage Total Hit
Test: merged.info Lines: 100.0 % 26 26
Test Date: 2025-01-14 13:39:53 Functions: - 0 0

            Line data    Source code
       1              : import 'package:matrix/matrix.dart';
       2              : 
       3              : extension SyncUpdateItemCount on SyncUpdate {
       4           31 :   int get itemCount {
       5              :     var count = 0;
       6           93 :     count += accountData?.length ?? 0;
       7          124 :     count += deviceLists?.changed?.length ?? 0;
       8          124 :     count += deviceLists?.left?.length ?? 0;
       9           93 :     count += toDevice?.length ?? 0;
      10           93 :     count += presence?.length ?? 0;
      11           62 :     count += _joinRoomsItemCount;
      12           62 :     count += _inviteRoomsItemCount;
      13           62 :     count += _leaveRoomsItemCount;
      14              :     return count;
      15              :   }
      16              : 
      17           31 :   int get _joinRoomsItemCount =>
      18          124 :       rooms?.join?.values.fold<int>(
      19              :         0,
      20           31 :         (prev, room) =>
      21           31 :             prev +
      22           93 :             (room.accountData?.length ?? 0) +
      23           93 :             (room.state?.length ?? 0) +
      24           93 :             (room.timeline?.events?.length ?? 0),
      25              :       ) ??
      26              :       0;
      27              : 
      28           31 :   int get _inviteRoomsItemCount =>
      29          124 :       rooms?.invite?.values.fold<int>(
      30              :         0,
      31          124 :         (prev, room) => prev + (room.inviteState?.length ?? 0),
      32              :       ) ??
      33              :       0;
      34              : 
      35           31 :   int get _leaveRoomsItemCount =>
      36          124 :       rooms?.leave?.values.fold<int>(
      37              :         0,
      38           31 :         (prev, room) =>
      39           31 :             prev +
      40           93 :             (room.accountData?.length ?? 0) +
      41           93 :             (room.state?.length ?? 0) +
      42           93 :             (room.timeline?.events?.length ?? 0),
      43              :       ) ??
      44              :       0;
      45              : }
        

Generated by: LCOV version 2.0-1