Closed AtlasAutocode closed 1 month ago
Do you run first flutter clean
? I think it could be some remaining file that was left in .dart_tool
and is causing you problems
Similar to the issue in #2009, you need to use conditional import to import packages that's specific to the web, such as web
or non web platforms (e.g., dart:io
)
See usages of this as an example: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/lib/utils/dart_ui
Or Conditional imports in Dart docs.
[!NOTE] You need to test the build on web and non web platforms, since if the conditional inport, which currently is limited to check if the platform is web or not, the compiler won't throw an error when you build the project for web in case the conditional for non web is invalid, which is why the CI build for Web and Linux to avoid such issues in production.
The issue is that you will have to write fake implementation of what you want to access. Loosing the type saftey.
To solve this, I think we need to rely on workarounds for now. A fix probably requires breaking change in Dart 4 unless if I'm missing something.
Do you run first flutter clean? I think it could be some remaining file that was left in .dart_tool and is causing you problems
Ran flutter clean and did not solve the problem.
Similar to the issue in https://github.com/singerdmx/flutter-quill/pull/2009, you need to use conditional import
I'm sorry, I don't understand. This is my clone of the main flutter_quill repository updated to 9.5.20. I am trying to compile the flutter-quill example app (using before_push script). If I modify the build command for windows, it compiles OK, but web does not and gives the missing package error. How do I modify the example app or before_push.sh to cope with web? I could not find any reference to the package in flutter_quill.
How do I modify the example app or before_push.sh to cope with web? I could not find any reference to the package in flutter_quill.
There seems to be an issue with building the app on the web. The issue is coming from flutter_quill
, so changes in before_push
or the example might not be needed. We could bypass this build failure. However, it will cause build issues for developers who build the app for the web.
We need a type safe way to import web or non-web specific packages correctly with conditional imports.
Is there an existing issue for this?
Flutter Quill version
9.5.20
Steps to reproduce
Run before_push.sh cd example flutter build web --release --dart-define=CI=true Fails
Expected results
To be able to compile for web to submit a PR.
Actual results
Target dart2js failed: ProcessException: Process exited abnormally with exit code 1: Error: Couldn't resolve the package 'printing' in 'package:printing/printing_web.dart'. .dart_tool/flutter_build/5cd7aab0e629905740c94de93388d24d/web_plugin_registrant.dart:16:8: Error: Not found: 'package:printing/printing_web.dart' import 'package:printing/printing_web.dart'; ^ .dart_tool/flutter_build/5cd7aab0e629905740c94de93388d24d/web_plugin_registrant.dart:32:3: Error: Undefined name 'PrintingPlugin'. PrintingPlugin.registerWith(registrar); ^^^^^^^^^^^^^^ Error: Compilation failed.
Code sample
Code sample
```dart [Paste your code here] ```Screenshots or Video
Screenshots / Video demonstration
[Upload media here]Logs
Logs
```console [Paste your logs here] ```