{"id":546,"date":"2023-01-31T22:12:15","date_gmt":"2023-01-31T14:12:15","guid":{"rendered":"http:\/\/gjweb.top\/?p=546"},"modified":"2023-01-31T22:13:30","modified_gmt":"2023-01-31T14:13:30","slug":"01-datr%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=546","title":{"rendered":"01. Datr\u57fa\u7840"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"1-\u6570\u636e\u7c7b\u578b\">1. \u6570\u636e\u7c7b\u578b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"string-\u5b57\u7b26\u7c7b\u578b\">string \u5b57\u7b26\u7c7b\u578b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>String str = \"Hello Dart\";<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"int-\u6574\u6570\u7c7b\u578b\">int \u6574\u6570\u7c7b\u578b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>int num = 12;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"double-\u6d6e\u70b9\u7c7b\u578b\">double \u6d6e\u70b9\u7c7b\u578b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u6ce8\u610f: double \u7c7b\u578b\u7684\u53d8\u91cf\u53ef\u4ee5\u517c\u5bb9 int \u7c7b\u578b, \u4f46 int \u548c double \u4e0d\u80fd\u53c2\u4e0e\u8ba1\u7b97, \u5982\u679c\u53c2\u4e0e\u8ba1\u7b97\u9700\u8981\u6570\u636e\u90fd\u58f0\u660e\u79f0\u6210 int \u6216\u8005 double<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>double num = 12.0 <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"bool-\u5e03\u5c14\u7c7b\u578b\">bool \u5e03\u5c14\u7c7b\u578b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>bool flag = true<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"list-\u6570\u7ec4-\u96c6\u5408-\u7c7b\u578b\">List (\u6570\u7ec4\/\u96c6\u5408)\u7c7b\u578b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>var list = &#91;1,2,3,4]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"map-\u7c7b\u578b-\u7c7b\u4f3c\u4e8ejs\u4e2d\u7684object\">Map \u7c7b\u578b ( \u7c7b\u4f3c\u4e8eJS\u4e2d\u7684object )<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>var map = new Map();<br>map&#91;\"name\"] = \"\u5f20\u4e09\";<br>map&#91;\"age\"] = 18<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2-\u7279\u6b8a\u7684\u8fd0\u7b97\u7b26\">2. \u7279\u6b8a\u7684\u8fd0\u7b97\u7b26<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">??=<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c \u53d8\u91cf\u4e3a\u7a7a \u5219\u8d4b\u503c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var int? b;<br>b ?? = 3;<br>print(b) \/\/ 3<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u53d6\u6574\">~\/ \u53d6\u6574<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>int a = 10;<br>int b = 3;<br>print(a~\/b); \/\/3<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3-\u7c7b\u578b\u8f6c\u6362\">3.\u7c7b\u578b\u8f6c\u6362<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u6570\u5b57 \u8f6c \u5b57\u7b26\u4e32<br>var num = 123;<br>num.toString();<br>\/\/ \u5b57\u7b26\u4e32 \u4e13 \u6570\u5b57<br>var str = \"123\";<br>int.parset(str); \/\/ 123<br>double.parset(str); \/\/123.0<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u7c7b\u578b\u5224\u65ad\">\u7c7b\u578b\u5224\u65ad<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u5224\u65ad\u662f\u5426\u4e3a\u7a7a<br>var str = \"\";<br>str.isEmpty \/\/ true<br>\/\/ \u5224\u65ad\u662f\u5426\u662f NAN<br>var num = 0\/0;<br>num.isNaN \/\/ true<br>\/\/ \u5224\u65ad\u7c7b\u578b,\u53ef\u4ee5\u5224\u65ad\u6240\u6709\u7684\u6570\u636e\u7c7b\u578b<br>var num = 0;<br>num is int \/\/true<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u6570\u636e\u7c7b\u578b string \u5b57\u7b26\u7c7b\u578b int \u6574\u6570\u7c7b\u578b double \u6d6e\u70b9\u7c7b\u578b \u6ce8\u610f: double \u7c7b\u578b\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-546","post","type-post","status-publish","format-standard","hentry","category-dart"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=546"}],"version-history":[{"count":2,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/546\/revisions"}],"predecessor-version":[{"id":548,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/546\/revisions\/548"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}