How do you check the last element in a list view?

You can check the length of list and get item for that index and compare list item when matches then perform your desired action.

To simply this u can use Get last item block from ListUtilz extension.