Comments (14)
Hi @ishchhabra
Perhaps this is similar to #137037 even though the case is not really the same (you can also check it to see if it assembles your case). To confirm this, could you clarify:
- Does the issue occur if you start link A directly but not via link B?
from flutter.
@huycozy While the two seem similar, they are not exactly the same. The issue you mentioned talks about the builder
being triggered twice, whereas this issue talks about even the redirect
(which is mentioned as the workaround in that issue) being triggered twice. No, the issue does not occur if I start the link A directly - in that case, the redirect is only triggered once.
from flutter.
Your sample code has a minor issue (typo?) on /applinks
route path, it should be /applink
to sync with path data on AndroidManifest; otherwise no routes for location
error will occur.
Once I updated it, I got another error below:
I/flutter (15789): /applinks route trigerred
════════ Exception caught by foundation library ════════════════════════════════
The following assertion was thrown while dispatching notifications for GoRouteInformationProvider:
A redirect-only route must redirect to location different from itself.
The offending route: GoRoute#a104f(name: null, path: "/applink", Redirect Only)
'package:go_router/src/parser.dart':
Failed assertion: line 114 pos 18: '!matchList.last.route.redirectOnly'
Then I continued updating the route declaration as:
final _router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (context, state) => const MyHomePage(title: 'Flutter Demo Home Page'),
),
GoRoute(
path: '/applink',
builder: (context, state) => const MyHomePage(title: 'App Link'),
),
],
redirect: (context, state) {
if (state.matchedLocation == '/applink') {
print("/applinks route trigerred");
return '/applink';
}
return null;
},
);
Now I can see the log applinks route trigerred
is printed twice from the output console. But the issue also occurs if I trigger direct link with:
adb shell am start -a android.intent.action.VIEW "http://10.0.2.2:8020/applink"
With this result, this is similar to #137037, right? Please retry with this updated sample code and confirm. If your sample code needs to persist as the original, please update it to pass the error above. Thanks!
from flutter.
My bad, while trying to extract the minimal code from the application where I encountered this, I made some mistakes. I have updated the code. It is similar to the route declaration you mentioned above, but rather than using the global redirect, I added redirect only to the specific route. I also tried the route declaration you mentioned, but in both the cases, i did not see the console print twice on adb shell am start -a android.intent.action.VIEW "http://10.0.2.2:8020/applink"
but only on adb shell am start -a android.intent.action.VIEW "http://10.0.2.2:8020"
. Are there OS or any other differences that could be relevant here as well?
from flutter.
Well, I pulled your latest change on your sample repo and ran it. I see the console printed only one time as expected (in both cases). I checked this on Android 11 emulator as yours (I see it from your flutter doctor ouput).
Demo
Screen.Recording.2024-05-08.at.12.36.40.mp4
Please take a look at my demo to see if there are any different steps.
from flutter.
That is weird. With the code on the sample repo, following is what I see:
windows_recording.mp4
from flutter.
The only different step I can observe between my and your demo is that: you triggered deep link when app was in foreground whilst I did it when app in background. I tried the same steps as yours but only one log is printed (expected).
Could you check go_router
version which is fetched on your end? You can find it on pubspec.lock
file. If you can try checking this without go_router
package to narrow the scope of investigation, it would be appreciated.
from flutter.
go_router:
dependency: "direct main"
description:
name: go_router
sha256: "9e0f7d1a3e7dc5010903e330fbc5497872c4c3cf6626381d69083cc1d5113c1e"
url: "https://pub.dev"
source: hosted
version: "14.0.2"
The go_router
version being pulled in 14.0.2
. Could you elaborate on how I would check this without the go_router
package? I'm not sure where the handler code (print statement) would go in case I'm not using go_router
.
from flutter.
Thanks for the update. I see it's already the latest package version (same to me). You can test it without using go_router
package like this:
Snippet code of route without using go_router
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
// routerConfig: _router,
onGenerateRoute: (settings) {
if (settings.name == '/applink') {
print("/applink route triggered");
return MaterialPageRoute(builder: (context) {
return const MyHomePage(title: 'applink');
});
}
return MaterialPageRoute(builder: (context) {
return const MyHomePage(title: 'Flutter Demo Home Page');
});
},
);
from flutter.
Just tried with the code snippet you provided. The bug also exists without using go_router
from flutter.
Strangely, it only prints once with that same code (without go_router) on my end. I wonder if there is problem with device/emulator. Could you try on another one?
Also, what is your Python version? (I'm using Python 3.11.7
). Could you check if Python server sends twice?
from flutter.
I have exactly the same issue.
from flutter.
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.
from flutter.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
from flutter.
Related Issues (20)
- setUpFlutterEngine function runs slowly HOT 1
- Mac_ios platform_interaction_test_ios is 4.08% flaky
- Mac_ios platform_view_ios__start_up is 3.06% flaky
- [web] Dual compile web apps should be considered two separate apps with separate assets/resources HOT 1
- Mac_x64_ios hot_mode_dev_cycle_ios__benchmark is 3.06% flaky
- Mac_ios color_filter_and_fade_perf_ios__e2e_summary is 2.04% flaky
- Windows build_tests_1_7 is 2.04% flaky
- Mac_ios animated_advanced_blend_perf_ios__timeline_summary is 2.04% flaky
- Focus TextField freezes Linux App HOT 1
- Fatal Exception: PlatformViewWrapper.draw after 3.24.1 update HOT 3
- Web Integration Test hangs till default timeout of 20 minutes on macOS GitHub Actions Runner HOT 3
- [flutter_markdown] RangeError with a particular Markdown input HOT 1
- `MouseRegion` callbacks are triggered unexpectedly on Android when tapped HOT 3
- mac-34 and mac-10 lost external connection from phone device. HOT 1
- mac-24 and mac-9 lost external connection from phone device. HOT 1
- mac-14 lost external connection from phone device. HOT 1
- [tool_crash] FileSystemException: Creation failed, OS Error: The system cannot find the file specified., errno = 2 HOT 1
- Devicelab failure with log output "Failed to codesign" should be marked infra failure HOT 1
- Widget recursion does not provide sufficient error information after crashing. HOT 1
- [go_router] DropdownMenu behind NavigationBar HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter.