[{"data":1,"prerenderedAt":635},["ShallowReactive",2],{"news-item-\u002Fnews\u002Fflutter2":3},{"id":4,"title":5,"body":6,"category":620,"created by":623,"date":624,"description":625,"extension":626,"meta":627,"navigation":628,"path":629,"sections":630,"seo":631,"stem":632,"thumbnail":633,"__hash__":634},"content_en\u002Fnews\u002Fflutter2.md","Flutter2",{"type":7,"value":8,"toc":608},"minimark",[9,20,68,81,84,89,92,100,111,119,125,131,137,144,150,153,159,162,168,172,181,187,198,204,208,215,223,226,230,235,241,244,249,260,264,273,277,280,284,288,294,307,313,333,340,346,363,367,370,379,385,392,398,405,411,414,420,423,430,434,437,441,445,451,465,469,511,515,529,534,554,558,561,564,568],[10,11,12,13,19],"p",{},"At 2021\u002F3\u002F4, ",[14,15,5],"a",{"href":16,"rel":17,"title":5},"https:\u002F\u002Fdevelopers.googleblog.com\u002F2021\u002F03\u002Fannouncing-flutter-2.html",[18],"nofollow","  was released with new features added:",[21,22,23,27,35,50,65],"ul",{},[24,25,26],"li",{},"Web's , desktop's support has been in stable channel (they were in beta channel before), which mean you can bring your app officially to Web, Mac OS and Windows OS.",[24,28,29,34],{},[14,30,33],{"href":31,"rel":32},"https:\u002F\u002Fproxify.io\u002Farticles\u002Fflutter-2-null-safety",[18],"Sound Null Safety",", but not all packages has been updated with this feature so consider this when you intend to upgrade your current project with new Flutter version.",[24,36,37,38,43,44,49],{},"New widgets: ",[14,39,42],{"href":40,"rel":41},"https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fmaterial\u002FAutocomplete-class.html",[18],"Autocomplete"," and ",[14,45,48],{"href":46,"rel":47},"https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fmaterial\u002FScaffoldMessenger-class.html",[18],"ScaffoldMessenger",".",[24,51,52,53,58,59,64],{},"Upgrade on extensions for code editors(",[14,54,57],{"href":55,"rel":56},"https:\u002F\u002Fflutter.dev\u002Fdocs\u002Fdevelopment\u002Ftools\u002Fvs-code",[18],"Visual Studio Code"," and ",[14,60,63],{"href":61,"rel":62},"https:\u002F\u002Fflutter.dev\u002Fdocs\u002Fdevelopment\u002Ftools\u002Fandroid-studio",[18],"Android Studio",").",[24,66,67],{},"Ecosystem and DevTools updates, Bug fixes, Flutter Fix are also included.",[10,69,70,71,75,76],{},"You can refer all of updates at ",[14,72,74],{"href":16,"rel":73},[18],"Announcing Flutter 2",". If you want to give it a try, you can download it at ",[14,77,80],{"href":78,"rel":79},"https:\u002F\u002Fflutter.dev\u002Fdocs\u002Fget-started\u002Finstall",[18],"here.",[10,82,83],{},"And right now we will show you from how to configure 1 Flutter2 app in MacOS and run it in different platforms (iOS, Web, MacOS), keep reading!",[85,86,88],"h2",{"id":87},"configure-flutter2","Configure Flutter2",[10,90,91],{},"In case you have been working in some Flutter1 projects and you don't want to upgrade them to Flutter2, you have to configure the path for Flutter as following, otherwise you can skip this step.",[10,93,94,95,99],{},"After unzipping downloaded Flutter2 folder, open ",[96,97,98],"strong",{},"Terminal"," app then type:",[101,102,107],"pre",{"className":103,"code":105,"language":106},[104],"language-text","nano ~\u002F.bash_profile\n","text",[108,109,105],"code",{"__ignoreMap":110},"",[10,112,113,114,118],{},"Add alias path to Flutter2 folder to ",[115,116,117],"em",{},".bash_profile"," file:",[101,120,123],{"className":121,"code":122,"language":106},[104],"alias flutter2=\u002Fpath\u002Fto\u002Fflutter2\u002Fbin\u002Fflutter\n",[108,124,122],{"__ignoreMap":110},[10,126,127,128,130],{},"Reload ",[115,129,117],{}," file",[101,132,135],{"className":133,"code":134,"language":106},[104],"source ~\u002F.bash_profile\n",[108,136,134],{"__ignoreMap":110},[10,138,139,140,143],{},"Now when you run ",[96,141,142],{},"flutter2"," command you will work in Flutter2 only. You can check version for sure:",[101,145,148],{"className":146,"code":147,"language":106},[104],"flutter2 --version\n",[108,149,147],{"__ignoreMap":110},[10,151,152],{},"You will see some thing like below:",[101,154,157],{"className":155,"code":156,"language":106},[104],"Flutter 2.0.1 • channel stable • https:\u002F\u002Fgithub.com\u002Fflutter\u002Fflutter.git\nFramework • revision c5a4b4029c (2 weeks ago) • 2021-03-04 09:47:48 -0800\nEngine • revision 40441def69\nTools • Dart 2.12.0\n",[108,158,156],{"__ignoreMap":110},[10,160,161],{},"Upgrade if needed:",[101,163,166],{"className":164,"code":165,"language":106},[104],"flutter2 upgrade\n",[108,167,165],{"__ignoreMap":110},[85,169,171],{"id":170},"create-new-project-and-configure-with-visual-studio-code-vscode","Create new project and configure with Visual Studio Code (VSCode)",[10,173,174,175,177,178],{},"Open ",[96,176,98],{}," app, create a new project named ",[96,179,180],{},"sample_flutter2",[101,182,185],{"className":183,"code":184,"language":106},[104],"flutter2 create sample_flutter2\n",[108,186,184],{"__ignoreMap":110},[10,188,189,190,193,194,197],{},"Open project with VSCode, then add flutter2 SDK path by creating file ",[115,191,192],{},"settings.json"," in folder ",[115,195,196],{},".vs_code\u002F"," then paste following:",[101,199,202],{"className":200,"code":201,"language":106},[104],"{\n\"dart.flutterSdkPath\": \"path\u002Fto\u002Fflutter2\u002Ffolder\"\n}\n",[108,203,201],{"__ignoreMap":110},[85,205,207],{"id":206},"run-in-ios","Run in iOS",[10,209,210,211,214],{},"From ",[96,212,213],{},"VSCode",", select iphone as run device(in here we select iphone simulator iPhone12 Pro Max)",[216,217],"img",{"className":218,"alt":110,"src":221,"style":222},[219,220],"block","mx-auto","https:\u002F\u002Fs3-ap-southeast-1.amazonaws.com\u002Fhomepage-media\u002Fwp-content\u002Fuploads\u002F2021\u002F03\u002F29104853\u002Fselect_iphone.png","width: 50%;",[10,224,225],{},"Then run, easy!!",[216,227],{"className":228,"alt":110,"src":229,"style":222},[219,220],"https:\u002F\u002Fs3-ap-southeast-1.amazonaws.com\u002Fhomepage-media\u002Fwp-content\u002Fuploads\u002F2021\u002F03\u002F29104929\u002Frun_in_iphone.png",[231,232,234],"h4",{"id":233},"build-to-ipa","Build to .ipa",[101,236,239],{"className":237,"code":238,"language":106},[104],"flutter2 build ipa --profile\n",[108,240,238],{"__ignoreMap":110},[10,242,243],{},"Above command will output Runner.xcarchive at folder build\u002Fios\u002Farchive, which click on it will open Xcode, you can archive to .ipa file normally from then",[216,245],{"className":246,"alt":110,"src":247,"style":248},[219,220],"https:\u002F\u002Fs3-ap-southeast-1.amazonaws.com\u002Fhomepage-media\u002Fwp-content\u002Fuploads\u002F2021\u002F03\u002F29131227\u002FScreen-Shot-2021-03-29-at-13.12.14-1024x199.png","width: 100%;",[10,250,251,252,255,256,259],{},"Note: besides ",[115,253,254],{},"--profile"," flag you can also choose ",[115,257,258],{},"--release"," flag for release mode,(Flutter has 3 build mode: debug, profile and release mode)",[85,261,263],{"id":262},"run-in-web","Run in Web",[10,265,210,266,268,269,272],{},[96,267,213],{},", select ",[96,270,271],{},"Chrome"," as run device",[216,274],{"className":275,"alt":110,"src":276,"style":222},[219,220],"https:\u002F\u002Fs3-ap-southeast-1.amazonaws.com\u002Fhomepage-media\u002Fwp-content\u002Fuploads\u002F2021\u002F03\u002F29105750\u002Fselect_device.png",[10,278,279],{},"Then you will see what exactly with iOS version",[216,281],{"className":282,"alt":110,"src":283,"style":248},[219,220],"https:\u002F\u002Fs3-ap-southeast-1.amazonaws.com\u002Fhomepage-media\u002Fwp-content\u002Fuploads\u002F2021\u002F03\u002F29124734\u002Fchrome_result-1024x960.png",[231,285,287],{"id":286},"build-to-html","Build to html",[101,289,292],{"className":290,"code":291,"language":106},[104],"flutter2 build web --web-renderer html --profile\n",[108,293,291],{"__ignoreMap":110},[10,295,296,298,299,302,303,306],{},[115,297,254],{},": build mode (",[115,300,301],{},"profile"," or ",[115,304,305],{},"release"," flag)",[10,308,309,312],{},[115,310,311],{},"--web-renderer html",": render mode, there are 3 options:",[21,314,315,321,327],{},[24,316,317,320],{},[115,318,319],{},"auto",": When app run in mobile browser, it will use HTML render. In case app run in desktop browser, it will use CanvasKit renderer",[24,322,323,326],{},[115,324,325],{},"html",": App always use HTML render.",[24,328,329,332],{},[115,330,331],{},"canvaskit",": App always use Canvaskit render.",[10,334,335,336,339],{},"Above command will output .html, .css, .js files at build\u002Fweb\u002F folder. If you try running ",[115,337,338],{},".\u002Fbuild\u002Fweb\u002Findex.html"," directly in Chrome, you may have the following error:",[101,341,344],{"className":342,"code":343,"language":106},[104],"Access to internal resource at 'file:\u002F\u002F\u002Fmanifest.json' from origin 'null' has been blocked by CORS policy: \nCross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.\n",[108,345,343],{"__ignoreMap":110},[10,347,348,349,354,355,358,359,362],{},"To avoid that, you can use a Chrome's extension named ",[14,350,353],{"href":351,"rel":352},"https:\u002F\u002Fchrome.google.com\u002Fwebstore\u002Fdetail\u002Fweb-server-for-chrome\u002Fofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en)",[18],"Web Server for Chrome"," to simulate a local server on the folder ",[115,356,357],{},".\u002Fbuild\u002Fweb\u002F"," then you can try to run ",[115,360,361],{},"index.html"," again.",[85,364,366],{"id":365},"run-in-mac-os","Run in Mac OS",[10,368,369],{},"You need to enable desktop develop first",[21,371,372],{},[24,373,374,375,378],{},"For ",[96,376,377],{},"MacOS"," development",[101,380,383],{"className":381,"code":382,"language":106},[104],"flutter2 config --enable-macos-desktop\n",[108,384,382],{"__ignoreMap":110},[21,386,387],{},[24,388,374,389,378],{},[96,390,391],{},"Windows",[101,393,396],{"className":394,"code":395,"language":106},[104],"flutter2 config --enable-windows-desktop\n",[108,397,395],{"__ignoreMap":110},[21,399,400],{},[24,401,374,402,378],{},[96,403,404],{},"Linux",[101,406,409],{"className":407,"code":408,"language":106},[104],"flutter2 config --enable-linux-desktop\n",[108,410,408],{"__ignoreMap":110},[10,412,413],{},"Then add desktop support to existing project",[101,415,418],{"className":416,"code":417,"language":106},[104],"flutter2 create --platforms=windows,macos,linux .\n",[108,419,417],{"__ignoreMap":110},[10,421,422],{},"You can choose what OS as you want (windows\u002Fmacos\u002Flinux).",[10,424,425,426,429],{},"From VSCode, select desktop version as run device(in here we select ",[96,427,428],{},"macOS",")",[216,431],{"className":432,"alt":110,"src":433,"style":222},[219,220],"https:\u002F\u002Fs3-ap-southeast-1.amazonaws.com\u002Fhomepage-media\u002Fwp-content\u002Fuploads\u002F2021\u002F03\u002F29140531\u002Fselect_desktop.png",[10,435,436],{},"Then run, that all!!",[216,438],{"className":439,"alt":110,"src":440,"style":248},[219,220],"https:\u002F\u002Fs3-ap-southeast-1.amazonaws.com\u002Fhomepage-media\u002Fwp-content\u002Fuploads\u002F2021\u002F03\u002F29140649\u002Fdesktop_version-1024x738.png",[231,442,444],{"id":443},"output-to-app-file","Output to .app file",[101,446,449],{"className":447,"code":448,"language":106},[104],"flutter2 build macos --profile\n",[108,450,448],{"__ignoreMap":110},[10,452,453,454,457,458,461,462,464],{},"Above command will output ",[115,455,456],{},"sample_flutter2.app"," file at ",[115,459,460],{},"\u002Fbuild\u002Fmacos\u002FBuild\u002FProducts\u002FProfile"," with profile build mode (you can select ",[115,463,258],{}," flag if you want)",[85,466,468],{"id":467},"flutters-pros-good-points","Flutter's pros (Good points)",[21,470,471,474,477,485,491,494,497],{},[24,472,473],{},"Obviously, the best of Flutter is multi-platform supported, which is the good choice for start-up to start with. We can implement from iOS or Android  then re-use source code for Web version in the future with the cost is much below than building from the beginning in each platform.",[24,475,476],{},"The app UI and logic don’t change depending on the platform, it look and work exactly in every platform.",[24,478,479,480],{},"Flutter is growing very fast with many 3rd party libraries at ",[14,481,484],{"href":482,"rel":483},"https:\u002F\u002Fpub.dev\u002F",[18],"pub.dev",[24,486,487,490],{},[96,488,489],{},"Hot reload"," easily with VSCode or Android Studio, so compare with native languages like Swift, Kotlin, developing progress will save a ton of time for debugging, which save much cost in development progress.",[24,492,493],{},"Reduce UI coding time with a lot of custom and ready-made Widget.",[24,495,496],{},"Dart is a simple to learn language, many people with little coding knowledge can develop prototypes and apps.",[24,498,499,500,505,506],{},"Flutter documentations are also highly recommended, those are from the ",[14,501,504],{"href":502,"rel":503},"https:\u002F\u002Fwww.youtube.com\u002Fplaylist?list=PLOU2XLYxmsIL0pH0zWe_ZOHgGhZ7UasUE",[18],"UI tutorial"," understanding easily to the ",[14,507,510],{"href":508,"rel":509},"https:\u002F\u002Fflutter.dev\u002Fdocs\u002Fdevelopment\u002Fui\u002Flayout\u002Fconstraints",[18],"detailed document",[85,512,514],{"id":513},"flutters-cons-disadvantages","Flutter's cons (Disadvantages)",[21,516,517,520,523,526],{},[24,518,519],{},"First of all,Dart is not a widespread language compared to Kotlin, Swift, so you need to learn a new language (Dart), new concepts(BLOC,Widgets,..) for Flutter development",[24,521,522],{},"You still need a good base knowledge in native languages(Swift, kotlin) to solve problems in a specific platform, a OS version, or even in a specific device models which Android has so many trouble on this.",[24,524,525],{},"Not all 3rd libraries support all your expected platforms. Almost of them support iOS and Android (or 1 in 2 only).",[24,527,528],{},"When developing, the error screen that you get when there’s a layout error (or something else at a lower level) can be very confusing.",[216,530],{"className":531,"alt":110,"src":532,"style":533},[219,220],"https:\u002F\u002Fs3-ap-southeast-1.amazonaws.com\u002Fhomepage-media\u002Fwp-content\u002Fuploads\u002F2021\u002F03\u002F29142020\u002Ferror.png","width: 20%;",[21,535,536,545],{},[24,537,538,539,544],{},"There are still animation issues (",[14,540,543],{"href":541,"rel":542},"https:\u002F\u002Fgithub.com\u002Fflutter\u002Fflutter\u002Fissues\u002F61450",[18],"for example","), so please consider this if you want to build an app with complex animation effects.",[24,546,547,548,553],{},"This framework basically aim for building mobile applications so with web or desktop platforms, there are some different UI, UX, so you can not take them all(business, UI, UX) to every platform with the same code. Solution for this issue: you can create common components, business process in a package (",[14,549,552],{"href":550,"rel":551},"https:\u002F\u002Fflutter.dev\u002Fdocs\u002Fdevelopment\u002Fpackages-and-plugins\u002Fdeveloping-packages",[18],"how to do",") then create different projects for each platform implementing those package. Perhaps this is not the best solution but at least you sill can share the common point in every platforms.",[85,555,557],{"id":556},"overview","Overview",[10,559,560],{},"Flutter has many more advantages for business and development teams than risks. It’s a great chance to build beautiful, high-performance, and outstanding apps that fit your custom needs and requirements. It’s worth considering Flutter, especially if you want an app both for iOS and Android.",[10,562,563],{},"Flutter 2 is already available, give it a try and we believe you wont't regret about that!",[85,565,567],{"id":566},"refers","Refers",[21,569,570,575,580,586,592,598,603],{},[24,571,572],{},[14,573,31],{"href":31,"rel":574},[18],[24,576,577],{},[14,578,16],{"href":16,"rel":579},[18],[24,581,582],{},[14,583,584],{"href":584,"rel":585},"https:\u002F\u002Fmedium.com\u002Fcoding-with-flutter\u002Fwhats-great-about-flutter-c1b4e44c69ac",[18],[24,587,588],{},[14,589,590],{"href":590,"rel":591},"https:\u002F\u002Fwww.thedroidsonroids.com\u002Fblog\u002Fflutter-in-mobile-app-development-pros-and-cons-for-app-owners",[18],[24,593,594],{},[14,595,596],{"href":596,"rel":597},"https:\u002F\u002Fflutter.dev",[18],[24,599,600],{},[14,601,482],{"href":482,"rel":602},[18],[24,604,605],{},[14,606,502],{"href":502,"rel":607},[18],{"title":110,"searchDepth":609,"depth":609,"links":610},2,[611,612,613,614,615,616,617,618,619],{"id":87,"depth":609,"text":88},{"id":170,"depth":609,"text":171},{"id":206,"depth":609,"text":207},{"id":262,"depth":609,"text":263},{"id":365,"depth":609,"text":366},{"id":467,"depth":609,"text":468},{"id":513,"depth":609,"text":514},{"id":556,"depth":609,"text":557},{"id":566,"depth":609,"text":567},[621,622],"tech talk","mobile","Briswell Vietnam Co Ltd","2021-04-22","At 2021\u002F3\u002F4, Flutter2 was released with new features added: Web's , desktop's support has been in stable channel (they were in beta channel before), which mean you can bring your app officially to Web, Mac OS and Windows OS.","md",{},true,"\u002Fnews\u002Fflutter2",null,{"title":5,"description":625},"news\u002Fflutter2","https:\u002F\u002Fs3-ap-southeast-1.amazonaws.com\u002Fhomepage-media\u002Fwp-content\u002Fuploads\u002F2021\u002F04\u002F06103446\u002Fflutter2.png","usRtTzz7UUeW8NgKYZ4UtfzVvJHqNqUnb0BrZM_AxU8",1782263085487]