Open DerJojo11 opened 11 months ago
+1. I'm facing same issue.
Hi @DerJojo11
Have you tried TabsRouterScope
instead of StackRouterScope
?
Hi @ajanec01 !
Better late than never! :D Yes, I tried it out but still got this error message. Hope there will be a solution someday :).
Hey guys!
I need help with writing a widget test when I am using a AutoTabsScaffold. I searched for some examples but there is nearly nothing that explains the Issue i have.
Code example using the AutoTabsScaffold
I have a Widget that is calling the AutoTabs Scaffold. ```dart class HomePage extends StatelessWidget { const HomePage({super.key}); @override Widget build(BuildContext context) { return AutoTabsScaffold( routes: const [ ARoute(), BRoute(), CRoute(), ], bottomNavigationBuilder: (_, tabsRouter) => NavigationBar( selectedIndex: tabsRouter.activeIndex, onDestinationSelected: (index) => tabsRouter.setActiveIndex(index), destinations: BottomNavigation.values .map( (element) => NavigationDestination( icon: Icon(element.icon), label: element.name, ), ) .toList(), ), ); } } ```
In my Widget Test I get the following error:
Right now I am using auto_route: 5.0.4
As I understand, it searches for a RouterData, but cannot find one. Of course, I didn't have one in my Widget Test. So I changed my test according to some approaches:
Example of a widget test with RouteData
```dart testWidgets( 'example test', (tester) async { await tester.pumpWidget( StackRouterScope( controller: MockAppRouter(), stateHash: 0, child: const HomePage(), ), ); }, ); ```
When I run this, I still get the error above.. Maybe I am just dump and cant see the solution, but it would be nice when we can get any documentation about how we can use AutoRoute in WidgetTests.