I want to use the same instance of a widget in multiple places, changes in one place will be synchronized to another place.
But using the same instance in multiple places looks like multiple different instances.
So how can I achieve the feat?
var test = InAppWebView(
// ...
);
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
children: [
test, // widget one
test, // widget two
],
controller: _pageController,
physics: NeverScrollableScrollPhysics(),
onPageChanged: onPageChanged,
),
),
}
I'm use flutter_inappbrowser.
Widget one and widget two use the same instance, but when I open the web page with widget one, widget two is unaffected.
I want widget one and widget two to be the same widget, that when widget one changes, widget two will also be affected.
keyproperty you can try with same key(im not sure about using same key)