gpt4 book ai didi

dart - 使用package:http/browser_client.dart会引起有关镜像的警告

转载 作者:行者123 更新时间:2023-12-03 02:51:20 24 4
gpt4 key购买 nike

在dart import 'package:http/browser_client.dart';中执行以下导入会在执行pub build时引起警告

****************************************************************
* WARNING: dart:mirrors support in dart2js is experimental,
* and not recommended.
* This implementation of mirrors is incomplete,
* and often greatly increases the size of the generated
* JavaScript code.
*
* Your app imports dart:mirrors via:
* index.html_bootstrap.dart => package:myapp => package:http => dart:mirrors
*
* Starting with Dart 1.9, you must use the
* --enable-experimental-mirrors command-line flag to opt-in.
* You can begin using this flag now if mirrors support is critical.
*
* To learn what to do next, please visit:
* http://dartlang.org/dart2js-reflection
****************************************************************

[Warning from Dart2JS on myapp|web/index.html_bootstrap.dart]:
3 hint(s) suppressed in package:http.
[Dart2JS on myapp|web/index.html_bootstrap.dart]:
5 warning(s) suppressed in package:myapp.
[Warning from Dart2JS]:
web/index.html_bootstrap.dart:
1 methods retained for use by dart:mirrors out of 2361 total methods (0%).
[Info from Dart2JS on myapp|web/index.html_bootstrap.dart]:
packages/http/src/io.dart:9:1:
Import of 'dart:mirrors'.
import 'dart:mirrors';
^^^^^^^^^^^^^^^^^^^^^^

使用该browser_client的代码是:
var client = new BrowserClient();
client.post(url, body: req.toString())...

这是我应该关注的事情吗,或者这是除非我停止使用http包就不会消失的讨厌警告之一?

更新:

在browser_client.dart内部,我看到以下评论:
// TODO(nweiz): Move this under src/, re-export from lib/http.dart, and use this
// automatically from [new Client] once we can create an HttpRequest using
// mirrors on dart2js (issue 18541) and dart2js doesn't crash on pkg/collection
// (issue 18535).

更新:

运行pub help,我看不到这样的标志:
pub help
Pub is a package manager for Dart.

Usage: pub <command> [arguments]

Global options:
-h, --help Print this usage information.
--version Print pub version.
--[no-]trace Print debugging information when an error occurs.
--verbosity Control output verbosity.

[all] Show all output including internal tracing messages.
[io] Also show IO operations.
[normal] Show errors, warnings, and user messages.
[solver] Show steps during version resolution.

-v, --verbose Shortcut for "--verbosity=all".

Available commands:
build Apply transformers to build a package.
cache Work with the system cache.
deps Print package dependencies.
downgrade Downgrade the current package's dependencies to oldest versions.
get Get the current package's dependencies.
global Work with global packages.
help Display help information for Pub.
publish Publish the current package to pub.dartlang.org.
run Run an executable from a package.
serve Run a local web development server.
upgrade Upgrade the current package's dependencies to latest versions.
uploader Manage uploaders for a package on pub.dartlang.org.
version Print pub version.

直接调用它,pub告诉我没有这样的标志:
 pub build --enable-experimental-mirrors
Could not find an option named "enable-experimental-mirrors".

最佳答案

当您添加标志告诉您添加时,它将消失:--enable-experimental-mirrors
如消息所示,镜像当前使生成的JavaScript的大小膨胀。由于开发人员正确地期望dart2js正确处理此问题,因此这常常使开发人员不知道。但是,这是dart2js要解决的重要问题。尽管正在研究更好的解决方案,但镜像支持被认为是实验性的,此警告旨在通知开发人员使用它们所涉及的潜在问题。

您可以添加标志,以表明您知道镜像问题,并且无论如何都选择使用它们。

关于dart - 使用package:http/browser_client.dart会引起有关镜像的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27849066/

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