How to disable onTap function when a single click has been clicked. Using flutter
you can make condition like :-
set one bool variable and set it true and when user tap on button set it false if you want to permanently disable use prefrences
bool isClicked = true;
GestureDetector(
onTap: (){
if(isClicked){
isClicked = true;
enter code here
}
}
child: Container(),
)
Checkout below code a simple logic it may help you ,
bool isLoading = false; //global variable
onTap: () {
if(!isLoading)
{
isLoading = true;
try{
FirebaseFirestore.instance.runTransaction((transaction) async {
DocumentSnapshot freshSnap = await transaction.get(document.reference);
await transaction.update(freshSnap.reference, {'votes': freshSnap['votes'] + 1,});
isLoading = false;
});
}catch((e){
isLoading = false
});
}
},