I am new to Dart and Flutter and try to append a new item to my ListView. I created a button that increments this.value
but nothing happens. Am I missing an update call on the UI and is this even the correct approach?
Since I return the value of ListView.builder
directly to the caller of build
I am not sure how to get the list to add more items. Thanks a lot!
class MyList extends State<MyList> {
...
int value = 2;
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: this.value,
itemBuilder: (context, index) => this._buildRow(index)
);
TL;DR: Is calling setState
the correct way to trigger an UI update?