compareEvents method

bool compareEvents(
  1. EventNotificationModel eventOne,
  2. EventNotificationModel eventTwo
)

checks if eventOne & eventTwo have same tags for group members.

Implementation

bool compareEvents(
    EventNotificationModel eventOne, EventNotificationModel eventTwo) {
  var isDataSame = true;

  // ignore: avoid_function_literals_in_foreach_calls
  eventOne.group!.members!.forEach((groupOneMember) {
    // ignore: avoid_function_literals_in_foreach_calls
    eventTwo.group!.members!.forEach((groupTwoMember) {
      if (groupOneMember.atSign == groupTwoMember.atSign) {
        if (groupOneMember.tags!['isAccepted'] !=
                groupTwoMember.tags!['isAccepted'] ||
            groupOneMember.tags!['isSharing'] !=
                groupTwoMember.tags!['isSharing'] ||
            groupOneMember.tags!['isExited'] !=
                groupTwoMember.tags!['isExited'] ||
            groupOneMember.tags!['lat'] != groupTwoMember.tags!['lat'] ||
            groupOneMember.tags!['long'] != groupTwoMember.tags!['long']) {
          isDataSame = false;
        }
      }
    });
  });

  return isDataSame;
}