Let's say I have the following widget in a dart file (as an example of the problem I am facing):
class MyWidget extends StatelessWidget {
const MyWidget({super.key});
@override
Widget build(BuildContext context) {
return TextField(
onSubmitted: (text) {},
);
}
}
Now, I want to use this MyWidget class in my main dart file, but I also want to be able to use this "text" string in my main dart file when onSubmitted is fired from this widget. How can I do that?