能否使用Flutter自带Dart SDK开发AngularDart?是否需单独安装?
Let’s break down your questions clearly—this is a super common point of confusion for folks jumping between Flutter and Dart web frameworks like AngularDart.
1. Is it possible to use Flutter’s bundled Dart SDK for AngularDart?
Technically, you can run AngularDart code with Flutter’s Dart SDK—it’s still a full Dart SDK at its core. But there are big caveats that make this approach far from ideal. The Flutter team maintains a custom branch of Dart that includes patches and optimizations specifically built for Flutter’s runtime (like the Skia rendering engine and Flutter’s widget system). That weird version string you see (2.0.0-dev.35.flutter-290c576264) isn’t a standard Dart release—it’s a Flutter-tailored build.
2. Has Flutter’s Dart SDK been customized for Flutter?
Absolutely. The Dart SDK included with Flutter isn’t identical to the official standalone SDK you’d download for web development. Here’s what makes it unique:
- Flutter-specific patches: It has fixes and optimizations that only matter for Flutter’s mobile/desktop runtime, not web projects.
- Custom versioning: The
.flutter-suffix in the version number marks it as part of Flutter’s release cycle. It maps to a specific commit in the Dart repository, but with Flutter’s modifications applied on top. - Tooling focus: While it includes core Dart tools like
dartandpub, the default setup prioritizes Flutter commands (flutter run,flutter build) over web-focused tools likewebdevordart2js.
3. Should I install a separate Dart SDK for web development?
Yes, this is strongly recommended to avoid environment chaos and version conflicts. Here’s why:
- Dependency compatibility: AngularDart relies on stable, standard Dart SDK releases. Flutter’s Dart version might lag behind or have custom changes that break AngularDart’s build tools or dependencies.
- Clean separation: Keeping two separate SDKs lets you manage Flutter and web projects independently. When you update Flutter, it won’t mess with your web-focused Dart version, and vice versa.
- Tooling consistency: The standalone Dart SDK comes with web-specific tools pre-configured (like
webdev servefor local testing) that work seamlessly with AngularDart—no need to tweak paths or configurations to force Flutter’s SDK to play nice.
If you absolutely need to use Flutter’s SDK temporarily, you’d have to make sure your PATH points to Flutter’s bin/cache/dart-sdk/bin directory when working on AngularDart projects—but this is error-prone and not a sustainable long-term solution.
内容的提问来源于stack exchange,提问作者dedeswim

