I want to get the latest model based on createdAt field and I am querying like this:
QuizPath? getLatestQuizPath() {
return _realm
.all()
.query(‘TRUEPREDICATE SORT(createdAt DESC)’)
.firstOrNull;
}
I would expect this to return null when there is no data but the app freezes when I call this and there is no data. When I first add data and then quey, it works. What could be the problem?