Is it possible to make web only injection?
I've separated the environments by web and mobile. Both my WebDownloader and MobileDownloader are registered as ImageDownloader(abstract class). But since WebDownloader's file has dart:js and dart:html imports, app throws:
Error: Not found: 'dart:html' errors
Is there any other way to make generated file doesn't import the file with web imports at all?
This has to be done compile time, you have 2 ways (afaik):
- use conditional import, explained for example here
- create plugin, you will have a package for each platform you want to support with the platform specific code (can also be Dart only) and then one main package with the abstract interface. Compiler will then use the correct platform package.
First way is simpler for things like single class, but I think you will have to name those classes the same (you cannot have one named Mobile and the other Web I believe). With the second way wou'll have much more flexibility, but might be overkill for your need.
use https://pub.dev/packages/universal_html?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions