-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
⏳Bot is counting down the days until it unassigns the issueBot is counting down the days until it unassigns the issueP2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.22Found to occur in 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23Found to occur in 3.23has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: solvedIssue is closed as solvedIssue is closed as solved
Description
Steps to reproduce
Run the code sample example.
Expected results
static ListRoute _fromState(GoRouterState state) => ListRoute(
ids: (state.uri.queryParametersAll['ids'] ?? const []).map(int.parse).toList(),
);or
static ListRoute _fromState(GoRouterState state) => ListRoute(
ids: switch(state.uri.queryParametersAll['ids']) {
null => const [],
final ids => ids.map((e) => int.parse(e)).toList(),
},
);Actual results
static ListRoute _fromState(GoRouterState state) => ListRoute(
ids: state.uri.queryParametersAll['ids']?.map(int.parse).toList(),
);Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
part 'main.g.dart';
void main() => runApp(const App());
final GoRouter _router = GoRouter(
routes: $appRoutes,
initialLocation: '/splash',
);
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerConfig: _router,
);
}
}
@TypedGoRoute<ListRoute>(path: '/list')
class ListRoute extends GoRouteData {
const ListRoute({required this.ids});
final List<int> ids;
@override
Widget build(BuildContext context, GoRouterState state) =>
ListScreen(ids: ids);
}
class ListScreen extends StatelessWidget {
const ListScreen({super.key, required this.ids});
final List<int> ids;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('List Example')),
body: Center(child: Text('Ids: $ids')),
);
}
}
@TypedGoRoute<SplashRoute>(path: '/splash')
class SplashRoute extends GoRouteData {
const SplashRoute();
@override
Widget build(BuildContext context, GoRouterState state) => const Splash();
}
class Splash extends StatelessWidget {
const Splash({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Splash')),
body: Center(
child: ElevatedButton(
onPressed: () => const ListRoute(ids: [1,2]).go(context),
child: const Text('List Example'),
),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Version 10.0.22631.3672], locale pt-PT)
• Flutter version 3.22.0 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5dcb86f68f (4 weeks ago), 2024-05-09 07:39:20 -0500
• Engine revision f6344b75dc
• Dart version 3.4.0
• DevTools version 2.34.3
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\Eu\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)
• All Android licenses accepted.
[√] Chrome - develop for the web
• CHROME_EXECUTABLE = C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.22)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
• Visual Studio Build Tools 2019 version 16.11.33130.400
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2023.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)
[√] VS Code, 64-bit edition (version 1.89.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.88.0
[√] Connected device (4 available)
• Redmi Note 9S (mobile) • 14f27be • android-arm64 • Android 12 (API 31)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3672]
• Chrome (web) • chrome • web-javascript • unknown
• Edge (web) • edge • web-javascript • Microsoft Edge 125.0.2535.79
[√] Network resources
• All expected network resources are available.
• No issues found!Maatteogekko
Metadata
Metadata
Assignees
Labels
⏳Bot is counting down the days until it unassigns the issueBot is counting down the days until it unassigns the issueP2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.22Found to occur in 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23Found to occur in 3.23has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: solvedIssue is closed as solvedIssue is closed as solved