Description
The package fails to compile for Flutter web builds due to export conflicts between dart:ui and dart:ui_web. This issue occurs because both libraries are exported unconditionally in lib/utils/shims/dart_ui_real.dart, which causes namespace collisions as Flutter has migrated web-specific APIs from dart:ui to dart:ui_web.
Environment
- Package version:
html_editor_enhanced: 2.7.1
- Flutter version:
3.35.3 (and likely affects other recent versions)
- Dart SDK:
>=3.7.0
- Platform: Web (Flutter Web)
- Build environment: Both local and CI/CD (GitHub Actions)
Error Messages
'debugEmulateFlutterTesterEnvironment' is exported from both 'dart:ui' and 'dart:ui_web'.
'platformViewRegistry' is exported from both 'dart:ui' and 'dart:ui_web'.
Additional Error
There's also a secondary issue with deprecated API usage in lib/utils/utils.dart:
Error: The getter 'window' isn't defined for the type '_DropdownButtonState<T>'.
final Size size = window.physicalSize;
^^^^^^
Steps to Reproduce
- Create a Flutter web project
- Add
html_editor_enhanced: ^2.7.1 as a dependency (directly or transitively via markdown_widgets)
- Run
flutter build web --release
- Observe compilation failure
Root Cause
As of Flutter 3.x (2025-2026), Flutter has deprecated web-specific APIs in dart:ui and moved them to dart:ui_web. The current implementation in lib/utils/shims/dart_ui_real.dart exports both libraries unconditionally:
Current code (lib/utils/shims/dart_ui_real.dart):
export 'dart:ui';
export 'dart:ui_web';
This causes the symbols platformViewRegistry and debugEmulateFlutterTesterEnvironment to be exported from both libraries, creating ambiguity.
Proposed Solution
Fix 1: Update lib/utils/shims/dart_ui_real.dart to explicitly hide conflicting symbols:
// Copyright 2019 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Hide deprecated symbols from dart:ui that are now in dart:ui_web
// This avoids the "exported from both" conflict
export 'dart:ui' hide platformViewRegistry, debugEmulateFlutterTesterEnvironment;
export 'dart:ui_web';
Fix 2: Update lib/utils/utils.dart to use modern Flutter API:
Add import at the top of the file:
Replace deprecated window.physicalSize usage (around line 1050):
// Before
final Size size = window.physicalSize;
// After
final Size size = ui.PlatformDispatcher.instance.views.first.physicalSize;
Why This Approach Works
The hide directive explicitly excludes the deprecated symbols from dart:ui, allowing dart:ui_web to provide them. This is the recommended Flutter migration pattern for handling this deprecation and:
- ✅ Directly addresses the namespace collision
- ✅ Works consistently across all platforms (web, mobile, desktop)
- ✅ Future-proof: when Flutter removes these symbols from
dart:ui, the hide clause becomes harmless
- ✅ No conditional compilation needed
- ✅ Follows Flutter's deprecation migration best practices
Impact
This issue affects all users building Flutter web applications that depend on html_editor_enhanced version 2.7.1 (and likely earlier versions) with Flutter 3.x+. It completely blocks web builds.
Packages known to be affected:
markdown_widgets (uses html_editor_enhanced as a transitive dependency)
Workaround
Until a new version is released, users can patch the package locally.
References
Thank you for maintaining this package! I'm happy to submit a PR with these fixes if that would be helpful.
Description
The package fails to compile for Flutter web builds due to export conflicts between
dart:uianddart:ui_web. This issue occurs because both libraries are exported unconditionally inlib/utils/shims/dart_ui_real.dart, which causes namespace collisions as Flutter has migrated web-specific APIs fromdart:uitodart:ui_web.Environment
html_editor_enhanced: 2.7.13.35.3(and likely affects other recent versions)>=3.7.0Error Messages
Additional Error
There's also a secondary issue with deprecated API usage in
lib/utils/utils.dart:Steps to Reproduce
html_editor_enhanced: ^2.7.1as a dependency (directly or transitively viamarkdown_widgets)flutter build web --releaseRoot Cause
As of Flutter 3.x (2025-2026), Flutter has deprecated web-specific APIs in
dart:uiand moved them todart:ui_web. The current implementation inlib/utils/shims/dart_ui_real.dartexports both libraries unconditionally:Current code (
lib/utils/shims/dart_ui_real.dart):This causes the symbols
platformViewRegistryanddebugEmulateFlutterTesterEnvironmentto be exported from both libraries, creating ambiguity.Proposed Solution
Fix 1: Update
lib/utils/shims/dart_ui_real.dartto explicitly hide conflicting symbols:Fix 2: Update
lib/utils/utils.dartto use modern Flutter API:Add import at the top of the file:
Replace deprecated
window.physicalSizeusage (around line 1050):Why This Approach Works
The
hidedirective explicitly excludes the deprecated symbols fromdart:ui, allowingdart:ui_webto provide them. This is the recommended Flutter migration pattern for handling this deprecation and:dart:ui, the hide clause becomes harmlessImpact
This issue affects all users building Flutter web applications that depend on
html_editor_enhancedversion 2.7.1 (and likely earlier versions) with Flutter 3.x+. It completely blocks web builds.Packages known to be affected:
markdown_widgets(useshtml_editor_enhancedas a transitive dependency)Workaround
Until a new version is released, users can patch the package locally.
References
Thank you for maintaining this package! I'm happy to submit a PR with these fixes if that would be helpful.