Open
Description
I have a flutter app that should support mobile and web, but compilation fails when building for mobile with errors such as "Dart library 'dart:js_interop' is not available on this platform.".
In my code I import dart:io and web/web and use kIsWeb to call IO methods or web methods.
When compiling for web, importing dart:io does not cause any problem.
I've read about creating a stub file and importing io or web implementations, but my code is sprinkled with kIsWeb checks with tiny bits of code.
Is it really the only way to make this work? How come importing dart:io is fine but web/web is not?
Could this package provide a stub so we can write something like this:
import 'package:web/web_stub.dart' as web
if (dart.library.js_interop) 'package:web/web.dart';
Metadata
Metadata
Assignees
Type
Projects
Status
No status