i have an Elevated button for sign in anonymously. When i click the button it creates an user id automaticly and routes to home page but if i spam it untill home page comes to screen it creates many different user ids. i want the button to be unclickable after clicking once how can i do that? When i try this way i get error The argument type 'Future Function()?' can't be assigned to the parameter type 'void Function()' because 'Future Function()?' is nullable and 'void Function()' isn't.
MyElevatedButton(
child: Text('Sign In Anonymously'),
color: Colors.yellowAccent,
onPressed: _isLoading
? null
: () async {
setState(() {
_isLoading = true;
});
final user =
await Provider.of<Auth>(context, listen: false)
.signInAnonymously();
},
),