lastDocument method

Future<Map<String, dynamic>> lastDocument()

this method depends on the _id property, so if you inserted a custom _id it will sort by your custom _id and this will cause a mis-sorting

Implementation

Future<Map<String, dynamic>> lastDocument() async {
  var selector = where.limit(1).sortBy('_id', descending: true);
  var res = await futureFind(selector);
  return res.first;
}