-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#2275Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 3.0Found to occur in 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1Found to occur in 3.1has 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_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Code for reproduction
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
void main() {
runApp(const App());
}
class App extends StatefulWidget {
const App({Key? key}) : super(key: key);
@override
State<App> createState() => _AppState();
}
class _AppState extends State<App> {
late GoRouter router;
@override
void initState() {
router = GoRouter(
initialLocation: '/auth/login',
debugLogDiagnostics: true,
routes: [
GoRoute(
path: '/',
redirect: (state) => "/auth",
),
GoRoute(
path: '/auth',
builder: (context, state) => const Page(title: '/auth'),
routes: [
GoRoute(
path: 'login',
builder: (context, state) => const Page(title: '/auth/login'),
),
],
),
GoRoute(
path: '/contact',
builder: (context, state) => const Page(title: '/contact'),
),
],
);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerDelegate: router.routerDelegate,
routeInformationParser: router.routeInformationParser,
routeInformationProvider: router.routeInformationProvider,
);
}
}
class Page extends StatelessWidget {
const Page({Key? key, required this.title}) : super(key: key);
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text(title),
),
);
}
}
Demo
Screen.Recording.2022-06-17.at.17.44.44.mov
(at the end I demonstrate that http://localhost:8042/#/contract is a valid route)
Although in the doc it states
The value you provide to initialLocation will be ignored if your app is started using deep linking.
and for deep linking
Support works out of the box for the web, of course, via the address bar.
But in the supplied code the initialLocation has higher precedence than the deep linked /contact
Environment
go_router: ^4.0.0
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.2.1 21D62 darwin-arm, locale en-HU)
• Flutter version 3.0.1 at /users/tamas.harkai/sdk/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fb57da5f94 (4 weeks ago), 2022-05-19 15:50:29 -0700
• Engine revision caaafc5604
• Dart version 2.17.1
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/tamas.harkai/Library/Android/sdk
• Platform android-32, build-tools 31.0.0
• ANDROID_SDK_ROOT = /Users/tamas.harkai/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.68.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.42.0
[✓] Connected device (3 available)
• iPhone 13 (mobile) • 83904662-BE8D-48E4-81CC-D024B365BFEE • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.2.1 21D62 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.115
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
And when I finished writing this, I finally tested with previous version and 3.1.1 :D
rydmike, juanleondev, mariopepe, bizz84, AshishSingh2001 and 6 more
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 3.0Found to occur in 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1Found to occur in 3.1has 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_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version