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-09-04 20:26:16 Functions: 0 0 -

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

Generated by: LCOV version 1.14