The latest version of go_router package now supports this functionality.
To pass data when popping from a screen, you can do this:
context.pop('value');
And to get this value back, your code should look like this:
String? val = await context.pushNamed('secondRoute');
Hope this helps, thank you