-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#7337Labels
P1High-priority issues at the top of the work listHigh-priority issues 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.22Found to occur in 3.22Found to occur in 3.22has 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
What package does this bug report belong to?
go_router
What target platforms are you seeing this bug on?
Android, iOS
Steps to reproduce
Change go_router dependency from version 13.2.2 to 13.2.5 (or 14.1.1)
The router(.dart) call 'GoRouteInformationParser.parseRouteInformationWithDependencies' before redirect.
The method processes the routeInformation:
String newUri = '${routeInformation.uri.origin}/';
This ends in an exception
StateError (Bad state: Origin is only applicable to schemes http and https: anyapp://redirect
The following StateError was thrown while dispatching
I/flutter (31737): │ notifications for GoRouteInformationProvider:
I/flutter (31737): │ Bad state: Origin is only applicable to schemes http and https:
I/flutter (31737): │ anyapp://redirect
Expected results
- Custom scheme doesn't result in bad state
- GoRouterWidgetBuilder should be invoked
Actual results
- Custom scheme do result in bad state
- GoRouterWidgetBuilder is not invoked
Code snippet
parseRouteInformationWithDependencies from version 13.2.5 failing
late final RouteMatchList initialMatches;
if (routeInformation.uri.hasEmptyPath) {
String newUri = '${routeInformation.uri.origin}/';
if (routeInformation.uri.hasQuery) {
newUri += '?${routeInformation.uri.query}';
}
if (routeInformation.uri.hasFragment) {
newUri += '#${routeInformation.uri.fragment}';
}
initialMatches = configuration.findMatch(
newUri,
extra: state.extra,
);
} else {
initialMatches = configuration.findMatch(
routeInformation.uri.toString(),
extra: state.extra,
);
}
if (initialMatches.isError) {
log('No initial matches: ${routeInformation.uri.path}');
}parseRouteInformationWithDependencies from version 13.2.2 working
late final RouteMatchList initialMatches;
initialMatches = configuration.findMatch(
routeInformation.uri.path.isEmpty
? '${routeInformation.uri}/'
: routeInformation.uri.toString(),
extra: state.extra);
if (initialMatches.isError) {
log('No initial matches: ${routeInformation.uri.path}');
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
The GoRouteInformationProvider sending notification was: Instance of 'GoRouteInformationProvider'
════════════════════════════════════════════════════════════════════════════════
I/flutter (31737): ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (31737): │ [error] | 10:06:00 295ms | ══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞═════════════════════
I/flutter (31737): │ The following StateError was thrown while dispatching
I/flutter (31737): │ notifications for GoRouteInformationProvider:
I/flutter (31737): │ Bad state: Origin is only applicable to schemes http and https:
I/flutter (31737): │ elbaapp://redirect?code=dd2b4087-8649-407d-80d2-a2e55b7e75af&state=E-fPQdg0elXTnmRSrL345e1HXJjsSFIT
I/flutter (31737): │
I/flutter (31737): │ When the exception was thrown, this was the stack:
I/flutter (31737): │ #0 _SimpleUri.origin (dart:core/uri.dart:4502:7)
I/flutter (31737): │ #1 GoRouteInformationParser.parseRouteInformationWithDependencies (package:go_router/src/parser.dart:83:47)
I/flutter (31737): │ #2 _RouterState._processRouteInformation (package:flutter/src/widgets/router.dart:749:8)
I/flutter (31737): │ #3 _RouterState._handleRouteInformationProviderNotification (package:flutter/src/widgets/router.dart:767:5)
I/flutter (31737): │ #4 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:433:24)
I/flutter (31737): │ #5 GoRouteInformationProvider.notifyListeners (package:go_router/src/information_provider.dart:134:11)
I/flutter (31737): │ #6 GoRouteInformationProvider._platformReportsNewRouteInformation (package:go_router/src/information_provider.dart:235:5)
I/flutter (31737): │ #7 GoRouteInformationProvider.didPushRouteInformation (package:go_router/src/information_provider.dart:279:5)
I/flutter (31737): │ #8 WidgetsBinding._handlePushRouteInformation (package:flutter/src/widgets/binding.dart:777:26)
I/flutter (31737): │ <asynchronous suspension>
I/flutter (31737): │ #9 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:571:42)
I/flutter (31737): │ <asynchronous suspension>
I/flutter (31737): │ #10 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:603:22)
I/flutter (31737): │ <asynchronous suspension>
I/flutter (31737): │
I/flutter (31737): │ The GoRouteInformationProvider sending notification was:
I/flutter (31737): │ Instance of 'GoRouteInformationProvider'
I/flutter (31737): │ ═════════════════════════════════════════════════════════════════
I/flutter (31737): │
I/flutter (31737): │ Bad state: Origin is only applicable to schemes http and https: elbaapp://redirect?code=dd2b4087-8649-407d-80d2-a2e55b7e75af&state=E-fPQdg0elXTnmRSrL345e1HXJjsSFIT
I/flutter (31737): │ StackTrace: #0 _SimpleUri.origin (dart:core/uri.dart:4502:7)
I/flutter (31737): │ #1 GoRouteInformationParser.parseRouteInformationWithDependencies (package:go_router/src/parser.dart:83:47)
I/flutter (31737): │ #2 _RouterState._processRouteInformation (package:flutter/src/widgets/router.dart:749:8)
I/flutter (31737): │ #3 _RouterState._handleRouteInformationProviderNotification (package:flutter/src/widgets/router.dart:767:5)
I/flutter (31737): │ #4 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:433:24)
I/flutter (31737): │ #5 GoRouteInformationProvider.notifyListeners (package:go_router/src/information_provider.dart:134:11)
I/flutter (31737): │ #6 GoRouteInformationProvider._platformReportsNewRouteInformation (package:go_router/src/information_provider.dart:235:5)
I/flutter (31737): │ #7 GoRouteInformationProvider.didPushRouteInformation (package:go_router/src/information_provider.dart:279:5)
I/flutter (31737): │ #8 WidgetsBinding._handlePushRouteInformation (package:flutter/src/widgets/binding.dart:777:26)
I/flutter (31737): │ <asynchronous suspension>
I/flutter (31737): │ #9 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:571:42)
I/flutter (31737): │ <asynchronous suspension>
I/flutter (31737): │ #10 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:603:22)
I/flutter (31737): │ <asynchronous suspension>
I/flutter (31737): │ }
I/flutter (31737): └──────────────────────────────────────────────────────────────────────────────────────────────────────────────Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.1)
[✓] VS Code (version 1.89.1)
[✓] Connected device (4 available)bqubique and SPodjasek
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues 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.22Found to occur in 3.22Found to occur in 3.22has 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