Check textfield for duplicate values in Firestore database

Resolved

Hi all,

I've an app where users are able to create a barcode. I only want unique barcodes to be created and check before creation of the barcode if the same already exists.

Therefore I created the collection "coupon" with the field "barcodeValue". Now if somebody enters a code "1234567" in the field it should check on duplicates and show a snackbar.

What is a scalable solution for a duplicate check for a thousands of barcodes?

I tried this but couldn't get it work.

2 replies