Skip to content

Commit

Permalink
Fix: links
Browse files Browse the repository at this point in the history
  • Loading branch information
AmosHuKe committed Mar 7, 2024
1 parent 441f98d commit e867ed2
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 29 deletions.
10 changes: 5 additions & 5 deletions src/content/articles/libraries/creating-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ You can also pause while listening or stop listening to the stream
before it is complete.

dart:async 库中有两个类型,它们对许多 Dart API 来说都非常重要:
[Stream]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/Stream-class.html)
[Future]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/Future-class.html)
[Stream]({{site.dart-api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/Stream-class.html)
[Future]({{site.dart-api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/Future-class.html)
Future 用于表示单个运算的结果,而 Stream 则表示多个结果的序列。
你可以监听 Stream 以获取其结果(包括数据和错误)或其关闭事件。
也可以在 Stream 完成前对其暂停或停止监听。
Expand Down Expand Up @@ -175,7 +175,7 @@ transformers provided by the dart:convert library.
通常而言,使用各种转换方法足以满足你简单的使用需求。
但是,如果你需要对转换进行更多的控制,
你可以使用 `Stream` 类的 `transform()` 方法指定一个
[StreamTransformer]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/StreamTransformer-class.html)
[StreamTransformer]({{site.dart-api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/StreamTransformer-class.html)
Dart 平台库为许多常见的任务需求提供了 Stream 转换器。
例如下面的代码使用了由 dart:convert 库提供的
`utf8.decoder``LineSplitter` 转换器。
Expand Down Expand Up @@ -319,7 +319,7 @@ to create and populate the stream.
如果你 Stream 的事件不仅来自于异步函数可以遍历的 Stream 和 Future,
还来自于你程序的不同部分,这种情况使用上述两种方式生成 Stream 就显得比较困难。
面对这种情况,我们可以使用一个
[StreamController]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/StreamController-class.html)
[StreamController]({{site.dart-api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/StreamController-class.html)
来创建和填充 Stream。

A `StreamController` gives you a new stream
Expand Down Expand Up @@ -623,7 +623,7 @@ keep these tips in mind:
使用同步控制器时要小心。
例如,使用 `StreamController(sync: true)` 构造方法创建控制器。
当你发送一个事件到一个未暂停的同步控制器
(例如:使用 [EventSink]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/EventSink-class.html)
(例如:使用 [EventSink]({{site.dart-api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/EventSink-class.html)
中定义的 `add()``addError()``close()` 方法),
事件立即发送给所有 Stream 的监听器。
在添加监听器的代码返回之前,决不能调用 `Stream` 监听器,
Expand Down
2 changes: 1 addition & 1 deletion src/content/effective-dart/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Using a doc comment instead of a regular comment enables
[`dart doc`][] to find it
and generate documentation for it.

使用文档注释可以让 [dartdoc][] 来为你生成代码 API 文档。
使用文档注释可以让 [`dart doc`][] 来为你生成代码 API 文档。

<?code-excerpt "docs_good.dart (use-doc-comments)"?>
```dart tag=good
Expand Down
2 changes: 1 addition & 1 deletion src/content/get-dart/archive/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and the [Dart API documentation.]({{site.dart-api}}/{{site.sdkInfo.channel}})

你可以在此页面下载 [特定版本](/get-dart#release-channels)
[Dart SDK](/tools/sdk)
[Dart API 文档](({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}))
[Dart API 文档](({{site.dart-api}}/{{site.data.pkg-vers.SDK.channel}}))

Want to install Dart with your OS's package manager?
[Get Dart.](/get-dart)
Expand Down
2 changes: 1 addition & 1 deletion src/content/guides/language/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The Dart 2 language specification is available in PDF format:

* [Formal specification (Dart 2.10)][2-10 formal spec]

[正式的规范文档 (Dart 2.10 版本)][formal spec]
[正式的规范文档 (Dart 2.10 版本)][2-10 formal spec]

[2-10 formal spec]: /guides/language/specifications/DartLangSpec-v2.10.pdf

Expand Down
11 changes: 6 additions & 5 deletions src/content/guides/libraries/create-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ Package 的最基本要求包括:

pubspec file
<br> The `pubspec.yaml` file for a library is the same
as for an [application package]][]—there is no special
as for an [application package][]—there is no special
designation to indicate that the package is a library.

pubspec 文件
<br> Package 的 `pubspec.yaml` 文件与应用程序的
`pubspec.yaml` 文件相同&mdash; `pubspec.yaml`
<br> Package 的 `pubspec.yaml` 文件与
[应用程序的 `pubspec.yaml` 文件][application package]
相同&mdash; `pubspec.yaml`
文件中并没有特别的指出这个 Package 是一个库。

lib directory
Expand All @@ -84,7 +85,7 @@ lib 目录

[application package]: /tools/pub/glossary#application-package

## Organizing a library package
## Organizing a package

## 组织 Package 的代码结构

Expand Down Expand Up @@ -401,7 +402,7 @@ the [`dart doc`][] tool.
[documentation comments](/effective-dart/documentation#doc-comments),
which use the `///` syntax:

使用 [dartdoc][] 可以为 Library 生成 API 文档。
使用 [`dart doc`][] 可以为 Library 生成 API 文档。
dartdoc 解析源文件去查找使用 `///` 语法标注的
[文档注释](/effective-dart/documentation#doc-comments)

Expand Down
166 changes: 166 additions & 0 deletions src/content/guides/libraries/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
---
title: Dart's core libraries
description: Learn about Dart's core libraries and APIs.
short-title: Core libraries
nextpage:
url: /libraries/dart-core
title: dart:core
---

<style>
th:first-child {
width: 80%;
}
</style>

Dart has a rich set of core libraries that provide essentials for many everyday
programming tasks such as
working on collections of objects (`dart:collection`),
making calculations (`dart:math`),
and encoding/decoding data (`dart:convert`).
Additional APIs are available in
[commonly used packages](/guides/libraries/useful-libraries).

## Library tour

The following guides cover how to use major features of Dart's core libraries.
They provide just an overview, and are by no means comprehensive.
Whenever you need more details about a library or its members,
consult the [Dart API reference.][Dart API]

[dart:core](/libraries/dart-core)
: Built-in types, collections, and other core functionality.
This library is automatically imported into every Dart program.

[dart:async](/libraries/dart-async)
: Support for asynchronous programming, with classes such as Future and Stream.

[dart:math](/libraries/dart-math)
: Mathematical constants and functions, plus a random number generator.

[dart:convert](/libraries/dart-convert)
: Encoders and decoders for converting between different data representations,
including JSON and UTF-8.

[dart:io](/libraries/dart-io)
: I/O for programs that can use the Dart VM,
including Flutter apps, servers, and command-line scripts.

[dart:html](/libraries/dart-html)
: DOM and other APIs for browser-based apps.


As mentioned, these pages are just an overview;
they cover only a few dart:* libraries
and no third-party libraries.

For an overview of all libraries that Dart supports on different platforms,
check out the [Multi-platform libraries](#multi-platform-libraries),
[Native platform libraries](#native-platform-libraries), and
[Web platform libraries](#web-platform-libraries) lists below.

Other places to find library information are the
[pub.dev site]({{site.pub}}) and the
[Dart web developer library guide][webdev libraries].
You can find API documentation for all dart:* libraries in the
[Dart API reference][Dart API] or, if you're using Flutter,
the [Flutter API reference][api-flutter].

To learn more about the Dart language,
check out the [language documentation and samples](/language).

[Dart API]: {{site.dart-api}}/{{site.sdkInfo.channel}}
[webdev libraries]: /web/libraries
[api-flutter]: {{site.flutter-api}}

## Multi-platform libraries

The following table lists the Dart core libraries that work on all
[Dart platforms](/overview#platform).

| Library | Notes |
|-----------------------------------------------|-------------------------------|
| [`dart:core`][dart-core]<br>Built-in types, collections, and other core functionality for every Dart program. | |
| [`dart:async`][dart-async], [`package:async`][package-async]<br>Support for asynchronous programming, with classes such as `Future` and `Stream`.<br>`package:async` provides additional utilities around the `Future` and `Stream` types. | |
| [`dart:collection`][dart-collection], [`package:collection`][package-collection]<br>Classes and utilities that supplement the collection support in `dart:core`.<br>`package:collection` provides further collection implementations and functions for working on and with collections. | |
| [`dart:convert`][dart-convert], [`package:convert`][package-convert]<br>Encoders and decoders for converting between different data representations, including JSON and UTF-8.<br>`package:convert` provides additional encoders and decoders. ||
| [`dart:developer`][dart-developer]<br>Interaction with developer tools such as the debugger and inspector. | [Native JIT][jit] and the [development JavaScript compiler][] only |
| [`dart:math`][dart-math]<br>Mathematical constants and functions, plus a random number generator. | |
| [`dart:typed_data`][dart-typed_data], [`package:typed_data`][package-typed_data]<br>Lists that efficiently handle fixed sized data (for example, unsigned 8-byte integers) and SIMD numeric types.<br>`package:typed_data` provides further classes and functions working on typed data. | |

{:.table .table-striped}

## Native platform libraries

The following table lists the Dart core libraries that work on the
[Dart native platform](/overview#native-platform) (AOT- and JIT-compiled code).

| Library | Notes |
|-----------------------------------------------|-------------------------------|
| [`dart:ffi`][dart-ffi], [`package:ffi`][package-ffi]<br>A foreign function interface that lets Dart code use native C APIs.<br>`package:ffi` contains utilities incl. support for converting Dart strings and C strings. | |
| [`dart:io`][dart-io], [`package:io`][package-io]<br>File, socket, HTTP, and other I/O support for non-web applications.<br>`package:io` provides functionality including support for ANSI colors, file copying, and standard exit codes. | |
| [`dart:isolate`][dart-isolate]<br> Concurrent programming using isolates: independent workers similar to threads. | |
| [`dart:mirrors`][dart-mirrors]<br> Basic reflection with support for introspection and dynamic invocation. | Experimental<br>[Native JIT][jit] only (_not_&nbsp;Flutter) |

{:.table .table-striped}

## Web platform libraries

The following table lists the Dart core libraries that work on the
[Dart web platform](/overview#web-platform) (code compiled to JavaScript).

| Library | Notes |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| [`dart:html`][dart-html]<br>HTML elements and other resources for web-based applications. | |
| [`dart:indexed_db`][dart-indexed_db]<br>Client-side key-value store with support for indexes. | |
| ~~[`dart:js`][dart-js]~~, [`dart:js_util`][dart-js_util], [`package:js`][package-js]<br>`dart:js_util` provides low-level primitives for interoperability; typically the higher-level annotations in `package:js` are recommended, as they help express interoperability more succinctly. For more details see [JavaScript interoperability][].<br>_Don't use `dart:js` directly; direct use of those legacy APIs is deprecated_. | |
| [`dart:svg`][dart-svg]<br>Scalable Vector Graphics. | |
| [`dart:web_audio`][dart-web_audio]<br>High-fidelity audio programming in the browser. | |
| [`dart:web_gl`][dart-web_gl]<br>3D programming in the browser. | |

{:.table .table-striped}


<!---
Multi-platform libraries
-->
[dart-core]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-core/dart-core-library.html
[dart-async]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-async/dart-async-library.html
[package-async]: {{site.pub-pkg}}/async
[dart-collection]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-collection/dart-collection-library.html
[package-collection]: {{site.pub-pkg}}/collection
[dart-convert]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-convert/dart-convert-library.html
[package-convert]: {{site.pub-pkg}}/convert
[dart-developer]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-developer/dart-developer-library.html
[dart-math]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-math/dart-math-library.html
[dart-typed_data]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-typed_data/dart-typed_data-library.html
[package-typed_data]: {{site.pub-pkg}}/typed_data

<!---
Native platform libraries
-->
[dart-ffi]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-ffi/dart-ffi-library.html
[package-ffi]: {{site.pub-pkg}}/ffi
[dart-io]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-io/dart-io-library.html
[package-io]: {{site.pub-pkg}}/io
[dart-isolate]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-isolate/dart-isolate-library.html
[dart-mirrors]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-mirrors/dart-mirrors-library.html

<!---
Web platform libraries
-->
[dart-html]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-html/dart-html-library.html
[dart-indexed_db]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-indexed_db/dart-indexed_db-library.html
[dart-js]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-js/dart-js-library.html
[package-js]: {{site.pub-pkg}}/js
[dart-js_util]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-js_util/dart-js_util-library.html
[dart-svg]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-svg/dart-svg-library.html
[dart-web_audio]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-web_audio/dart-web_audio-library.html
[dart-web_gl]: {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-web_gl/dart-web_gl-library.html

<!---
Misc
-->
[development JavaScript compiler]: /tools/webdev#serve
[jit]: /overview#native-platform
[JavaScript interoperability]: /interop/js-interop
2 changes: 1 addition & 1 deletion src/content/guides/libraries/library-tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Learn about the major features in Dart's libraries.
short-title: Library tour
js: [{url: '/assets/js/library-tour-redirector.js'}]
sitemap: false
canonical: https://dart.dev/libraries
canonical: https://dart.cn/libraries
noindex: true
---

Expand Down
6 changes: 3 additions & 3 deletions src/content/interop/c-interop.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ API documentation is available in the
[`dart:ffi` API reference.]({{site.dart-api}}/dart-ffi/dart-ffi-library.html)

相关的 API 文档可在
[`dart:ffi` API 文档]({{site.dart_api}}/dart-ffi/dart-ffi-library.html)
[`dart:ffi` API 文档]({{site.dart-api}}/dart-ffi/dart-ffi-library.html)
查看。

## Examples
Expand Down Expand Up @@ -138,7 +138,7 @@ see Apple's [Code Signing Guide.][codesign]
The [`hello.dart` file]({{hw}}/hello.dart)
illustrates the steps for using `dart:ffi` to call a C function:

[`hello.dart` 文件]({{page.hw}}/hello.dart)
[`hello.dart` 文件]({{hw}}/hello.dart)
阐述了使用 dart:ffi 调用 C 函数的步骤:

1. Import `dart:ffi`.
Expand Down Expand Up @@ -287,7 +287,7 @@ C 库到 package 或应用并进行加载的方式,有所不同。

* [`dart:ffi` examples]({{samples}})

[`dart:ffi` 示例]({{page.samples}})
[`dart:ffi` 示例]({{samples}})

## Interfacing with native types

Expand Down
8 changes: 4 additions & 4 deletions src/content/language/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ which calls the extender's implementation of `describe()`.
[Read more](/language/class-modifiers#abstract)
about abstract classes and methods.

你可以 [阅读更多](/guides/language/language-tour#abstract-classes) 关于抽象类和抽象方法的内容。
你可以 [阅读更多](/language/class-modifiers#abstract) 关于抽象类和抽象方法的内容。

## Async

Expand Down Expand Up @@ -609,7 +609,7 @@ Note that the code above is asynchronous;
including stack traces, `rethrow`,
and the difference between `Error` and `Exception`.

你可以 [阅读更多](/language/language-tour#exceptions)
你可以 [阅读更多](/language/error-handling#exceptions)
关于异常的内容,包括栈追踪、`rethrow` 关键字以及 Error 和 Exception 之间的区别。

## Important concepts
Expand Down Expand Up @@ -696,8 +696,8 @@ and the [Dart API reference]({{site.dart-api}}).
This site's code follows the conventions in the
[Dart style guide](/effective-dart/style).

[语言概览](/guides/language/language-tour) 中会有更多的文档和代码示例。
你也可以查阅 [Dart API 文档]({{site.dart_api}}),里面也常常会有示例代码。
[核心库文档](/libraries/dart-core) 中会有更多的文档和代码示例。
你也可以查阅 [Dart API 文档]({{site.dart-api}}),里面也常常会有示例代码。

[Dart language specification]: /guides/language/spec
[Comments]: /language/comments
Expand Down
Loading

0 comments on commit e867ed2

Please sign in to comment.