I am moving from sql to nosql database,as a part of it I am working on a flutter project where I am implementing a sequence like structure as below.
static Future<int> get nextId async {
return database.get().then((snapshot) {
return snapshot.value;
}).then((value) {
database.set(value + 1);
return value + 1;
});
}
It works, each time i am using nextID it increments in the database. My question is that is it possible when two different users happens to get the same value on invoking nextId.