i have a stateless Widget and in it a textfield, now I am storing the onChanged value of the textfield in a variable String? newValue;
because it's a stateless widget, I must mark it as final, however, if it's marked final, then I can't use it as a setter, to do,
onChanged: (value) {
newValue = value;
}
what I did was I put it in the build()
method, so
Widget build(BuildContext context) {
String? newValue;
return Container();
}
now I can use it as a setter, OR SO I THOUGHTTTT