A quick example to demonstrate how to conditionally import different versions of the seo_renderer widgets that makes it possible to add the seo_renderer widgets also to VM builds. It only returns stubs that don't do anything useful on VM, and only adds the SEO renderer divs on the Web build.
Using a shared abstract class could be nice improvement to ensure they always use the same interface.
The changes might seem big, but are not. I just had to move the content in link_renderer.dart to link_renderer_web.dart and text_renderer.dart to text_renderer_web.dart and make them conditionally import the original file of the "web" version in web builds and the added "_vm" stub version for inclusion in none web builds.
Also added runners for all platforms to the example, so I could try the build on other platforms too.
Now it builds on them too and you can include the seo_renderer on desired widgets also in cross platform projects. It does not add much overhead on VM builds, other than a bit extra "noise" in the tree, but if you need it for your Web cross-platform build, it is well worth the added "noise".
A quick example to demonstrate how to conditionally import different versions of the seo_renderer widgets that makes it possible to add the seo_renderer widgets also to VM builds. It only returns stubs that don't do anything useful on VM, and only adds the SEO renderer divs on the Web build.
Using a shared abstract class could be nice improvement to ensure they always use the same interface.
The changes might seem big, but are not. I just had to move the content in
link_renderer.dart
tolink_renderer_web.dart
andtext_renderer.dart
totext_renderer_web.dart
and make them conditionally import the original file of the "web" version in web builds and the added "_vm" stub version for inclusion in none web builds.Also added runners for all platforms to the example, so I could try the build on other platforms too.
Now it builds on them too and you can include the seo_renderer on desired widgets also in cross platform projects. It does not add much overhead on VM builds, other than a bit extra "noise" in the tree, but if you need it for your Web cross-platform build, it is well worth the added "noise".