Skip to content

Go Router extra in context.push is looking for toJson function #134017

@joseianpatrick

Description

@joseianpatrick

Is there an existing issue for this?

Steps to reproduce

  1. Add custom extra

Screenshot 2023-09-05 at 2 12 36 PM
2. Try to push the new screen and add extra

Screenshot 2023-09-05 at 2 12 47 PM
Like this

Screenshot 2023-09-05 at 2 14 30 PM

  1. Check error

Screenshot 2023-09-05 at 2 14 15 PM

Expected results

It should normally push the extra in new screen

Actual results

It shows an error looking for toJson method

Screenshot 2023-09-05 at 2 15 00 PM

Code sample

Code sample

Future<T?> navPush<T>(
  BuildContext context,
  String name, {
  bool shouldPop = false,
  Object? extra,
}) async {
  if (shouldPop) {
    context.go('/');
  }
  if (extra != null) {
    return context.pushNamed(name, extra: extra);
  }
  context.goNamed(name, extra: extra);

  return null;
}

  navPush(
      context,
      'designList',
      extra: DesignListArguments(
        dpkId: dpk.id,
        isGrid: isGrid,
        designsFilterStore: designsFilterStore,
      ),
    );
        

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output I don't use android studio. does not affect my flutter development.

Screenshot 2023-09-05 at 2 17 28 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions