lulupointu / vrouter

MIT License
202 stars 39 forks source link

VRouterScopeNotFoundException(widgetType: context.widget.runtimeType) #198

Open lenarcikarek opened 2 years ago

lenarcikarek commented 2 years ago

Hi! While running debugging my app, the error bolded below appears. Please, tell me what to do to fix it, because I can't find any solution. Thanks in advance :)

VRouterScopeNotFoundException(widgetType: context.widget.runtimeType)

`static VRouterScopeData of(BuildContext context) { VRouterScopeData? vRouterScope = context.dependOnInheritedWidgetOfExactType();

if (vRouterScope == null) {
  throw VRouterScopeNotFoundException(
      widgetType: context.widget.runtimeType);
}

return vRouterScope;

}`

lulupointu commented 2 years ago

This might be because you try to call context.vRouter.to in a context higher than VRouter. I would need to see more code to understand this precise issue

lenarcikarek commented 2 years ago

There is Vrouter in the Widget tree and it's visible in the context parent, take a look at the screenshot below. Also it has been triggered from VRouter.ScopeState.build method. Zrzut ekranu 2022-07-15 o 08 49 32

lulupointu commented 2 years ago

The exception you have is expected. As you can see it is catched in the catch clause and therefore should not be an issue for your app. I think the reason why your app stop showing you this is because you set your debugger to catch any error, even those which are caught. To prevent this, uncheck "All Exceptions" in the "breakpoints" section of vscode: image