I am trying to clean my code by putting different widgets in different files/classes so it's not all inside the same main widget.

So right now I have this:

```dart
MainWidget {
Scaffold {
    body: MyWebView(),
    bottomNavigationBar: MyNavBar(),
}
}

```

Both are stateful widgets.

So now I'm wondering: how can I use methods from `MyWebView` from inside `MyNavBar`?

I've tried `MyWebView.of(context).method()` and even do a middle method inside `MainWidget` to try and call the methods from the parent widget always, but it's always "null". I've seen people mentioning PrivateKeys but many say this is an old way of doing things and I shouldn't rely on that.

So how can I do this?