I have a proplem in assigning a sign in future method to onpressed :The argument type 'Future' can't be assigned to the parameter type 'void Function()'.
Asked
Active
Viewed 748 times
-1
-
Can you please add your tried code? – Jitesh Mohite May 29 '20 at 15:36
-
It was solved but thanks anyway – Omar Yacop May 29 '20 at 15:43
1 Answers
4
you have to assign it like this:
onpressed: () => FunctionName()
Because the handler expects a function with no return. So we just call your function inside an anonymous void function.

Benedikt J Schlegel
- 1,707
- 1
- 10
- 23
-
-
-
-
-
@OmarYacop You have to look at the function and see what it is expecting to get, and then pass that. I think you'd really benefit from going through some tutorials on the basics of Flutter/Dart, here is a good basics course video: https://www.youtube.com/watch?v=x0uinJvhNxI – Benedikt J Schlegel May 29 '20 at 15:44