tneotia / html-editor-enhanced

A Flutter package that provides a WYSIWYG editor backed by flutter_inappwebview and the Summernote library.
https://pub.dev/packages/html_editor_enhanced
MIT License
274 stars 331 forks source link

[BUG] FlutterFlow web version compiles incorrectly #486

Closed tmcneill-stellar closed 9 months ago

tmcneill-stellar commented 9 months ago

Describe the bug When using this in flutterflow it complies with html_editor_mobile.dart instead of the web version. As it tries to load the html files from the mobile version sexport 'package:html_editor_enhanced/src/html_editor_unsupported.dart' if (dart.library.html) 'package:html_editor_enhanced/src/html_editor_web.dart' if (dart.library.io) 'package:html_editor_enhanced/src/html_editor_mobile.dart';

export 'package:html_editor_enhanced/src/html_editor_controller_unsupported.dart' if (dart.library.html) 'package:html_editor_enhanced/src/html_editor_controller_web.dart' if (dart.library.io) 'package:html_editor_enhanced/src/html_editor_controller_mobile.dart';

To Reproduce Add to flutter flow and try to run the web version of it. The console log will show it trying to find the summernote.html which only appears in html_editor_widget_mobile.dart.

Expected behavior It should correctly detect or allow us to manually choose each package.

vadrian89 commented 9 months ago

The use of conditional import is used correctly, from my knowledge. You can read it here: https://dart.dev/guides/libraries/create-packages#conditionally-importing-and-exporting-library-files

Might be something from FlutterFlow.

tmcneill-stellar commented 9 months ago

Thanks, I can try to follow up with FlutterFlow. Someone had posted using this plugin wth flutterflow and the example didn't work so I was investigating.

vadrian89 commented 9 months ago

From the documentation:

The conditional import or export checks only whether the library is available for use on the current platform, not whether it’s actually imported or used.

I'm not sure what could be the problem, but if the app was built with web assembly this might cause the app to load the dart.library.io instead of html. This is just speculation though, as of now, I haven't tried this theory yet.

Another thing to point out, that both html_editor_mobile and html_editor_web files have kIsWeb checks.

This mean, even if the library import fail, the kIsWeb should not.