You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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.
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
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'
errorsIs there any other way to make generated file doesn't import the file with web imports at all?
The text was updated successfully, but these errors were encountered: