I’m trying to make a registration/sign-up process in my Flutter application where the users will need to enter their Voter ID along with other information in order to be registered into the system. I want the Voter ID to be a unique value (like Primary Key in RDBMS) and prevent the user if they try to register using the Voter ID that has already been taken by another registered user. How can I achieve this?
2
Answers
You’ll want to use the voter ID as the key/ID for identifying the user data in the database in that case.
If you’re using the Realtime Database, that’d look something like:
If you’re using Cloud Firestore, you’d use the same values as the document ID with your
Users
collection.Firebase Cloud Firestore
You have to save all Unique ids while registration and before registration run a query to search that unique id is already registered or not.