remove method
- ChatItemId itemId
override
Implementation
@override
Future<void> remove(ChatItemId itemId) async {
Log.debug('remove($itemId)', '$runtimeType($id)');
_pagination?.remove(itemId);
for (var e in fragments) {
e.pagination?.remove(itemId);
}
if (dto.value.lastItem?.id == itemId) {
var lastItem = messages.lastWhereOrNull((e) => e.value.id != itemId);
if (lastItem != null) {
dto.value.lastItem = lastItem.value;
dto.lastItemCursor =
(await _driftItems.read(lastItem.value.id))?.cursor;
} else {
dto.value.lastItem = null;
dto.lastItemCursor = null;
}
await _driftChat.upsert(dto);
}
}