{"id":85531,"date":"2025-04-03T11:59:54","date_gmt":"2025-04-03T04:59:54","guid":{"rendered":"https:\/\/itviecblog.uptech.vn\/?p=85531"},"modified":"2025-06-17T09:22:21","modified_gmt":"2025-06-17T02:22:21","slug":"dart-tutorial","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/dart-tutorial\/","title":{"rendered":"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/dart-tutorial\/#Dart_tutorial_Cac_buoc_cai_dat_moi_truong_phat_trien\" >Dart tutorial: C\u00e1c b\u01b0\u1edbc c\u00e0i \u0111\u1eb7t m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/dart-tutorial\/#Dart_tutorial_Thao_tac_voi_cac_thanh_phan_co_ban_trong_Dart\" >Dart tutorial: Thao t\u00e1c v\u1edbi c\u00e1c th\u00e0nh ph\u1ea7n c\u01a1 b\u1ea3n trong Dart\u00a0\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/dart-tutorial\/#Huong_dan_viet_chuong_trinh_dau_tien_voi_Dart\" >H\u01b0\u1edbng d\u1eabn vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh \u0111\u1ea7u ti\u00ean v\u1edbi Dart<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/dart-tutorial\/#Huong_dan_lap_trinh_huong_doi_tuong_trong_Dart\" >H\u01b0\u1edbng d\u1eabn l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng trong Dart<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/dart-tutorial\/#Huong_dan_xu_ly_loi_va_ngoai_le_trong_Dart\" >H\u01b0\u1edbng d\u1eabn x\u1eed l\u00fd l\u1ed7i v\u00e0 ngo\u1ea1i l\u1ec7 trong Dart\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/itviec.com\/blog\/dart-tutorial\/#Huong_dan_viet_mot_ung_dung_CLI_bang_Dart\" >H\u01b0\u1edbng d\u1eabn vi\u1ebft m\u1ed9t \u1ee9ng d\u1ee5ng CLI b\u1eb1ng Dart\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/itviec.com\/blog\/dart-tutorial\/#Cac_cau_hoi_thuong_gap_ve_dart_tutorial\" >C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 dart tutorial<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/itviec.com\/blog\/dart-tutorial\/#Tong_ket\" >T\u1ed5ng k\u1ebft\u00a0<\/a><\/li><\/ul><\/nav><\/div>\n<p><em><strong>Dart l\u00e0 m\u1ed9t ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh hi\u1ec7n \u0111\u1ea1i, m\u1ea1nh m\u1ebd do Google ph\u00e1t tri\u1ec3n, \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u00e1c \u1ee9ng d\u1ee5ng hi\u1ec7u su\u1ea5t cao tr\u00ean nhi\u1ec1u n\u1ec1n t\u1ea3ng, \u0111\u1eb7c bi\u1ec7t l\u00e0 trong ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng di \u0111\u1ed9ng v\u1edbi Flutter. V\u1edbi c\u00fa ph\u00e1p \u0111\u01a1n gi\u1ea3n, d\u1ec5 h\u1ecdc nh\u01b0ng v\u1eabn linh ho\u1ea1t v\u00e0 m\u1ea1nh m\u1ebd, Dart ng\u00e0y c\u00e0ng tr\u1edf n\u00ean ph\u1ed5 bi\u1ebfn trong c\u1ed9ng \u0111\u1ed3ng l\u1eadp tr\u00ecnh vi\u00ean. N\u1ebfu b\u1ea1n \u0111ang c\u1ea7n l\u00e0m quen v\u1edbi Dart, h\u01b0\u1edbng d\u1eabn Dart tutorial n\u00e0y s\u1ebd gi\u00fap b\u1ea1n b\u1eaft \u0111\u1ea7u s\u1eed d\u1ee5ng Dart m\u1ed9t c\u00e1ch nhanh ch\u00f3ng nh\u1ea5t.<\/strong><\/em><\/p>\n<p>\u0110\u1ecdc b\u00e0i vi\u1ebft Dart tutorial sau \u0111\u00e2y \u0111\u1ec3 hi\u1ec3u th\u00eam v\u1ec1:<\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">H\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t m\u00f4i tr\u01b0\u1eddng l\u1eadp tr\u00ecnh Dart<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">H\u01b0\u1edbng d\u1eabn l\u00e0m quen v\u1edbi c\u00e1c th\u00e0nh ph\u1ea7n c\u01a1 b\u1ea3n trong Dart\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">H\u01b0\u1edbng d\u1eabn vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh \u0111\u1ea7u ti\u00ean s\u1eed d\u1ee5ng ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh Dart\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">H\u01b0\u1edbng d\u1eabn l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng trong Dart\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">H\u01b0\u1edbng d\u1eabn x\u1eed l\u00fd l\u1ed7i v\u00e0 ngo\u1ea1i l\u1ec7 trong Dart\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">H\u01b0\u1edbng d\u1eabn vi\u1ebft m\u1ed9t \u1ee9ng d\u1ee5ng CLI b\u1eb1ng Dart\u00a0<\/span><\/li>\n<\/ul>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"\/blog\/dart-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>Dart l\u00e0 g\u00ec? C\u00fa ph\u00e1p, \u0110\u1eb7c \u0111i\u1ec3m, \u1ee8ng d\u1ee5ng th\u1ef1c t\u1ebf c\u1ee7a Dart<\/strong><\/a><\/em><\/p><\/blockquote>\n<h2><span class=\"ez-toc-section\" id=\"Dart_tutorial_Cac_buoc_cai_dat_moi_truong_phat_trien\"><\/span><b>Dart tutorial: C\u00e1c b\u01b0\u1edbc c\u00e0i \u0111\u1eb7t m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n\u00a0<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1edbc khi b\u1eaft \u0111\u1ea7u l\u1eadp tr\u00ecnh v\u1edbi Dart, b\u1ea1n c\u1ea7n thi\u1ebft l\u1eadp m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n ph\u00f9 h\u1ee3p. Trong ph\u1ea7n n\u00e0y, ch\u00fang ta s\u1ebd h\u01b0\u1edbng d\u1eabn c\u00e1ch c\u00e0i \u0111\u1eb7t Dart SDK tr\u00ean c\u00e1c h\u1ec7 \u0111i\u1ec1u h\u00e0nh ph\u1ed5 bi\u1ebfn, s\u1eed d\u1ee5ng Dart tr\u1ef1c ti\u1ebfp tr\u00ean tr\u00ecnh duy\u1ec7t v\u1edbi DartPad v\u00e0 thi\u1ebft l\u1eadp tr\u00ecnh so\u1ea1n th\u1ea3o h\u1ed7 tr\u1ee3 Dart nh\u01b0 Visual Studio Code ho\u1eb7c IntelliJ IDEA.<\/span><\/p>\n<h3><b>C\u00e0i \u0111\u1eb7t Dart SDK<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Dart SDK l\u00e0 b\u1ed9 c\u00f4ng c\u1ee5 c\u1ea7n thi\u1ebft \u0111\u1ec3 bi\u00ean d\u1ecbch v\u00e0 ch\u1ea1y m\u00e3 Dart. B\u1ea1n c\u00f3 th\u1ec3 c\u00e0i \u0111\u1eb7t Dart SDK tr\u00ean Windows, macOS v\u00e0 Linux theo h\u01b0\u1edbng d\u1eabn sau:<\/span><\/p>\n<h4><b>C\u00e0i \u0111\u1eb7t Dart SDK tr\u00ean Windows<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Truy c\u1eadp trang ch\u00ednh th\u1ee9c c\u1ee7a Dart: https:\/\/dart.dev\/get-dart<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ch\u1ecdn tab <\/span><b>Windows<\/b><span style=\"font-weight: 400;\"> v\u00e0 t\u1ea3i v\u1ec1 file c\u00e0i \u0111\u1eb7t.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ch\u1ea1y file <\/span><span style=\"font-weight: 400;\">.exe<\/span><span style=\"font-weight: 400;\"> v\u00e0 l\u00e0m theo h\u01b0\u1edbng d\u1eabn tr\u00ean m\u00e0n h\u00ecnh.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Sau khi c\u00e0i \u0111\u1eb7t xong, m\u1edf <\/span><b>Command Prompt (cmd)<\/b><span style=\"font-weight: 400;\"> ho\u1eb7c <\/span><b>PowerShell<\/b><span style=\"font-weight: 400;\">, nh\u1eadp l\u1ec7nh sau \u0111\u1ec3 ki\u1ec3m tra phi\u00ean b\u1ea3n Dart: <\/span><span style=\"font-weight: 400;\">dart &#8211;version\u00a0<\/span><\/li>\n<\/ul>\n<h4><b>C\u00e0i \u0111\u1eb7t Dart SDK tr\u00ean macOS<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">N\u1ebfu \u0111\u00e3 c\u00e0i <\/span><b>Homebrew<\/b><span style=\"font-weight: 400;\">, b\u1ea1n c\u00f3 th\u1ec3 c\u00e0i \u0111\u1eb7t Dart nhanh ch\u00f3ng b\u1eb1ng l\u1ec7nh:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">brew install dart<\/span><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ki\u1ec3m tra phi\u00ean b\u1ea3n Dart b\u1eb1ng l\u1ec7nh:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">dart --version<\/span><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-85532\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-1-vippro.jpg\" alt=\"dart tutorial - itviec blog\" width=\"901\" height=\"76\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-1-vippro.jpg 901w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-1-vippro-300x25.jpg 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-1-vippro-768x65.jpg 640w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-1-vippro-200x17.jpg 200w\" sizes=\"auto, (max-width: 901px) 100vw, 901px\" \/><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">N\u1ebfu kh\u00f4ng s\u1eed d\u1ee5ng Homebrew, b\u1ea1n c\u00f3 th\u1ec3 t\u1ea3i Dart SDK t\u1eeb trang ch\u00ednh th\u1ee9c v\u00e0 c\u00e0i \u0111\u1eb7t th\u1ee7 c\u00f4ng.<\/span><\/li>\n<\/ul>\n<h4><b>C\u00e0i \u0111\u1eb7t Dart SDK tr\u00ean Linux<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Th\u00eam kho l\u01b0u tr\u1eef Dart v\u00e0o h\u1ec7 th\u1ed1ng:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">sudo apt update<\/span>\n\n<span style=\"font-weight: 400;\">sudo apt install apt-transport-https<\/span>\n<span style=\"font-weight: 400;\">sudo sh -c 'wget -qO- https:\/\/dl-ssl.google.com\/linux\/linux_signing_key.pub | apt-key add -'<\/span>\n<span style=\"font-weight: 400;\">sudo sh -c 'wget -qO- https:\/\/storage.googleapis.com\/download.dartlang.org\/linux\/debian\/dart_stable.list &gt; \/etc\/apt\/sources.list.d\/dart_stable.list'<\/span><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u00e0i \u0111\u1eb7t Dart SDK:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">sudo apt update<\/span>\n<span style=\"font-weight: 400;\">sudo apt install dart<\/span><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">X\u00e1c minh c\u00e0i \u0111\u1eb7t:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">dart --version<\/span><\/pre>\n<h3><b>S\u1eed d\u1ee5ng Dart trong tr\u00ecnh duy\u1ec7t v\u1edbi DartPad<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">N\u1ebfu b\u1ea1n kh\u00f4ng mu\u1ed1n c\u00e0i \u0111\u1eb7t Dart SDK ngay, b\u1ea1n c\u00f3 th\u1ec3 th\u1eed vi\u1ebft v\u00e0 ch\u1ea1y m\u00e3 Dart tr\u1ef1c ti\u1ebfp tr\u00ean tr\u00ecnh duy\u1ec7t b\u1eb1ng <\/span><b>DartPad<\/b><span style=\"font-weight: 400;\">. C\u00e1ch l\u00e0m nh\u01b0 sau:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Truy c\u1eadp<\/span><a href=\"https:\/\/dartpad.dev\" target=\"_blank\" rel=\"noopener\"> <span style=\"font-weight: 400;\">https:\/\/dartpad.dev<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">B\u1ea1n s\u1ebd th\u1ea5y m\u1ed9t tr\u00ecnh so\u1ea1n th\u1ea3o tr\u1ef1c tuy\u1ebfn n\u01a1i c\u00f3 th\u1ec3 vi\u1ebft v\u00e0 ch\u1ea1y m\u00e3 Dart.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">H\u00e3y th\u1eed nh\u1eadp \u0111o\u1ea1n code sau v\u00e0o DartPad v\u00e0 nh\u1ea5n <\/span><b>Run<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 xem k\u1ebft qu\u1ea3:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0print('Xin ch\u00e0o, Dart!');<\/span>\n<span style=\"font-weight: 400;\">}\n<\/span><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-85533\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-2-vippro.png\" alt=\"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean gi\u00fap b\u1ea1n l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart\" width=\"1600\" height=\"778\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-2-vippro.png 1600w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-2-vippro-300x146.png 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-2-vippro-1536x747.png 640w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-2-vippro-200x97.png 200w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p style=\"text-align: center;\"><em><span style=\"font-weight: 400;\">DartPad l\u00e0 c\u00f4ng c\u1ee5 h\u1eefu \u00edch \u0111\u1ec3 th\u1eed nghi\u1ec7m nhanh c\u00e1c \u0111o\u1ea1n m\u00e3 Dart m\u00e0 kh\u00f4ng c\u1ea7n c\u00e0i \u0111\u1eb7t m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n.<\/span><\/em><\/p>\n<h3><b>C\u00e0i \u0111\u1eb7t v\u00e0 s\u1eed d\u1ee5ng Visual Studio Code ho\u1eb7c IntelliJ IDEA cho Dart<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 c\u00f3 tr\u1ea3i nghi\u1ec7m l\u1eadp tr\u00ecnh t\u1ed1t h\u01a1n, b\u1ea1n n\u00ean s\u1eed d\u1ee5ng m\u1ed9t tr\u00ecnh so\u1ea1n th\u1ea3o h\u1ed7 tr\u1ee3 Dart nh\u01b0 <\/span><a href=\"https:\/\/code.visualstudio.com\/\" target=\"_blank\" rel=\"noopener\"><b>Visual Studio Code (VS Code)<\/b><\/a><span style=\"font-weight: 400;\"> ho\u1eb7c <\/span><a href=\"https:\/\/www.jetbrains.com\/idea\/\" target=\"_blank\" rel=\"noopener\"><b>IntelliJ IDEA<\/b><\/a><span style=\"font-weight: 400;\">. C\u1ea3 VS Code v\u00e0 IntelliJ IDEA \u0111\u1ec1u h\u1ed7 tr\u1ee3 t\u00ednh n\u0103ng g\u1ee3i \u00fd code, g\u1ee1 l\u1ed7i v\u00e0 t\u00edch h\u1ee3p t\u1ed1t v\u1edbi Dart, gi\u00fap b\u1ea1n l\u00e0m vi\u1ec7c hi\u1ec7u qu\u1ea3 h\u01a1n.<\/span><\/p>\n<h4><b>C\u00e0i \u0111\u1eb7t v\u00e0 s\u1eed d\u1ee5ng Dart tr\u00ean VS Code<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">T\u1ea3i v\u00e0 c\u00e0i \u0111\u1eb7t <\/span><a href=\"https:\/\/code.visualstudio.com\/\" target=\"_blank\" rel=\"noopener\"><b>Visual Studio Code<\/b><\/a><span style=\"font-weight: 400;\">\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">M\u1edf VS Code, v\u00e0o <\/span><b>Extensions (Ctrl + Shift + X)<\/b><span style=\"font-weight: 400;\">, t\u00ecm v\u00e0 c\u00e0i \u0111\u1eb7t plugin <\/span><b>Dart<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-85534\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-3-vippro.jpg\" alt=\"dart tutorial - itviec blog\" width=\"1600\" height=\"255\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-3-vippro.jpg 1600w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-3-vippro-300x48.jpg 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-3-vippro-1536x245.jpg 640w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-3-vippro-200x32.jpg 200w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Sau khi c\u00e0i \u0111\u1eb7t xong, m\u1edf terminal trong VS Code v\u00e0 nh\u1eadp l\u1ec7nh:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">dart create my_project<\/span>\n<span style=\"font-weight: 400;\">cd my_project<\/span>\n<span style=\"font-weight: 400;\">code<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 b\u1eaft \u0111\u1ea7u vi\u1ebft code Dart v\u00e0 ch\u1ea1y b\u1eb1ng l\u1ec7nh:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">dart run<\/span><\/pre>\n<h4><b>C\u00e0i \u0111\u1eb7t v\u00e0 s\u1eed d\u1ee5ng Dart tr\u00ean IntelliJ IDEA<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">T\u1ea3i IntelliJ IDEA t\u1eeb<\/span><a href=\"https:\/\/www.jetbrains.com\/idea\/\" target=\"_blank\" rel=\"noopener\"> <span style=\"font-weight: 400;\">https:\/\/www.jetbrains.com\/idea\/<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">M\u1edf IntelliJ, v\u00e0o <\/span><b>File &gt; Settings &gt; Plugins<\/b><span style=\"font-weight: 400;\">, t\u00ecm v\u00e0 c\u00e0i \u0111\u1eb7t plugin <\/span><b>Dart<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">T\u1ea1o m\u1ed9t d\u1ef1 \u00e1n m\u1edbi, ch\u1ecdn <\/span><b>Dart<\/b><span style=\"font-weight: 400;\"> l\u00e0m ng\u00f4n ng\u1eef ch\u00ednh, v\u00e0 b\u1eaft \u0111\u1ea7u l\u1eadp tr\u00ecnh.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Sau khi \u0111\u00e3 thi\u1ebft l\u1eadp m\u00f4i tr\u01b0\u1eddng xong, b\u1ea1n c\u00f3 th\u1ec3 b\u1eaft \u0111\u1ea7u t\u00ecm hi\u1ec3u c\u00fa ph\u00e1p v\u00e0 c\u00e1c t\u00ednh n\u0103ng c\u1ee7a Dart \u0111\u1ec3 vi\u1ebft c\u00e1c \u1ee9ng d\u1ee5ng m\u1ea1nh m\u1ebd v\u00e0 linh ho\u1ea1t.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Dart_tutorial_Thao_tac_voi_cac_thanh_phan_co_ban_trong_Dart\"><\/span><b>Dart tutorial: Thao t\u00e1c v\u1edbi c\u00e1c th\u00e0nh ph\u1ea7n c\u01a1 b\u1ea3n trong Dart\u00a0\u00a0<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>C\u1ea5u tr\u00fac t\u1ed5ng qu\u00e1t c\u1ee7a m\u1ed9t ch\u01b0\u01a1ng tr\u00ecnh Dart<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Dart l\u00e0 m\u1ed9t ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh c\u00f3 c\u00fa ph\u00e1p \u0111\u01a1n gi\u1ea3n v\u00e0 d\u1ec5 ti\u1ebfp c\u1eadn, \u0111\u1eb7c bi\u1ec7t ph\u00f9 h\u1ee3p v\u1edbi nh\u1eefng ai \u0111\u00e3 t\u1eebng l\u00e0m vi\u1ec7c v\u1edbi c\u00e1c ng\u00f4n ng\u1eef nh\u01b0 Java, JavaScript ho\u1eb7c C#.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">M\u1ed9t ch\u01b0\u01a1ng tr\u00ecnh Dart c\u01a1 b\u1ea3n bao g\u1ed3m c\u00e1c th\u00e0nh ph\u1ea7n ch\u00ednh nh\u01b0: khai b\u00e1o th\u01b0 vi\u1ec7n, \u0111\u1ecbnh ngh\u0129a h\u00e0m <\/span><span style=\"font-weight: 400;\">main()<\/span><span style=\"font-weight: 400;\">, bi\u1ebfn, ki\u1ec3u d\u1eef li\u1ec7u, v\u00e0 c\u00e1c c\u00e2u l\u1ec7nh \u0111i\u1ec1u khi\u1ec3n. \u0110\u1eb7c bi\u1ec7t, m\u1ed9t ch\u01b0\u01a1ng tr\u00ecnh Dart t\u1ed1i thi\u1ec3u ph\u1ea3i c\u00f3 m\u1ed9t h\u00e0m <\/span><span style=\"font-weight: 400;\">main()<\/span><span style=\"font-weight: 400;\">, v\u00ec \u0111\u00e2y l\u00e0 \u0111i\u1ec3m b\u1eaft \u0111\u1ea7u th\u1ef1c thi c\u1ee7a ch\u01b0\u01a1ng tr\u00ecnh.<\/span><\/p>\n<h3><b>Bi\u1ebfn v\u00e0 Ki\u1ec3u d\u1eef li\u1ec7u<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Dart l\u00e0 ng\u00f4n ng\u1eef ki\u1ec3u t\u0129nh nh\u01b0ng c\u0169ng h\u1ed7 tr\u1ee3 ki\u1ec3u \u0111\u1ed9ng v\u1edbi var ho\u1eb7c dynamic.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5 v\u1ec1 khai b\u00e1o bi\u1ebfn:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0int age = 25; \u00a0 \u00a0 \u00a0 \/\/ Ki\u1ec3u s\u1ed1 nguy\u00ean<\/span>\n<span style=\"font-weight: 400;\"> \u00a0double pi = 3.14; \u00a0 \/\/ Ki\u1ec3u s\u1ed1 th\u1ef1c<\/span>\n<span style=\"font-weight: 400;\"> \u00a0String name = 'Dart'; \/\/ Ki\u1ec3u chu\u1ed7i<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0bool isLearning = true; \/\/ Ki\u1ec3u boolean<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0print('Age: $age, Pi: $pi, Name: $name, Learning: $isLearning');<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n<\/pre>\n<p><span style=\"font-weight: 400;\">Output: <\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Age: 25, Pi: 3.14, Name: Dart, Learning: true<\/span><\/pre>\n<p><b>Gi\u1ea3i th\u00edch:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">int, double, String, bool<\/span><span style=\"font-weight: 400;\"> l\u00e0 c\u00e1c ki\u1ec3u d\u1eef li\u1ec7u c\u01a1 b\u1ea3n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">$variable<\/span><span style=\"font-weight: 400;\"> \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 ch\u00e8n gi\u00e1 tr\u1ecb c\u1ee7a bi\u1ebfn v\u00e0o chu\u1ed7i khi in ra m\u00e0n h\u00ecnh.<\/span><\/li>\n<\/ul>\n<h3><b>C\u00e2u l\u1ec7nh \u0111i\u1ec1u ki\u1ec7n v\u00e0 v\u00f2ng l\u1eb7p<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5 v\u1ec1 c\u00e2u l\u1ec7nh \u0111i\u1ec1u ki\u1ec7n:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0int number = 10;<\/span>\n\n<span style=\"font-weight: 400;\"> \u00a0if (number &gt; 0) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('S\u1ed1 d\u01b0\u01a1ng');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0} else {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('S\u1ed1 kh\u00f4ng ho\u1eb7c \u00e2m');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Output:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">S\u1ed1 d\u01b0\u01a1ng<\/span><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-85537\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-4-vippro.png\" alt=\"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean gi\u00fap b\u1ea1n l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart\" width=\"1600\" height=\"758\" \/><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5 v\u1ec1 v\u00f2ng l\u1eb7p <\/span><span style=\"font-weight: 400;\">for<\/span><span style=\"font-weight: 400;\">:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0for (int i = 1; i &lt;= 5; i++) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('L\u1ea7n l\u1eb7p th\u1ee9 $i');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Output: <\/span><\/p>\n<pre><span style=\"font-weight: 400;\">L\u1ea7n l\u1eb7p th\u1ee9 1\u00a0 <\/span>\n<span style=\"font-weight: 400;\">L\u1ea7n l\u1eb7p th\u1ee9 2\u00a0 <\/span>\n<span style=\"font-weight: 400;\">L\u1ea7n l\u1eb7p th\u1ee9 3\u00a0 <\/span>\n<span style=\"font-weight: 400;\">L\u1ea7n l\u1eb7p th\u1ee9 4\u00a0 <\/span>\n<span style=\"font-weight: 400;\">L\u1ea7n l\u1eb7p th\u1ee9 5 <\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Gi\u1ea3i th\u00edch:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">if-else<\/span><span style=\"font-weight: 400;\"> gi\u00fap ki\u1ec3m tra \u0111i\u1ec1u ki\u1ec7n v\u00e0 th\u1ef1c hi\u1ec7n c\u00e1c kh\u1ed1i l\u1ec7nh t\u01b0\u01a1ng \u1ee9ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">for<\/span><span style=\"font-weight: 400;\"> gi\u00fap l\u1eb7p m\u1ed9t \u0111o\u1ea1n m\u00e3 v\u1edbi s\u1ed1 l\u1ea7n x\u00e1c \u0111\u1ecbnh.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Huong_dan_viet_chuong_trinh_dau_tien_voi_Dart\"><\/span><b>H\u01b0\u1edbng d\u1eabn vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh \u0111\u1ea7u ti\u00ean v\u1edbi Dart<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>T\u1ea1o m\u1ed9t \u1ee9ng d\u1ee5ng Flutter \u0111\u01a1n gi\u1ea3n<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u1ee8ng d\u1ee5ng n\u00e0y c\u00f3 m\u1ed9t giao di\u1ec7n v\u1edbi m\u1ed9t <\/span><b>Text Widget<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 hi\u1ec3n th\u1ecb v\u0103n b\u1ea3n v\u00e0 m\u1ed9t <\/span><b>ElevatedButton<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 thay \u0111\u1ed5i n\u1ed9i dung khi nh\u1ea5n n\u00fat.<\/span><\/p>\n<h4><b>B\u01b0\u1edbc 1: Kh\u1edfi t\u1ea1o d\u1ef1 \u00e1n Flutter<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">N\u1ebfu b\u1ea1n ch\u01b0a c\u00f3 d\u1ef1 \u00e1n Flutter, h\u00e3y ch\u1ea1y l\u1ec7nh sau trong terminal:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">flutter create my_first_app<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Sau \u0111\u00f3, v\u00e0o th\u01b0 m\u1ee5c d\u1ef1 \u00e1n:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">cd my_first_app<\/span><\/pre>\n<h4><b>B\u01b0\u1edbc 2: Vi\u1ebft m\u00e3 ch\u01b0\u01a1ng tr\u00ecnh<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">M\u1edf file <\/span><span style=\"font-weight: 400;\">lib\/main.dart<\/span><span style=\"font-weight: 400;\"> v\u00e0 thay th\u1ebf n\u1ed9i dung v\u1edbi \u0111o\u1ea1n code sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import 'package:flutter\/material.dart';<\/span>\n\n<span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0runApp(MyApp());<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">class MyApp extends StatelessWidget {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0@override<\/span>\n<span style=\"font-weight: 400;\"> \u00a0Widget build(BuildContext context) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0return MaterialApp(<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0debugShowCheckedModeBanner: false,<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0home: HomeScreen(),<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0);<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">class HomeScreen extends StatefulWidget {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0@override<\/span>\n<span style=\"font-weight: 400;\"> \u00a0_HomeScreenState createState() =&gt; _HomeScreenState();<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">class _HomeScreenState extends State&lt;HomeScreen&gt; {<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0String _text = \"Ch\u00e0o m\u1eebng b\u1ea1n \u0111\u1ebfn v\u1edbi Flutter!\";<\/span>\n\n<span style=\"font-weight: 400;\"> \u00a0void _changeText() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0setState(() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0_text = \"B\u1ea1n \u0111\u00e3 nh\u1ea5n n\u00fat!\";<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0});<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\"> \u00a0@override<\/span>\n<span style=\"font-weight: 400;\"> \u00a0Widget build(BuildContext context) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0return Scaffold(<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0appBar: AppBar(title: Text(\"\u1ee8ng d\u1ee5ng Flutter c\u01a1 b\u1ea3n\")),<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0body: Center(<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0child: Column(<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0mainAxisAlignment: MainAxisAlignment.center,<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0children: [<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Text(<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_text,<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0textAlign: TextAlign.center,<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SizedBox(height: 20),<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ElevatedButton(<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0onPressed: _changeText,<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0child: Text(\"Nh\u1ea5n \u0111\u1ec3 thay \u0111\u1ed5i\"),<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0],<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0);<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p>Gi\u1ea3i th\u00edch:<\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>main()<\/b><span style=\"font-weight: 400;\">: H\u00e0m kh\u1edfi ch\u1ea1y \u1ee9ng d\u1ee5ng Flutter b\u1eb1ng c\u00e1ch g\u1ecdi <\/span><span style=\"font-weight: 400;\">runApp(MyApp())<\/span><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>MyApp<\/b><span style=\"font-weight: 400;\">: L\u00e0 m\u1ed9t widget <\/span><b>Stateless<\/b><span style=\"font-weight: 400;\">, s\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">MaterialApp<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 t\u1ea1o giao di\u1ec7n c\u01a1 b\u1ea3n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>HomeScreen<\/b><span style=\"font-weight: 400;\">: L\u00e0 m\u1ed9t widget <\/span><b>Stateful<\/b><span style=\"font-weight: 400;\"> ch\u1ee9a tr\u1ea1ng th\u00e1i thay \u0111\u1ed5i khi nh\u1ea5n n\u00fat.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Bi\u1ebfn <\/b><b>_text<\/b><span style=\"font-weight: 400;\">: L\u01b0u tr\u1eef n\u1ed9i dung hi\u1ec3n th\u1ecb tr\u00ean m\u00e0n h\u00ecnh.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>H\u00e0m <\/b><b>_changeText()<\/b><span style=\"font-weight: 400;\">: D\u00f9ng <\/span><span style=\"font-weight: 400;\">setState()<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 c\u1eadp nh\u1eadt n\u1ed9i dung v\u0103n b\u1ea3n khi nh\u1ea5n n\u00fat.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Scaffold<\/b><span style=\"font-weight: 400;\">: Cung c\u1ea5p giao di\u1ec7n ch\u00ednh v\u1edbi <\/span><b>AppBar<\/b><span style=\"font-weight: 400;\">, <\/span><b>Text<\/b><span style=\"font-weight: 400;\">, v\u00e0 <\/span><b>ElevatedButton<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<\/ol>\n<h3><b>Ch\u1ea1y \u1ee9ng d\u1ee5ng<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Sau khi vi\u1ebft xong code, b\u1ea1n c\u00f3 th\u1ec3 ch\u1ea1y \u1ee9ng d\u1ee5ng v\u1edbi l\u1ec7nh:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">flutter run<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">\u1ee8ng d\u1ee5ng s\u1ebd hi\u1ec3n th\u1ecb m\u1ed9t m\u00e0n h\u00ecnh c\u00f3 n\u1ed9i dung ban \u0111\u1ea7u l\u00e0 <\/span><b>&#8220;Ch\u00e0o m\u1eebng b\u1ea1n \u0111\u1ebfn v\u1edbi Flutter!&#8221;<\/b><span style=\"font-weight: 400;\">, v\u00e0 khi nh\u1ea5n n\u00fat, n\u1ed9i dung s\u1ebd thay \u0111\u1ed5i th\u00e0nh <\/span><b>&#8220;B\u1ea1n \u0111\u00e3 nh\u1ea5n n\u00fat!&#8221;<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00e0 \u0111\u00e2y l\u00e0 k\u1ebft qu\u1ea3 sau khi ch\u1ea1y \u1ee9ng d\u1ee5ng v\u1eeba \u0111\u01b0\u1ee3c x\u00e2y d\u1ef1ng:<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-85538\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-5-vippro.png\" alt=\"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean gi\u00fap b\u1ea1n l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart\" width=\"750\" height=\"1334\" \/><br \/>\n<\/span><\/p>\n<h3><b>Khai b\u00e1o th\u01b0 vi\u1ec7n (Import Libraries)<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Dart cung c\u1ea5p nhi\u1ec1u th\u01b0 vi\u1ec7n c\u00f3 s\u1eb5n \u0111\u1ec3 h\u1ed7 tr\u1ee3 l\u1eadp tr\u00ecnh. B\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">import<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 th\u00eam c\u00e1c th\u01b0 vi\u1ec7n v\u00e0o ch\u01b0\u01a1ng tr\u00ecnh.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5, \u0111\u1ec3 s\u1eed d\u1ee5ng c\u00e1c h\u00e0m to\u00e1n h\u1ecdc m\u1edf r\u1ed9ng:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import 'dart:math';<\/span>\n\n<span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0print(sqrt(16)); \/\/ T\u00ednh c\u0103n b\u1eadc hai c\u1ee7a 16<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Output:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">\/\/ <\/span><span style=\"font-weight: 400;\">4.0<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Gi\u1ea3i th\u00edch: Thay v\u00ec ph\u1ea3i tr\u00ecnh b\u00e0y c\u00f4ng th\u1ee9c t\u00ednh c\u0103n b\u1eadc 2 ph\u1ee9c t\u1ea1p th\u00ec ta c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng th\u01b0 vi\u1ec7n <\/span><span style=\"font-weight: 400;\">\u2018dart:math\u2019<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 t\u00ednh c\u0103n b\u1eadc 2 m\u1ed9t c\u00e1ch \u0111\u01a1n gi\u1ea3n v\u00e0 ti\u1ebft ki\u1ec7m th\u1eddi gian cho c\u00e1c b\u00e0i to\u00e1n l\u1edbn kh\u00f3 v\u00e0 ph\u1ee9c t\u1ea1p h\u01a1n, c\u1ea7n nhi\u1ec1u th\u1eddi gian ph\u00e2n t\u00edch h\u01a1n.<\/span><\/p>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"\/blog\/xay-dung-mobile-app-voi-dart-flutter\/\" target=\"_blank\" rel=\"noopener\"><strong>Dart Flutter l\u00e0 g\u00ec: C\u00e1ch x\u00e2y d\u1ef1ng mobile app v\u1edbi Dart trong Flutter<\/strong><\/a><\/em><\/p><\/blockquote>\n<h2><span class=\"ez-toc-section\" id=\"Huong_dan_lap_trinh_huong_doi_tuong_trong_Dart\"><\/span><b>H\u01b0\u1edbng d\u1eabn l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng trong Dart<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>L\u1edbp v\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Dart l\u00e0 m\u1ed9t ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng (OOP), trong \u0111\u00f3 m\u1ecdi th\u1ee9 \u0111\u1ec1u l\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng. M\u1ed9t l\u1edbp (class) l\u00e0 m\u1ed9t b\u1ea3n thi\u1ebft k\u1ebf (blueprint) \u0111\u1ec3 t\u1ea1o ra c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng (object). D\u01b0\u1edbi \u0111\u00e2y l\u00e0 v\u00ed d\u1ee5 v\u1ec1 c\u00e1ch \u0111\u1ecbnh ngh\u0129a m\u1ed9t l\u1edbp v\u00e0 t\u1ea1o \u0111\u1ed1i t\u01b0\u1ee3ng trong Dart:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">class Person {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0String name;<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0int age;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0Person(this.name, this.age);<\/span>\n\n<span style=\"font-weight: 400;\"> \u00a0void introduce() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('T\u00f4i l\u00e0 $name, $age tu\u1ed5i.');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0var person = Person('Nam', 25);<\/span>\n<span style=\"font-weight: 400;\"> \u00a0person.introduce();<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>Constructor v\u00e0 Factory Constructor<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Constructor l\u00e0 m\u1ed9t ph\u01b0\u01a1ng th\u1ee9c \u0111\u1eb7c bi\u1ec7t \u0111\u01b0\u1ee3c g\u1ecdi khi t\u1ea1o \u0111\u1ed1i t\u01b0\u1ee3ng. Dart h\u1ed7 tr\u1ee3 nhi\u1ec1u lo\u1ea1i constructor, bao g\u1ed3m constructor th\u00f4ng th\u01b0\u1eddng v\u00e0 factory constructor.<\/span><\/p>\n<p><b>Constructor th\u00f4ng th\u01b0\u1eddng<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">class Animal {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0String species;<\/span>\n<span style=\"font-weight: 400;\"> \u00a0Animal(this.species);<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><b>Factory Constructor<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Factory constructor \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng khi c\u1ea7n ki\u1ec3m so\u00e1t qu\u00e1 tr\u00ecnh t\u1ea1o \u0111\u1ed1i t\u01b0\u1ee3ng, ch\u1eb3ng h\u1ea1n nh\u01b0 tr\u1ea3 v\u1ec1 m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng \u0111\u00e3 t\u1ed3n t\u1ea1i thay v\u00ec t\u1ea1o m\u1edbi:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">class Singleton {<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0static final Singleton _instance = Singleton._internal();<\/span>\n\n<span style=\"font-weight: 400;\"> \u00a0factory Singleton() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0return _instance;<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\"> \u00a0Singleton._internal();<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>K\u1ebf th\u1eeba v\u00e0 \u0111a h\u00ecnh<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">K\u1ebf th\u1eeba gi\u00fap m\u1ed9t l\u1edbp con c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng v\u00e0 m\u1edf r\u1ed9ng t\u00ednh n\u0103ng c\u1ee7a l\u1edbp cha.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">class Animal {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0void makeSound() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('Animal sound');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">class Dog extends Animal {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0@override<\/span>\n<span style=\"font-weight: 400;\"> \u00a0void makeSound() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('G\u00e2u g\u00e2u!');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0Dog dog = Dog();<\/span>\n<span style=\"font-weight: 400;\"> \u00a0dog.makeSound(); \/\/ Output: G\u00e2u g\u00e2u!<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>Interface v\u00e0 mixin (implements, with)<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Dart kh\u00f4ng c\u00f3 t\u1eeb kh\u00f3a <\/span><span style=\"font-weight: 400;\">interface<\/span><span style=\"font-weight: 400;\">, nh\u01b0ng m\u1ecdi l\u1edbp \u0111\u1ec1u c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng nh\u01b0 m\u1ed9t interface.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">abstract class Logger {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0void log(String message);<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">class ConsoleLogger implements Logger {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0@override<\/span>\n<span style=\"font-weight: 400;\"> \u00a0void log(String message) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('Log: $message');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Mixin gi\u00fap m\u1ed9t l\u1edbp c\u00f3 th\u1ec3 &#8220;k\u1ebf th\u1eeba&#8221; t\u1eeb nhi\u1ec1u l\u1edbp m\u00e0 kh\u00f4ng c\u1ea7n \u0111a k\u1ebf th\u1eeba.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">mixin Flyer {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0void fly() =&gt; print('Flying...');<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">class Bird with Flyer {}<\/span><\/pre>\n<h3><b>X\u1eed l\u00fd b\u1ea5t \u0111\u1ed3ng b\u1ed9 trong Dart<\/b><\/h3>\n<h4><b>Future v\u00e0 async\/await<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Dart h\u1ed7 tr\u1ee3 l\u1eadp tr\u00ecnh b\u1ea5t \u0111\u1ed3ng b\u1ed9 b\u1eb1ng <\/span><span style=\"font-weight: 400;\">Future<\/span><span style=\"font-weight: 400;\"> v\u00e0 <\/span><span style=\"font-weight: 400;\">async\/await<\/span><span style=\"font-weight: 400;\">. <\/span><span style=\"font-weight: 400;\">Future<\/span><span style=\"font-weight: 400;\"> \u0111\u1ea1i di\u1ec7n cho m\u1ed9t gi\u00e1 tr\u1ecb s\u1ebd c\u00f3 trong t\u01b0\u01a1ng lai.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Future&lt;String&gt; fetchData() async {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0await Future.delayed(Duration(seconds: 2));<\/span>\n<span style=\"font-weight: 400;\"> \u00a0return 'D\u1eef li\u1ec7u \u0111\u00e3 t\u1ea3i';<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">void main() async {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0print('B\u1eaft \u0111\u1ea7u t\u1ea3i d\u1eef li\u1ec7u...');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0String data = await fetchData();<\/span>\n<span style=\"font-weight: 400;\"> \u00a0print(data);<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h4><b>Stream v\u00e0 c\u00e1ch l\u00e0m vi\u1ec7c v\u1edbi d\u1eef li\u1ec7u lu\u1ed3ng<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Stream gi\u00fap x\u1eed l\u00fd nhi\u1ec1u gi\u00e1 tr\u1ecb kh\u00f4ng \u0111\u1ed3ng b\u1ed9 theo th\u1eddi gian.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Stream&lt;int&gt; countStream() async* {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0for (int i = 1; i &lt;= 5; i++) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0await Future.delayed(Duration(seconds: 1));<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0yield i;<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0countStream().listen((value) =&gt; print('Gi\u00e1 tr\u1ecb: $value'));<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>So s\u00e1nh Future v\u00e0 Stream<\/b><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>\u0110\u1eb7c \u0111i\u1ec3m\u00a0<\/b><\/td>\n<td><b>Future<\/b><\/td>\n<td><b>Stream<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Tr\u1ea3 v\u1ec1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">M\u1ed9t gi\u00e1 tr\u1ecb\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Nhi\u1ec1u gi\u00e1 tr\u1ecb\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Ho\u1ea1t \u0111\u1ed9ng<\/span><\/td>\n<td><span style=\"font-weight: 400;\">K\u1ebft th\u00fac sau m\u1ed7i l\u1ea7n ho\u00e0n th\u00e0nh\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">C\u00f3 th\u1ec3 ti\u1ebfp t\u1ee5c ph\u00e1t d\u1eef li\u1ec7u<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">C\u00e1ch s\u1eed d\u1ee5ng<\/span><\/td>\n<td><span style=\"font-weight: 400;\">async\/await<\/span><\/td>\n<td><span style=\"font-weight: 400;\">listen()<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span class=\"ez-toc-section\" id=\"Huong_dan_xu_ly_loi_va_ngoai_le_trong_Dart\"><\/span><b>H\u01b0\u1edbng d\u1eabn x\u1eed l\u00fd l\u1ed7i v\u00e0 ngo\u1ea1i l\u1ec7 trong Dart\u00a0<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>S\u1eed d\u1ee5ng try-catch \u0111\u1ec3 b\u1eaft l\u1ed7i<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Dart cung c\u1ea5p <\/span><span style=\"font-weight: 400;\">try-catch<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 b\u1eaft l\u1ed7i v\u00e0 x\u1eed l\u00fd ngo\u1ea1i l\u1ec7.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0try {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0int result = 10 ~\/ 0;<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print(result);<\/span>\n<span style=\"font-weight: 400;\"> \u00a0} catch (e) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('L\u1ed7i: $e');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>on, finally v\u00e0 c\u00e1ch qu\u1ea3n l\u00fd ngo\u1ea1i l\u1ec7<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">on<\/span><span style=\"font-weight: 400;\"> d\u00f9ng \u0111\u1ec3 b\u1eaft l\u1ed7i c\u1ee5 th\u1ec3.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">finally<\/span><span style=\"font-weight: 400;\"> ch\u1ea1y b\u1ea5t k\u1ec3 c\u00f3 l\u1ed7i hay kh\u00f4ng.<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">void main() {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0try {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0throw FormatException('L\u1ed7i \u0111\u1ecbnh d\u1ea1ng');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0} on FormatException catch (e) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('B\u1eaft l\u1ed7i: $e');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0} finally {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('D\u1ecdn d\u1eb9p t\u00e0i nguy\u00ean.');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Huong_dan_viet_mot_ung_dung_CLI_bang_Dart\"><\/span><b>H\u01b0\u1edbng d\u1eabn vi\u1ebft m\u1ed9t \u1ee9ng d\u1ee5ng CLI b\u1eb1ng Dart\u00a0<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">\u1ee8ng d\u1ee5ng d\u00f2ng l\u1ec7nh (Command-Line Interface &#8211; CLI) l\u00e0 m\u1ed9t trong nh\u1eefng lo\u1ea1i \u1ee9ng d\u1ee5ng ph\u1ed5 bi\u1ebfn khi l\u00e0m vi\u1ec7c v\u1edbi ng\u00f4n ng\u1eef Dart, \u0111\u1eb7c bi\u1ec7t h\u1eefu \u00edch cho vi\u1ec7c t\u1ef1 \u0111\u1ed9ng h\u00f3a, x\u1eed l\u00fd d\u1eef li\u1ec7u v\u00e0 c\u00e1c t\u00e1c v\u1ee5 server-side. Trong b\u00e0i vi\u1ebft n\u00e0y, ch\u00fang ta s\u1ebd t\u00ecm hi\u1ec3u c\u00e1ch t\u1ea1o m\u1ed9t \u1ee9ng d\u1ee5ng CLI b\u1eb1ng Dart, d\u1ef1a tr\u00ean h\u01b0\u1edbng d\u1eabn t\u1eeb t\u00e0i li\u1ec7u ch\u00ednh th\u1ee9c c\u1ee7a Dart.<\/span><\/p>\n<h3><b> Kh\u1edfi t\u1ea1o d\u1ef1 \u00e1n CLI<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1edbc ti\u00ean, b\u1ea1n c\u1ea7n c\u00e0i \u0111\u1eb7t Dart SDK n\u1ebfu ch\u01b0a c\u00f3. Sau \u0111\u00f3, s\u1eed d\u1ee5ng l\u1ec7nh sau \u0111\u1ec3 t\u1ea1o m\u1ed9t d\u1ef1 \u00e1n CLI m\u1edbi:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">dart create -t console my_cli_app<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">L\u1ec7nh tr\u00ean s\u1ebd t\u1ea1o m\u1ed9t th\u01b0 m\u1ee5c my_cli_app ch\u1ee9a c\u00e1c t\u1ec7p c\u1ea7n thi\u1ebft, bao g\u1ed3m:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">bin\/my_cli_app.dart: T\u1ec7p ch\u00ednh c\u1ee7a \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">pubspec.yaml: T\u1ec7p c\u1ea5u h\u00ecnh package.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Sau khi t\u1ea1o xong, di chuy\u1ec3n v\u00e0o th\u01b0 m\u1ee5c d\u1ef1 \u00e1n v\u00e0 ch\u1ea1y th\u1eed \u1ee9ng d\u1ee5ng CLI:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">cd my_cli_app<\/span>\n<span style=\"font-weight: 400;\">dart run<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">M\u1eb7c \u0111\u1ecbnh, ch\u01b0\u01a1ng tr\u00ecnh s\u1ebd in ra Hello, world! t\u1eeb t\u1ec7p <\/span><span style=\"font-weight: 400;\">bin\/my_cli_app.dart.<\/span><\/p>\n<h3><b>X\u1eed l\u00fd tham s\u1ed1 d\u00f2ng l\u1ec7nh<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Dart cho ph\u00e9p b\u1ea1n truy c\u1eadp c\u00e1c tham s\u1ed1 d\u00f2ng l\u1ec7nh th\u00f4ng qua danh s\u00e1ch List&lt;String&gt; arguments \u0111\u01b0\u1ee3c truy\u1ec1n v\u00e0o h\u00e0m main(). V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">void main(List&lt;String&gt; arguments) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0if (arguments.isEmpty) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('Vui l\u00f2ng nh\u1eadp m\u1ed9t tham s\u1ed1!');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0return;<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\"> \u00a0print('Tham s\u1ed1 nh\u1eadn \u0111\u01b0\u1ee3c: ${arguments.join(\", \")}');<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ch\u1ea1y th\u1eed v\u1edbi:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">dart run bin\/my_cli_app.dart hello world<\/span><\/p>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Tham s\u1ed1 nh\u1eadn \u0111\u01b0\u1ee3c: hello, world<\/span><\/pre>\n<h3><b> S\u1eed d\u1ee5ng package args \u0111\u1ec3 x\u1eed l\u00fd tham s\u1ed1<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 l\u00e0m cho \u1ee9ng d\u1ee5ng CLI m\u1ea1nh m\u1ebd h\u01a1n, ch\u00fang ta c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng package args \u0111\u1ec3 ph\u00e2n t\u00edch c\u00fa ph\u00e1p tham s\u1ed1 m\u1ed9t c\u00e1ch linh ho\u1ea1t. C\u00e0i \u0111\u1eb7t package b\u1eb1ng l\u1ec7nh:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">dart pub add args<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Sau \u0111\u00f3, ch\u1ec9nh s\u1eeda bin\/my_cli_app.dart \u0111\u1ec3 s\u1eed d\u1ee5ng ArgParser:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import 'package:args\/args.dart';\n<\/span><span style=\"font-weight: 400;\">void main(List&lt;String&gt; arguments) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0var parser = ArgParser()<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0..addOption('name', abbr: 'n', help: 'T\u00ean c\u1ee7a b\u1ea1n')<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0..addFlag('verbose', abbr: 'v', negatable: false, help: 'B\u1eadt ch\u1ebf \u0111\u1ed9 chi ti\u1ebft');<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0var argResults = parser.parse(arguments);<\/span>\n\n<span style=\"font-weight: 400;\"> \u00a0if (argResults.wasParsed('name')) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('Xin ch\u00e0o, ${argResults['name']}!');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0} else {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('Xin ch\u00e0o, ng\u01b0\u1eddi d\u00f9ng!');<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\"> \u00a0if (argResults['verbose']) {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print('Ch\u1ebf \u0111\u1ed9 chi ti\u1ebft \u0111\u00e3 \u0111\u01b0\u1ee3c b\u1eadt.');<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ch\u1ea1y th\u1eed:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">dart run bin\/my_cli_app.dart --name=Dart --verbose<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Xin ch\u00e0o, Dart!\n<\/span><span style=\"font-weight: 400;\">Ch\u1ebf \u0111\u1ed9 chi ti\u1ebft \u0111\u00e3 \u0111\u01b0\u1ee3c b\u1eadt.<\/span><\/pre>\n<h3><b> T\u01b0\u01a1ng t\u00e1c v\u1edbi ng\u01b0\u1eddi d\u00f9ng qua stdin<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u1ee8ng d\u1ee5ng CLI c\u00f3 th\u1ec3 \u0111\u1ecdc d\u1eef li\u1ec7u t\u1eeb ng\u01b0\u1eddi d\u00f9ng b\u1eb1ng stdin:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import 'dart:io';<\/span>\n\n<span style=\"font-weight: 400;\">void main() {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0stdout.write('Nh\u1eadp t\u00ean c\u1ee7a b\u1ea1n: ');<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0String? name = stdin.readLineSync();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0print('Xin ch\u00e0o, $name!');<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ch\u1ea1y th\u1eed:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">dart run bin\/my_cli_app.dart<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">\u1ee8ng d\u1ee5ng s\u1ebd y\u00eau c\u1ea7u nh\u1eadp t\u00ean v\u00e0 hi\u1ec3n th\u1ecb k\u1ebft qu\u1ea3 t\u01b0\u01a1ng \u1ee9ng.<\/span><\/p>\n<h3><b> X\u00e2y d\u1ef1ng v\u00e0 ch\u1ea1y \u1ee9ng d\u1ee5ng CLI<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Sau khi ho\u00e0n thi\u1ec7n \u1ee9ng d\u1ee5ng CLI, b\u1ea1n c\u00f3 th\u1ec3 bi\u00ean d\u1ecbch n\u00f3 th\u00e0nh m\u1ed9t t\u1ec7p nh\u1ecb ph\u00e2n \u0111\u1ec3 ch\u1ea1y m\u00e0 kh\u00f4ng c\u1ea7n Dart SDK:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">dart compile exe bin\/my_cli_app.dart -o my_cli_app<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ch\u1ea1y \u1ee9ng d\u1ee5ng \u0111\u00e3 bi\u00ean d\u1ecbch:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">.\/my_cli_app --name=Dart<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Xin ch\u00e0o, Dart!<\/span><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_thuong_gap_ve_dart_tutorial\"><\/span><b>C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 dart tutorial<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>Dart c\u00f3 h\u1ed7 tr\u1ee3 l\u1eadp tr\u00ecnh server kh\u00f4ng?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">C\u00f3, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng Dart \u0111\u1ec3 vi\u1ebft server v\u1edbi <\/span><b>package nh\u01b0 <\/b><a href=\"https:\/\/pub.dev\/packages\/shelf\" target=\"_blank\" rel=\"noopener\"><b>shelf<\/b><\/a><b> ho\u1eb7c <\/b><a href=\"https:\/\/pub.dev\/packages\/dart_frog\" target=\"_blank\" rel=\"noopener\"><b>dart_frog<\/b><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5 v\u1edbi <\/span><span style=\"font-weight: 400;\">shelf<\/span><span style=\"font-weight: 400;\">:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import 'package:shelf\/shelf.dart';<\/span>\n<span style=\"font-weight: 400;\">import 'package:shelf\/shelf_io.dart' as io;<\/span>\n\n<span style=\"font-weight: 400;\">void main() async {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0var handler = Pipeline().addHandler((request) =&gt; Response.ok('Hello, Dart!'));<\/span>\n<span style=\"font-weight: 400;\"> \u00a0await io.serve(handler, 'localhost', 8080);<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>C\u00f3 th\u1ec3 t\u00ecm hi\u1ec3u v\u00e0 h\u1ecdc Dart-Flutter \u1edf \u0111\u00e2u?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">D\u01b0\u1edbi \u0111\u00e2y l\u00e0 m\u1ed9t s\u1ed1 ngu\u1ed3n t\u00e0i li\u1ec7u t\u1ed1t nh\u1ea5t \u0111\u1ec3 t\u00ecm hi\u1ec3u v\u1ec1 <\/span><b>Dart v\u00e0 Flutter<\/b><span style=\"font-weight: 400;\"> t\u1eeb c\u01a1 b\u1ea3n \u0111\u1ebfn n\u00e2ng cao:<\/span><\/p>\n<p><b>T\u00e0i li\u1ec7u ch\u00ednh th\u1ee9c<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/docs.flutter.dev\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Flutter Documentation<\/span><\/a>\u00a0<span style=\"font-weight: 400;\">\u2013 H\u01b0\u1edbng d\u1eabn t\u1eeb c\u01a1 b\u1ea3n \u0111\u1ebfn n\u00e2ng cao, bao g\u1ed3m c\u00e1ch c\u00e0i \u0111\u1eb7t, s\u1eed d\u1ee5ng widget, state management, testing, v.v.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/dart.dev\/docs\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Dart Documentation<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 H\u1ecdc ng\u00f4n ng\u1eef Dart, t\u1eeb c\u00fa ph\u00e1p c\u01a1 b\u1ea3n \u0111\u1ebfn l\u1eadp tr\u00ecnh b\u1ea5t \u0111\u1ed3ng b\u1ed9, x\u1eed l\u00fd ngo\u1ea1i l\u1ec7, v\u00e0 t\u1ed1i \u01b0u hi\u1ec7u su\u1ea5t.<\/span><\/li>\n<\/ul>\n<p><b>C\u00e1c kh\u00f3a h\u1ecdc mi\u1ec5n ph\u00ed v\u00e0 ch\u00ednh th\u1ee9c<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/docs.flutter.dev\/codelabs\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Flutter Codelabs<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 C\u00e1c b\u00e0i th\u1ef1c h\u00e0nh nh\u1ecf gi\u00fap n\u1eafm b\u1eaft nhanh c\u00e1c t\u00ednh n\u0103ng quan tr\u1ecdng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/rm-dart.web.app\/guides\/language\/language-tour\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Dart Language Tour<\/span><\/a>\u00a0<span style=\"font-weight: 400;\">\u2013 H\u01b0\u1edbng d\u1eabn chi ti\u1ebft v\u1ec1 c\u00fa ph\u00e1p v\u00e0 c\u00e1ch s\u1eed d\u1ee5ng Dart.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.udemy.com\/course\/learn-flutter-dart-to-build-ios-android-apps\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Flutter &amp; Dart \u2013 The Complete Guide<\/span><\/a><span style=\"font-weight: 400;\"> (Udemy &#8211; kh\u00f3a tr\u1ea3 ph\u00ed, nh\u01b0ng hay \u0111\u01b0\u1ee3c gi\u1ea3m gi\u00e1).<\/span><\/li>\n<\/ul>\n<p><b>Kh\u00f3a h\u1ecdc tr\u00ean Youtube<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.youtube.com\/c\/TheFlutterWay\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">The Flutter Way<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 H\u01b0\u1edbng d\u1eabn chi ti\u1ebft v\u1ec1 UI\/UX v\u1edbi Flutter.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.youtube.com\/c\/FlutterMapp\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Flutter Mapp<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 H\u1ecdc Flutter t\u1eeb c\u01a1 b\u1ea3n \u0111\u1ebfn n\u00e2ng cao qua c\u00e1c d\u1ef1 \u00e1n th\u1ef1c t\u1ebf.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.youtube.com\/c\/Academind\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Academind \u2013 Flutter<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 H\u01b0\u1edbng d\u1eabn chuy\u00ean s\u00e2u v\u1ec1 Flutter, UI, state management.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.youtube.com\/c\/ResoCoder\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Reso Coder<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 Video v\u1ec1 ki\u1ebfn tr\u00fac, clean code, testing trong Flutter.<\/span><\/li>\n<\/ul>\n<p><b>Blog v\u00e0 Website h\u1eefu \u00edch<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/flutterawesome.com\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Flutter Awesome<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 B\u1ed9 s\u01b0u t\u1eadp c\u00e1c d\u1ef1 \u00e1n m\u00e3 ngu\u1ed3n m\u1edf t\u1ed1t nh\u1ea5t v\u1ec1 Flutter.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.kodeco.com\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Raywenderlich Flutter<\/span><\/a>\u00a0<span style=\"font-weight: 400;\">\u2013 H\u01b0\u1edbng d\u1eabn, b\u00e0i vi\u1ebft chuy\u00ean s\u00e2u v\u1ec1 Flutter.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.filledstacks.com\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">FilledStacks<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 Chia s\u1ebb kinh nghi\u1ec7m, ki\u1ebfn tr\u00fac, state management trong Flutter.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/fluttergems.dev\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Flutter Gems<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 T\u00ecm ki\u1ebfm th\u01b0 vi\u1ec7n Flutter theo danh m\u1ee5c.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Tong_ket\"><\/span><b>T\u1ed5ng k\u1ebft\u00a0<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">B\u1eb1ng c\u00e1ch n\u1eafm v\u1eefng c\u00fa ph\u00e1p, l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng, l\u1eadp tr\u00ecnh b\u1ea5t \u0111\u1ed3ng b\u1ed9 v\u00e0 c\u00e1c th\u01b0 vi\u1ec7n c\u1ed1t l\u00f5i c\u1ee7a Dart, b\u1ea1n c\u00f3 th\u1ec3 x\u00e2y d\u1ef1ng c\u00e1c \u1ee9ng d\u1ee5ng hi\u1ec7u su\u1ea5t cao, d\u1ec5 b\u1ea3o tr\u00ec. <\/span><span style=\"font-weight: 400;\">H\u00e0nh tr\u00ecnh h\u1ecdc Dart kh\u00f4ng ch\u1ec9 d\u1eebng l\u1ea1i \u1edf vi\u1ec7c hi\u1ec3u c\u00fa ph\u00e1p m\u00e0 c\u00f2n bao g\u1ed3m vi\u1ec7c \u00e1p d\u1ee5ng n\u00f3 v\u00e0o c\u00e1c d\u1ef1 \u00e1n th\u1ef1c t\u1ebf. H\u00e3y th\u1ef1c h\u00e0nh th\u01b0\u1eddng xuy\u00ean, kh\u00e1m ph\u00e1 c\u00e1c th\u01b0 vi\u1ec7n h\u1eefu \u00edch v\u00e0 tham gia v\u00e0o c\u1ed9ng \u0111\u1ed3ng \u0111\u1ec3 c\u1eadp nh\u1eadt nh\u1eefng xu h\u01b0\u1edbng m\u1edbi nh\u1ea5t. V\u1edbi n\u1ec1n t\u1ea3ng v\u1eefng ch\u1eafc v\u1ec1 Dart, b\u1ea1n s\u1ebd c\u00f3 m\u1ed9t l\u1ee3i th\u1ebf l\u1edbn trong vi\u1ec7c ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng di \u0111\u1ed9ng, web v\u00e0 server-side hi\u1ec7n \u0111\u1ea1i.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dart l\u00e0 m\u1ed9t ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh hi\u1ec7n \u0111\u1ea1i, m\u1ea1nh m\u1ebd do Google ph\u00e1t tri\u1ec3n, \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u00e1c \u1ee9ng d\u1ee5ng hi\u1ec7u su\u1ea5t cao tr\u00ean nhi\u1ec1u n\u1ec1n t\u1ea3ng, \u0111\u1eb7c bi\u1ec7t l\u00e0 trong ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng di \u0111\u1ed9ng v\u1edbi Flutter. V\u1edbi c\u00fa ph\u00e1p \u0111\u01a1n gi\u1ea3n, d\u1ec5 h\u1ecdc nh\u01b0ng v\u1eabn linh ho\u1ea1t v\u00e0 [&hellip;]<\/p>\n","protected":false},"author":203,"featured_media":85598,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-85531","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart - ITviec Blog<\/title>\n<meta name=\"description\" content=\"Dart tutorial gi\u00fap b\u1ea1n nhanh l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart: T\u1eeb c\u00e0i \u0111\u1eb7t, c\u00fa ph\u00e1p, l\u1eadp tr\u00ecnh OOP, x\u1eed l\u00fd ngo\u1ea1i l\u1ec7 v\u00e0 vi\u1ebft \u1ee9ng d\u1ee5ng Dart \u0111\u01a1n gi\u1ea3n.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/dart-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart\" \/>\n<meta property=\"og:description\" content=\"Dart l\u00e0 m\u1ed9t ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh hi\u1ec7n \u0111\u1ea1i, m\u1ea1nh m\u1ebd do Google ph\u00e1t tri\u1ec3n, \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u00e1c \u1ee9ng d\u1ee5ng hi\u1ec7u su\u1ea5t cao tr\u00ean nhi\u1ec1u n\u1ec1n t\u1ea3ng, \u0111\u1eb7c bi\u1ec7t\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/dart-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-03T04:59:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-17T02:22:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-vippro-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"337\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Tien Tran\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tien Tran\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart - ITviec Blog","description":"Dart tutorial gi\u00fap b\u1ea1n nhanh l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart: T\u1eeb c\u00e0i \u0111\u1eb7t, c\u00fa ph\u00e1p, l\u1eadp tr\u00ecnh OOP, x\u1eed l\u00fd ngo\u1ea1i l\u1ec7 v\u00e0 vi\u1ebft \u1ee9ng d\u1ee5ng Dart \u0111\u01a1n gi\u1ea3n.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/dart-tutorial\/","og_locale":"vi_VN","og_type":"article","og_title":"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart","og_description":"Dart l\u00e0 m\u1ed9t ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh hi\u1ec7n \u0111\u1ea1i, m\u1ea1nh m\u1ebd do Google ph\u00e1t tri\u1ec3n, \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u00e1c \u1ee9ng d\u1ee5ng hi\u1ec7u su\u1ea5t cao tr\u00ean nhi\u1ec1u n\u1ec1n t\u1ea3ng, \u0111\u1eb7c bi\u1ec7t","og_url":"https:\/\/itviec.com\/blog\/dart-tutorial\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2025-04-03T04:59:54+00:00","article_modified_time":"2025-06-17T02:22:21+00:00","og_image":[{"width":640,"height":337,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-vippro-scaled.png","type":"image\/png"}],"author":"Tien Tran","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"Tien Tran","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"14 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/"},"author":{"name":"Tien Tran","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/1595d671c49cfa2a48cd3c0a047a1298"},"headline":"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart","datePublished":"2025-04-03T04:59:54+00:00","dateModified":"2025-06-17T02:22:21+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/"},"wordCount":3515,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-vippro-scaled.png","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/","url":"https:\/\/itviec.com\/blog\/dart-tutorial\/","name":"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-vippro-scaled.png","datePublished":"2025-04-03T04:59:54+00:00","dateModified":"2025-06-17T02:22:21+00:00","description":"Dart tutorial gi\u00fap b\u1ea1n nhanh l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart: T\u1eeb c\u00e0i \u0111\u1eb7t, c\u00fa ph\u00e1p, l\u1eadp tr\u00ecnh OOP, x\u1eed l\u00fd ngo\u1ea1i l\u1ec7 v\u00e0 vi\u1ebft \u1ee9ng d\u1ee5ng Dart \u0111\u01a1n gi\u1ea3n.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/dart-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-vippro-scaled.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/dart-tutorial-vippro-scaled.png","width":640,"height":337,"caption":"dart tutorial - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/dart-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"Dart tutorial: C\u00e1c b\u01b0\u1edbc \u0111\u1ea7u ti\u00ean l\u00e0m quen v\u1edbi l\u1eadp tr\u00ecnh Dart"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/1595d671c49cfa2a48cd3c0a047a1298","name":"Tien Tran","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/05\/tien-tran-author-e1715658627643-100x100.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/05\/tien-tran-author-e1715658627643-100x100.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/05\/tien-tran-author-e1715658627643-100x100.jpg","caption":"Tien Tran"},"url":"https:\/\/itviec.com\/blog\/author\/tien-tran\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/85531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/203"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=85531"}],"version-history":[{"count":1,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/85531\/revisions"}],"predecessor-version":[{"id":88170,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/85531\/revisions\/88170"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/85598"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=85531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=85531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=85531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}