mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 05:04:35 +00:00
alphabetically sort contacts
This commit is contained in:
parent
dbb2b309ca
commit
786831bcef
1 changed files with 4 additions and 1 deletions
|
@ -20,10 +20,13 @@ class AddressBookService extends ChangeNotifier {
|
||||||
List<Contact> get contacts {
|
List<Contact> get contacts {
|
||||||
final keys = List<String>.from(
|
final keys = List<String>.from(
|
||||||
DB.instance.keys<dynamic>(boxName: DB.boxNameAddressBook));
|
DB.instance.keys<dynamic>(boxName: DB.boxNameAddressBook));
|
||||||
return keys
|
final _contacts = keys
|
||||||
.map((id) => Contact.fromJson(Map<String, dynamic>.from(DB.instance
|
.map((id) => Contact.fromJson(Map<String, dynamic>.from(DB.instance
|
||||||
.get<dynamic>(boxName: DB.boxNameAddressBook, key: id) as Map)))
|
.get<dynamic>(boxName: DB.boxNameAddressBook, key: id) as Map)))
|
||||||
.toList(growable: false);
|
.toList(growable: false);
|
||||||
|
_contacts
|
||||||
|
.sort((a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase()));
|
||||||
|
return _contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Contact>>? _addressBookEntries;
|
Future<List<Contact>>? _addressBookEntries;
|
||||||
|
|
Loading…
Reference in a new issue