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: 2024-07-12 20:20:16 Functions: 0 0 -

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

Generated by: LCOV version 1.14