From 786831bcef80f10660f8f73d8708e1c57dffd497 Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 7 Nov 2022 08:31:27 -0600 Subject: [PATCH] alphabetically sort contacts --- lib/services/address_book_service.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/services/address_book_service.dart b/lib/services/address_book_service.dart index 6f7d2b9bd..f51eefbba 100644 --- a/lib/services/address_book_service.dart +++ b/lib/services/address_book_service.dart @@ -20,10 +20,13 @@ class AddressBookService extends ChangeNotifier { List get contacts { final keys = List.from( DB.instance.keys(boxName: DB.boxNameAddressBook)); - return keys + final _contacts = keys .map((id) => Contact.fromJson(Map.from(DB.instance .get(boxName: DB.boxNameAddressBook, key: id) as Map))) .toList(growable: false); + _contacts + .sort((a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase())); + return _contacts; } Future>? _addressBookEntries;