This one probably has a very easy answer, but I've been blocked trying to solve this for a while and can't really get it to work.
**problem:**when I call checkBeans() with the input got1Beans on the initState, I still get the initial value (false) for got1Beans. What I need is to be able to update got1Beans = true. Anyone able to sort this beany situation? What am I missing here?
import 'package:flutter/material.dart';
class BeansExample extends StatefulWidget {
@override
_BeansExampleState createState() => _BeansExampleState();
}
class _BeansExampleState extends State<BeansExample> {
bool got1beans = false;
bool got2beans = false;
bool got3beans = false;
bool got4beans = false;
bool got5beans = false;
checkBeans(bool getBeans) {
setState(() {
getBeans = true; //shouldn't it update the input value???
});
}
@override
void initState() {
super.initState();
checkBeans(got1beans); //here I call got1Beans
print(got1beans); //This prints false, need to get true here
}
@override
Widget build(BuildContext context) {
return Container();
}
}