iamSahdeep / seo_renderer

A Flutter Web Plugin to display Text Widget as Html for SEO purpose
MIT License
114 stars 15 forks source link

Using seo_renderer with Navigator 2.0 #18

Open gabmagnan opened 2 years ago

gabmagnan commented 2 years ago

Hello,

I'm very interesting by your lib, but i cannot implement it if I use Navigator 2.0.

In my main, i'm using MaterialApp.router(, and there is no observers or navigatorObserver key.

Do you have a solution for that ?

Many thanks

thisismaca commented 2 years ago

I have the same problem and haven't been able to find a workaround.

krokyze commented 2 years ago

It depends on what kind of router implementation you're using? For example auto_route does support passing navigatorObservers into their routerDelegate https://pub.dev/packages/auto_route#navigation-observers

ben55j commented 2 years ago

Hello, I am having the same issue using the auto_route package. It works, but all texts are always displayed twice with a red font.

Here how I have implemented it :

  return Layout(
      child: RobotDetector(
        debug: true, // you can set true to enable robot mode
        child: MaterialApp.router(
          title: StringConst.APP_NAME,
          theme: AppTheme.lightThemeData,
          debugShowCheckedModeBanner: false,
          routerDelegate: _appRouter.delegate(
            navigatorObservers: ()=> [seoRouteObserver],
          ),
          routeInformationParser: _appRouter.defaultRouteParser(),
        ),
      ),
    );

Do you have an example about how to use the package using auto_route ?

Many thanks ! Benjamin

sarah-parker commented 2 years ago

Would also be interested in hearing a resolution, currently using GoRouter

ahmednfwela commented 1 year ago

GoRouter supports passing an observer via its observers property