Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters getList support defaultValue #2031

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lwj1994
Copy link

@lwj1994 lwj1994 commented Aug 7, 2024

generator will generate

queryParams.getList(
                'relationships',
                const [],
              )

but getList dosent support default value.

full code:

@RoutePage()
class AddPalSlipRelationshipPage extends LinjiePage {
  final List<String> relationships;

  const AddPalSlipRelationshipPage(
      {super.key, @QueryParam("relationships") this.relationships = const [],});

  @override
  ConsumerState<ConsumerStatefulWidget> createState() {
    return _SelectRelationshipPage();
  }
}

  static PageInfo page = PageInfo(
    name,
    builder: (data) {
      final queryParams = data.queryParams;
      final args = data.argsAs<AddPalSlipRelationshipRouteArgs>(
          orElse: () => AddPalSlipRelationshipRouteArgs(
                  relationships: queryParams.getList(
                'relationships',
                const [],
              )));
      return AddPalSlipRelationshipPage(
        key: args.key,
        relationships: args.relationships,
      );
    },
  );

@ezamagni
Copy link

ezamagni commented Jan 3, 2025

@Milad-Akarie this PR should be merges ASAP.
It fixes an issue i'm having in migrating a large codebase from auto_route 8.x to version 9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants