I have been working on a flutter app where the user starts on a stateful widget with a ListView of items from a SQLite database. The user can tap on an item in the list which navigates to a page where the item can be modified and saved.
When Navigator.pop(context) is used, the app returns to the ListView but doesn't rebuild. The changes made do not show until I force a rebuild (hot reload)
This is a new issue in flutter 1.17.
Root view
class ItemsView extends StatefulWidget {
@override
_ItemsView State createState() => _ItemsViewState();
}
class _ItemsViewState extends State<ItemsView> {
@override
Widget build(BuildContext context) {
return FutureBuilder<List<Story>>(
future: DBProvider.db.getAllItems(),
builder: (BuildContext context, AsyncSnapshot<List<Story>> snapshot) {
if (snapshot.hasData) {
return Text(snapshot.data[0])
}
}
)
}
}
Second View
class ModifyView extends StatefulWidget {
@override
_ModifyView State createState() => _ItemsViewState();
}
class _ItemsViewState extends State<ItemsView> {
@override
Widget build(BuildContext context) {
return FutureBuilder<List<Story>>(
future: DBProvider.db.getAllItems(),
builder: (BuildContext context, AsyncSnapshot<List<Story>> snapshot) {
if (snapshot.hasData) {
return Text(snapshot.data[0])
}
}
)
}
}
How can I force the widget to reload?