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

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

Generated by: LCOV version 1.14