wiredashio / wiredash-sdk

Interactive user feedback tool for Flutter 🎉
https://pub.dev/packages/wiredash
Other
513 stars 66 forks source link

MaterialApp.router #145

Closed woutervanwijk closed 2 years ago

woutervanwijk commented 3 years ago

I am not able to use Wiredash and the MaterialApp.router at the same time. Wiredash needs the navigatorKey, but MaterialApp.router doesn't use it

Beyga commented 3 years ago

I have the same issue. I am using auto_route package.

franvara commented 3 years ago

I had the same problem because I'm using Beamer to routing. I use navigatorKey: routerDelegate.navigatorKey to fix my error.

  Widget build(BuildContext context) {
    ScreenUtil.init();
    return WiredashApp(
      navigatorKey: routerDelegate.navigatorKey,
      languageCode: "es",
      child: MaterialApp.router(
        debugShowCheckedModeBanner: false,
        title: 'App',
        theme: ThemeData(
          primaryColor: AppColor.vulcan,
          accentColor: AppColor.royalBlue,
          scaffoldBackgroundColor: AppColor.vulcan,
          visualDensity: VisualDensity.adaptivePlatformDensity,
          textTheme: ThemeText.getTextTheme(),
          appBarTheme: const AppBarTheme(elevation: 0),
        ),
        routerDelegate: routerDelegate,
        routeInformationParser: BeamerParser(),
        backButtonDispatcher:
            BeamerBackButtonDispatcher(delegate: routerDelegate),
      ),
    );
  }
Beyga commented 3 years ago

routerDelegate. Where does this value come from?

orestesgaolin commented 3 years ago

You need to provide your own implementation. Some references:

https://levelup.gitconnected.com/flutter-navigator-2-0-for-authentication-and-bootstrapping-part-2-user-interaction-5dc043e7e44a https://medium.com/geekculture/flutter-navigator-2-0-for-authentication-and-bootstrapping-part-5-web-eeb4835804df

my sample https://github.com/orestesgaolin/navigator_20_example

LuNiPriSe commented 2 years ago

Old but maybe still helpful. Solved with:

final _appRouter = AppRouter();
...

child: Wiredash(
          projectId: wireDashProjectId,
          secret: wireDashSecret,
          navigatorKey: _appRouter.navigatorKey,
          child: MaterialApp.router(...
passsy commented 2 years ago

Please try the latest v1.0.0-alpha.4 release. The navigatorKey is not required anymore.

passsy commented 2 years ago

The navigatorKey has now been removed in stable release 1.0.0