I have a Flutter app where users can predict the outcome of a soccer match. The problem is that if the user changes the time on their phone they can still predict even after it has ended. How do I prevent this so that it’s independent of the time on each user’s phone?
Thank you
2
Answers
the solution is to not get the date from the local device, but get it from the firebase
timestamp
that it offers, as example if we say that you want to do it from now until tomorrow at the same time, you can save it to your DB, using:in your case, you need to compare the
Timestamp
we set in the database with:also, you can get a DateTime from a
Timestamp
with this:The safest and most recommended approach for this is to use database rules.
Patiently study this https://fireship.io/snippets/firestore-rules-recipes