Reputation: 165
I have been developing an app using flutter, which has a bookmark section. In the bookmark page, you can click an entry to a view more page. While in the view more page, there is an option to unbookmark the entry.
Is there a way to communicate between flutter pages? Since, I want to sync the bookmarked entries between pages (in this case unbookmark the entry and updates the bookmark page once navigator pop is used). The initState() only runs once and will not be called on succeeding navigator pops, while didUpdateWidget() seems to inefficient.
Upvotes: 1
Views: 884
Reputation: 7988
Why not provide a method removeFromList(bookmark)
to the ViewMorePage as a constructor attribute.
void removeFromList(bookmark) {
setState(() => bookmarkList.remove(bookmark));
}
The setState
forces the widget to rebuild with the shorter list of bookmarks. Does that help?
Upvotes: 0