gpt4 book ai didi

webstorm - 无法同时运行 Dart2 w/Angular for web 和 Flutter for mobile 项目 - 计划共享代码

转载 作者:IT王子 更新时间:2023-10-29 06:38:51 28 4
gpt4 key购买 nike

我在移动应用上使用 Flutter 取得了很好的进展。当前使用:

[✓] Flutter(Channel master,v0.3.1-pre.13,Mac OS X 10.13.4 17E199,语言环境 en-US)

• Flutter version 0.3.1-pre.13 at /Users/golftocs/PhpstormProjects/flutter

• Framework revision 85be28d36b (32 hours ago), 2018-04-16 14:02:07 -0700

• Engine revision 76cb311d9c

• Dart version 2.0.0-dev.47.0.flutter-f76dad0adc

[✓] Android 工具链 - 为 Android 设备开发 (Android SDK 27.0.1)

• Android SDK at /Users/golftocs/Library/Android/sdk

• Android NDK location not configured (optional; useful for native profiling support)

• Platform android-27, build-tools 27.0.1

• ANDROID_HOME = /Users/golftocs/Library/Android/sdk

• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java

• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

• All Android licenses accepted.

[✓] iOS 工具链 - 为 iOS 设备开发 (Xcode 9.3)

• Xcode at /Applications/Xcode.app/Contents/Developer

• Xcode 9.3, Build version 9E145

• ios-deploy 1.9.2

• CocoaPods version 1.5.0

[✓] Android Studio(3.1 版)

• Android Studio at /Applications/Android Studio.app/Contents

• Flutter plugin version 23.1.2

• Dart plugin version 173.4700

• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[!] 连接的设备

! No devices available

现在我想开始一个项目,该项目使用此 Flutter 移动设备设置并与 Dart2/Angular 网络应用程序共享代码。我无法让 Web 应用程序成功运行。我克隆了 https://github.com/angular-examples/toh-5并基于运行“pub get”返回:

Overriding the upper bound Dart SDK constraint to <=2.0.0- 
edge.0d5cf900b021bf5c9fa593ffa12b15bcd1cc5fe0 for the following packages:



archive, args, barback, bazel_worker, boolean_selector, build_barback,
build_config, build_modules, charcode, cli_util, code_transformers,
convert, crypto, csslib, dart_style, fixnum, front_end, glob, graphs,
html, http, http_multi_server, http_parser, intl, io, isolate, js,
json_annotation, kernel, logging, matcher, meta, multi_server_socket,
node_preamble, package_config, package_resolver, path, plugin, pool,
protobuf, pub_semver, quiver, quiver_hashcode, shelf,
shelf_packages_handler, shelf_static, shelf_web_socket,
source_map_stack_trace, source_maps, source_span, stack_trace,
stream_channel, string_scanner, term_glyph, test, tuple, typed_data, yaml

然后,当我从终端运行“pub run build_runner serve”时,我得到:

[INFO] Generating build script completed, took 446ms

[INFO] Setting up file watchers completed, took 25ms

[INFO] Waiting for all file watchers to be ready completed, took 199ms

[INFO] Building new asset graph completed, took 921ms

[INFO] Checking for unexpected pre-existing outputs. completed, took 2ms

[SEVERE] build_web_compilers|ddc on package:angular_router/src/url.module:


ProcessException: No such file or directory

Command: /Users/golftocs/PhpstormProjects/flutter/bin/cache/dart-sdk/bin/dartdevc --persistent_worker

[WARNING] build_web_compilers|entrypoint on web/main.dart:

Unable to read angular_router|lib/src/url.ddc.js, check your console or the `.dart_tool/build/generated/angular_router/lib/src/url.ddc.js.errors` log file.

[SEVERE] build_web_compilers|ddc on package:angular_router/src/location/platform_location.module:


ProcessException: No such file or directory

Command: /Users/golftocs/PhpstormProjects/flutter/bin/cache/dart-sdk/bin/dartdevc --persistent_worker

[WARNING] build_web_compilers|entrypoint on web/main.dart:

Unable to read angular_router|lib/src/location/platform_location.ddc.js, check your console or the `.dart_tool/build/generated/angular_router/lib/src/location/platform_location.ddc.js.errors` log file.

...

此外,我使用的是 WebStorm,实际上是 PHPStorm,并且指向“获取依赖项、升级...”的 Pub 操作链接不起作用。我只能从终端执行。

我的愿望是:1) 类似于https://github.com/apptreesoftware/letsvote/blob/master/README.md 的移动和网络共享代码2) 使用 Angular5.0.0-alpha 和当前的 Flutter 主 channel 运行最新的 Dart23) WebStorm IDE 与组合项目中的任何一个无缝协作

谢谢。

最佳答案

shared_code
|- flutter_project
|- angular_project

flutter_projectangular_project 都将 shared-code 作为 pubspec.yaml 的依赖项>

dependencies:
shared_code:
path: ../shared_code

假设目录结构如下

my_project/shared_code
my_project/flutter_project
my_project/angular_project

shared_code 中的代码不能以任何方式依赖于 dart:ioflutter:ui 否则它不会与任何一个一起工作flutter_projectangular_project

如果您想在同一窗口中的 IntelliJ 中同时打开所有 3 个,将它们全部作为模块添加到一个项目中对我来说很有效。当我在 Angular 项目上工作时,我需要将 Dart 插件中的 Dart SDK 切换到 Dart SDK,当我在 Flutter 项目上工作时,我需要将其切换到 Flutter Dart SDK,否则无法运行应用程序和测试。

您还可以在其自己的 IntelliJ 窗口中打开每个项目,这会单独保留每个窗口的设置,并且不需要根据您当前使用的代码进行切换。

关于webstorm - 无法同时运行 Dart2 w/Angular for web 和 Flutter for mobile 项目 - 计划共享代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49907296/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com