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
No registered route was found to handle '/videos/1234'. #26
Comments
Can you share the code where you register / create the routes? |
Yes, sure.
The full file is here. Edit: I am relatively new to flutter so I have a hard time understanding what 'Buildcontext context' is supposed to do and how to use it correctly. |
Will take a look |
I tested here and it seems to be working ok. But, let me shoot over some suggestions to try and if it doesn't work we can take another look. If you're only using one router in your app (which probably most people do) you can try creating a class specifically for routing responsibilities. For example: import 'package:fluro/fluro.dart';
class AppRouter {
static final AppRouter _instance = new AppRouter._internal();
final Router _router = new Router(); // global router
factory AppRouter() {
return _instance;
}
AppRouter._internal();
// singleton
Router router() { return _router; }
void configureRoutes() {
_router.define("/videos/:id", handler: videoDetailHandler);
}
} Then inside your Home() : super() {
final appRouter = new AppRouter();
appRouter.configureRoutes();
appRouter.router().printTree();
}
Adding it to the constructor or Finally, at the point when you want to navigate to the route you can use: new AppRouter().router().navigateTo(context, "/videos/1234"); Let me know how it goes. |
Thanks a lot for your help, will try it out in a few hours and get back to you how it worked. Thanks again! |
I implemented fluro following your advice, but I still have the error "Undefined name 'context'." for the part that manually pushes the route
How do I define the variable and what type of parameter is required? Thanks again for your help! |
Can you share the code again? That's almost certainly a regular dart issue. It means that |
Sure. I already expected it to be a dart issue, but I somehow am unable to fix it. The code is here, and the line in question is 69, where the 'context' in |
Your
If you're new to flutter then I highly recommend jumping on the |
Going to close this issue because it seems like it's working normally. I'll work to expand on the examples a little in the future. |
It works now, thanks a lot for your help! |
I tried to implement routing in my application with fluro, however I had several problems following the 'getting started' guide on Github.
My implementation is rather simple, since the
new GestureDetector( onTap: () { _handleTap(context); }, .... )
is supposed to manually push the route with
void _handleTap(BuildContext context) { router.navigateTo(context, "/videos/1234", transition: TransitionType.native); }
.The router is initialized according to the getting started example, but once I test the app the error
What else is needed in order to push the route, or am I doing something wrong?
The text was updated successfully, but these errors were encountered: