I want to pass a variable name as a function parameter, but it doesn't seem to work : the content of my variable remains unchanged.
Widget Field(String changedValue, String label, bool isTextObscured) {
return TextFormField(
decoration: InputDecoration(labelText: label),
validator: checkFieldEmpty,
onChanged: (value) {
setState(() {
changedValue = value;
});
},
obscureText: isTextObscured,
);
}
Here, I want to change the value of the variable who has the name "changedValue". When I do it directly with the variable name, it works, but when I try to use the parameter, nothing happens. Here's an example of where I used it :
Widget LoginFields() {
return Column(
children: [
Field(email, Strings.emailLabel, false),
Field(password, Strings.passwordLabel, true),
ValidationButton(),
],
);
}
Thanks in advance!