Created
November 21, 2021 12:41
-
-
Save ttlg/4da3cb9ce4cac879ac797ab6a6e8a291 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final sortedTodoListState = StateProvider<List<Todo>?>((ref) { | |
final List<Todo>? todoList = ref.watch(_todoListState); | |
if (ref.watch(_sortOrderState) == SortOrder.ASC) { | |
todoList?.sort((a, b) => a.timestamp.compareTo(b.timestamp)); | |
} else { | |
todoList?.sort((a, b) => b.timestamp.compareTo(a.timestamp)); | |
} | |
return todoList; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment