Repository: flutter
Issue: [go_router] Allow passing arbitrary arguments to RouteSettings as with Navigator
Labels: package,c: proposal,P3,p: go_router,team-go_router,triaged-go_router

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Use case

<!--
     Please tell us the problem you are running into that led to you wanting
     a new feature.

     Is your feature request related to a problem? Please give a clear and
     concise description of what the problem is.

     Describe the alternative solutions you've considered. Is there a package
     on pub.dev/flutter that already solves this?
-->

I have a RouteAnalyticsObserver that uses RouteSettings.arguments to retrieve analytics parameters that were added to the current route. When using Navigator without go_router, the RouteAnalyticsObserver can easily access parameters in a function similar to the following:

```
@override
  void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
    super.didPush(route, previousRoute);
    final name = route.settings.name; 
    final args = route.settings.arguments as Map<String, String?>?;
    AnalyticsProvider.log(name, args);
  }
```
GoRouter supports passing the name, so this issue is only focused on the arguments. In the past, I was able to add as many arguments as I wanted to the RouteSettings(), which would be invisible for the user and could be used for analytics. When using GoRouter, all those params would have to be added to the URL, which is unnecessary and creates overly long URLs that expose sensitive data, e.g.: myapp.com?userid=ID&contactName=NAME&messageId=ID&userScore=SCORE

## Proposal

<!--
     Briefly but precisely describe what you would like Flutter to be able to do.

     Consider attaching something showing what you are imagining:
      * images
      * videos
      * code samples

     Does this have to be provided by Flutter directly, or can it be provided
     by a package on pub.dev/flutter? If so, maybe consider implementing and
     publishing such a package rather than filing a bug.
-->

While GoRouter supports 'extra', extra is not added to the RouteSettings and are not usable for RouteObservers at all. While it would be possible to check if extra is a map and add all string parameters to RouteSettings.arguments, the clean way would be to introduce a Map<String, String> parameter besides extra. 
(This is not an exact proposal, more of a use-case and I'm open to discussion.)

Thanks!

Edit:

 A hacky way to do this, is to edit the following code snippet where the arguments are added to RouteSettings together:

Instead of 

```
arguments: <String, String>{...state.params, ...state.queryParams},
```

it can be replaced with something like:

```
      arguments: <String, String>{
        ...state.params,
        ...state.queryParams,
         if (state.extra is Map<String, String>)
          ...(state.extra as Map<String, String>),
      },
```