Skip to content

Commit

Permalink
fix: updated contacts comparision
Browse files Browse the repository at this point in the history
  • Loading branch information
Sardar1208 committed Oct 27, 2023
1 parent d828bfc commit e219d53
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:at_contacts_flutter/models/contact_base_model.dart';
import 'package:at_contacts_flutter/utils/init_contacts_service.dart';
import 'package:at_contacts_flutter/utils/text_strings.dart';
import 'package:at_lookup/at_lookup.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

/// A service to handle CRUD operation on contacts
Expand Down Expand Up @@ -135,14 +136,17 @@ class ContactService {
try {
/// if contact list is already present, data is not fetched again
if (baseContactList.isNotEmpty) {
List<AtContact?> tempBaseContacts =
baseContactList.map((e) => e.contact).toList();
baseContactList.sort((a, b) {
int? index = a.contact?.atSign
.toString()
.substring(1)
.compareTo((b.contact?.atSign).toString().substring(1));
return index ?? 0;
});
if (baseContactList.length == contactList.length) {
var res = listEquals(tempBaseContacts, contactList);
if (res == true) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
contactSink.add(baseContactList);
});
Expand Down

0 comments on commit e219d53

Please sign in to comment.