Open esDotDev opened 1 month ago
Hi @esDotDev, thank you for opening this issue! If I see it correctly, conditional imports are not that well supported by Dart, but according to this article (and others), you can do something like this:
import "something.dart" if (dart.library.io) "other.dart"
Maybe you can try to integrate that into your app already, I will also have a look into adding this to the package so that the dev experience will be improved :)
Thanks for looking at this! Yes I think it is probably possible to do with conditional compilation downstream, but it's a bit involved as you would need to make dummy classes for every public datatype and method.
We're actually relying on a package that depends on yours (flutter_hue), so it's maybe even trickier to deal with conditionally, as flutter_hue
has many types we consume on the client side.
I'm not sure that there is anything you can do here, but just thought we'd ask :)
We have an app that is targeting iOS and Android, but it runs in test mode in the browser. When running in the browser we would use mock data and never call the DTLS API directly. Like:
Currently when trying to run on web, if the package is imported at all, we get an error and can not build the application:
I know we could maybe do some sort of conditional compilation on the app side, but it would be a much nicer dev UX if the package could handle it. Is this even possible?