Skip to content

Commit

Permalink
doc: update dart.md (#806)
Browse files Browse the repository at this point in the history
* doc: update dart.md

* doc: update dart.md

完善 import 部分内容

* doc: update dart.md

修正翻译错误,将 “地图” 修改为 “映射” d7ea92c
  • Loading branch information
jaywcjlove committed Jul 24, 2024
1 parent feb1cc2 commit e6e406c
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 144 deletions.
274 changes: 137 additions & 137 deletions CONTRIBUTORS.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion data.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data.json

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions docs/dart.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ <h4 id="windows-1"><a aria-hidden="true" tabindex="-1" href="#windows-1"><span c
</span><span class="code-line"><span class="token comment">// 您还可以将变量声明为 num</span>
</span><span class="code-line"><span class="token comment">// x 可以同时具有 int 和 double 值</span>
</span><span class="code-line">num x <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
</span><span class="code-line">num <span class="token operator">+=</span> <span class="token number">2.5</span><span class="token punctuation">;</span>
</span><span class="code-line"><span class="token function">print</span><span class="token punctuation">(</span>num<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// 打印: 3.5</span>
</span><span class="code-line">x <span class="token operator">+=</span> <span class="token number">2.5</span><span class="token punctuation">;</span>
</span><span class="code-line"><span class="token function">print</span><span class="token punctuation">(</span>x<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// 打印: 3.5</span>
</span><span class="code-line">
</span><span class="code-line"><span class="token class-name">String</span> name <span class="token operator">=</span> <span class="token string-literal"><span class="token string">"Nicola"</span></span><span class="token punctuation">;</span>
</span><span class="code-line">bool isFavourite <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
Expand Down Expand Up @@ -126,6 +126,15 @@ <h4 id="windows-1"><a aria-hidden="true" tabindex="-1" href="#windows-1"><span c
</span><span class="code-line"><span class="token keyword">import</span> <span class="token string-literal"><span class="token string">'package:test/test.dart'</span></span><span class="token punctuation">;</span>
</span><span class="code-line"><span class="token comment">// 导入文件</span>
</span><span class="code-line"><span class="token keyword">import</span> <span class="token string-literal"><span class="token string">'path/to/my_other_file.dart'</span></span><span class="token punctuation">;</span>
</span><span class="code-line"><span class="token comment">// 指定前缀</span>
</span><span class="code-line"><span class="token keyword">import</span> <span class="token string-literal"><span class="token string">'package:lib/lib.dart'</span></span> <span class="token operator">as</span> lib<span class="token punctuation">;</span>
</span><span class="code-line"><span class="token class-name"><span class="token namespace">lib<span class="token punctuation">.</span></span>Element</span> element <span class="token operator">=</span> <span class="token class-name"><span class="token namespace">lib<span class="token punctuation">.</span></span>Element</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</span><span class="code-line"><span class="token comment">// 仅导入 foo</span>
</span><span class="code-line"><span class="token keyword">import</span> <span class="token string-literal"><span class="token string">'package:lib1/lib1.dart'</span></span> <span class="token keyword">show</span> foo<span class="token punctuation">;</span>
</span><span class="code-line"><span class="token comment">// 不导入 foo</span>
</span><span class="code-line"><span class="token keyword">import</span> <span class="token string-literal"><span class="token string">'package:lib2/lib2.dart'</span></span> <span class="token keyword">hide</span> foo<span class="token punctuation">;</span>
</span><span class="code-line"><span class="token comment">// 延迟导入,仅在需要时导入</span>
</span><span class="code-line"><span class="token keyword">import</span> <span class="token string-literal"><span class="token string">'package:greetings/hello.dart'</span></span> <span class="token keyword">deferred</span> <span class="token operator">as</span> hello<span class="token punctuation">;</span>
</span></code></pre>
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="操作符"><a aria-hidden="true" tabindex="-1" href="#操作符"><span class="icon icon-link"></span></a>操作符</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="算术运算符"><a aria-hidden="true" tabindex="-1" href="#算术运算符"><span class="icon icon-link"></span></a>算术运算符</h3><div class="wrap-body">
Expand Down Expand Up @@ -328,7 +337,7 @@ <h4 id="windows-1"><a aria-hidden="true" tabindex="-1" href="#windows-1"><span c
<!--rehype:wrap-class=row-span-2-->
<pre class="language-dart"><code class="language-dart code-highlight"><span class="code-line"><span class="token comment">// 映射是关联键和值的对象</span>
</span><span class="code-line"><span class="token keyword">var</span> person <span class="token operator">=</span> <span class="token class-name">Map</span><span class="token generics"><span class="token punctuation">&#x3C;</span><span class="token class-name">String</span><span class="token punctuation">,</span> <span class="token class-name">String</span><span class="token punctuation">></span></span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</span><span class="code-line"><span class="token comment">// 要初始化地图,请执行以下操作:</span>
</span><span class="code-line"><span class="token comment">// 要初始化映射,请执行以下操作:</span>
</span><span class="code-line">person<span class="token punctuation">[</span><span class="token string-literal"><span class="token string">'firstName'</span></span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token string-literal"><span class="token string">'Nicola'</span></span><span class="token punctuation">;</span>
</span><span class="code-line">person<span class="token punctuation">[</span><span class="token string-literal"><span class="token string">'lastName'</span></span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token string-literal"><span class="token string">'Tesla'</span></span><span class="token punctuation">;</span>
</span><span class="code-line"><span class="token function">print</span><span class="token punctuation">(</span>person<span class="token punctuation">)</span><span class="token punctuation">;</span>
Expand All @@ -350,7 +359,7 @@ <h4 id="windows-1"><a aria-hidden="true" tabindex="-1" href="#windows-1"><span c
</span><span class="code-line"><span class="token comment">// 创建一个空集</span>
</span><span class="code-line"><span class="token keyword">var</span> names <span class="token operator">=</span> <span class="token generics"><span class="token punctuation">&#x3C;</span><span class="token class-name">String</span><span class="token punctuation">></span></span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</span><span class="code-line"><span class="token class-name">Set</span><span class="token generics"><span class="token punctuation">&#x3C;</span><span class="token class-name">String</span><span class="token punctuation">></span></span> names <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span> <span class="token comment">// 这也有效</span>
</span><span class="code-line"><span class="token comment">//var names = {}; // 创建地图,而不是集合</span>
</span><span class="code-line"><span class="token comment">//var names = {}; // 创建映射,而不是集合</span>
</span></code></pre>
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="函数"><a aria-hidden="true" tabindex="-1" href="#函数"><span class="icon icon-link"></span></a>函数</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="函数示例"><a aria-hidden="true" tabindex="-1" href="#函数示例"><span class="icon icon-link"></span></a>函数示例</h3><div class="wrap-body">
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@
<li><a href="https://marketplace.visualstudio.com/items?itemName=jackiotyu.quick-reference">Quick Reference for VSCode</a> 由 <a href="https://github.com/jackiotyu/vscode-quick-reference">jackiotyu</a> 提供</li>
</ul>

</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 <a href="https://wangchujiang.com/#/app" target="_blank">Kenny Wang</a>. Updated on 2024/07/21 15:09:20</footer></footer><script src="data.js?v=1.5.5" defer></script><script src="js/fuse.min.js?v=1.5.5" defer></script><script src="js/main.js?v=1.5.5" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 <a href="https://wangchujiang.com/#/app" target="_blank">Kenny Wang</a>. Updated on 2024/07/25 00:03:31</footer></footer><script src="data.js?v=1.5.5" defer></script><script src="js/fuse.min.js?v=1.5.5" defer></script><script src="js/main.js?v=1.5.5" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
<path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
</svg><input id="mysearch-input" type="search" placeholder="搜索" autocomplete="off"><div class="mysearch-clear"></div></div><button id="mysearch-close" type="button">搜索</button></div><div class="mysearch-result"><div id="mysearch-menu"></div><div id="mysearch-content"></div></div></div></div></body>
</html>

0 comments on commit e6e406c

Please sign in to comment.