升级Flutter至3.29.3后Web应用构建遭遇dart:ui与dart:ui_web导出冲突的解决咨询
Hi there, sorry to hear you're stuck with this export conflict after upgrading Flutter to 3.29.3! This issue usually pops up when third-party packages haven't been updated to align with Flutter's newer web framework changes—since Flutter 3.16+, there have been tweaks to how dart:ui and dart:ui_web expose shared APIs like debugEmulateFlutterTestEnvironment and platformViewRegistry.
Here are the steps I'd recommend to fix this:
Update your outdated dependencies first
Looking at your pubspec.yaml, several packages are on older versions that might not be compatible with Flutter 3.29.3. Rundart pub outdatedin your terminal to see which packages have available updates. Focus especially on web-related packages likehtml_editor_enhanced(v2.7.0 is quite old) andflutter_dialogs, since they're more likely to interact withdart:ui_webunder the hood. Update these to their latest stable versions and runflutter pub getagain.Clean your project's cache
Sometimes old cached files can cause unexpected conflicts. Try these commands in order:flutter clean- Delete the
pubspec.lockfile from your project root flutter pub get- For web-specific cache issues, run
flutter pub cache repairto fix any corrupted cached packages
Pin or adjust problematic packages (if updates don't help)
If updating a specific package still causes the conflict, check the package's GitHub issues page to see if other users have reported the same problem. If the package is unmaintained, you might need to:- Fork the repository and fix the import issue yourself (look for direct imports of
dart:ui_weband replace them with conditional imports if needed) - Switch to a maintained alternative package that supports newer Flutter versions
- Fork the repository and fix the import issue yourself (look for direct imports of
Verify with a minimal test project
To confirm it's not a project-specific issue, create a new Flutter web project, add your dependencies one by one, and build after each addition. This can help you pinpoint exactly which package is causing the conflict.
Hope these steps get your web app building again smoothly!
内容来源于stack exchange




