I was working on a Flutter application and kept receiving this error String in the logcat.
Failed assertion: boolean expression must not be null
Here is the code in question:
@override
Widget build(BuildContext context) {
return Center(
child: ListView(
children: <Widget>[
TextField(
controller: controller,
decoration: InputDecoration(
hintText: "Type in something..."
),
),
RaisedButton(
child: Text("Submit"),
onPressed: () => addString(),
),
Flex(
direction: Axis.vertical,
children: (list_two = null) ? [] :
list_two.map((String s) => Text(s)).toList()
)
],
),
);
}
What is causing the problem?