環境搭建完成以後,咱們來看看Flutter:New Project後生成的項目結構。
具體環境搭建能夠參考:w7上使用VSCode配置Flutter開發環境web
與Node.js的package.json文件的類比
(由於我在web開發裏是使用Node.js來作包管理的,因此類比nonde.js的package.json對於由web入門學習flutter的同窗會比較容易理解。)npm
簡單而言,pubspec.yaml文件的做用就至關於Node.js的package.json文件,是用來進行包管理的;
二者都分離了兩個環境,dependencies和dev_dependencies;
前者使用yaml語法來定義,後者使用json語法;
pubspec.yaml對版本的約束規則與package.json規則相似;json
Node.js | Flutter | |
安裝依賴 | npm install | flutter package get |
升級依賴包版本 | npm update | flutter packages upgrade |
協同開發保證包版本一致 | package-lock.json | pubspec.lock |
關於此後續能夠再豐富~~segmentfault
#包名 name: todo_app #描述信息 description: A new Flutter project. #版本號 version: 1.0.0+1 #指定環境 environment: sdk: ">=2.0.0-dev.68.0 <3.0.0" #指定包依賴 dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.2 english_words: ^3.1.0 #指定開發環境下的包依賴 dev_dependencies: flutter_test: sdk: flutter # For information on the generic Dart part of this file, see the # following page: https://www.dartlang.org/tools/pub/pubspec # The following section is specific to Flutter. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true