I've an issue with a function that I pass as parameter. I dont understand why I've this error 'the parameter '' can't have a 'null' because of its type'
I made a function that Push a new screen in my statefull class (changeAuthScreen). And I call it and my widget function ButtonAuth (onPressed).
CodePudding user response:
The issue raise because of null-safety aware. While the bool is final, you need to make it required like or provide default value .
const AuthScreen({super.key, required this.newUser});
or
const AuthScreen({super.key, this.newUser = false});
Find more about understanding-null-safety
CodePudding user response:
In line 17, you have to add the required keyword:
const AuthScreen({Key? key, required this.newUser}) : super(key);
This will fix the issue.