New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
conditional import for code base that is also used for mobile? #111
Comments
Flutter doctor -v: [✓] Flutter (Channel beta, v1.17.0, on Mac OS X 10.14.6 18G3020, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) [✓] Chrome - develop for the web [✓] Android Studio (version 3.6) [✓] Connected device (3 available) • No issues found! Error starts like this:
|
You can conditionally switch an import from one URI to another, but you can't conditionally change any code. Luckily there is |
@natebosch thanks!! I needed to add URI.parse() around the input string. Perfect. |
I'm importing the html version like this:
import 'package:web_socket_channel/html.dart';
and then I'm using this call to create the channel:
But when I build for mobile, is there a way to condition this out? I am familiar with using kIsWeb for calls I only want on web, and I have one single code base before this above need to use websockets.
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: