flutter初体验(环境配置)

flutter初体验(环境配置)
文章图片
前言
Flutter是谷歌的移动UI框架,可以快速在iOS和Android上构建高质量的原生用户界面。 Flutter可以与现有的代码一起工作。在全世界,Flutter正在被越来越多的开发者和组织使用,并且Flutter是完全免费、开源的。

  • 快速开发
    • 毫秒级的热重载,修改后,您的应用界面会立即更新。使用丰富的、完全可定制的widget在几分钟内构建原生界面。
  • 富有表现力和灵活的UI
    • 快速发布聚焦于原生体验的功能。分层的架构允许您完全自定义,从而实现难以置信的快速渲染和富有表现力、灵活的设计。
  • 原生性能
    • Flutter包含了许多核心的widget,如滚动、导航、图标和字体等,这些都可以在iOS和Android上达到原生应用一样的性能。
官方说的这么牛x,能不了解一下吗!本系列为本人学习flutter的学习笔记,重在记录学习中遇到的问题。
环境配置
Flutter 1.0.0
Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
Xcode Version 10.1 (10B61)
IntelliJ IDEA 2018.3.2 (Ultimate Edition)
VS Code 1.30.1 (1.30.1)
安装与环境搭建
参考flutter中文网或者自行Google,前人之述备矣,此处不再赘述。
配置编辑器
本人为iOS开发,未安装过Android Studio,所以不具备安卓开发环境。
为了亲自体验一下不同编辑器,所以安装了IntelliJ IDEA 和 VS Code体验flutter开发。VS Code的配置参考官方教程。IntelliJ IDEA的配置参考官方教程。IntelliJ IDEA需要安装flutter和dart插件,在IntelliJ IDEA安装插件需要翻墙,也可以去官方插件库搜索插件从磁盘安装。从磁盘安装插件极有可能重启应用后报错闪退,修复方法是在应用目录下~/Library/Application Support/中把安装的插件删除即可。推荐翻墙从应用内搜索插件安装插件。

flutter初体验(环境配置)
文章图片
[图片上传中...(WX20181228-112812@2x.png-e23a9d-1545968380976-0)]
常用命令
  • flutter doctor: 坚持flutter开发环境信息.
  • flutter create: 创建一个新的flutter项目.
  • flutter run: 在已运行的设备上运行flutter应用.
更多命令直接运行flutter进行查看。
Global options: -h, --helpPrint this usage information. -v, --verboseNoisy logging, including all shell commands executed. If used with --help, shows hidden options.-d, --device-idTarget device id or name (prefixes allowed). --versionReports the version of this tool. --suppress-analyticsSuppress analytics reporting when this command runs. --bug-reportCaptures a bug report file to submit to the Flutter team. Contains local paths, device identifiers, and log snippets.--packagesPath to your ".packages" file. (required, since the current directory does not contain a ".packages" file)Available commands: analyzeAnalyze the project's Dart code. attachAttach to a running application. bash-completionOutput command line shell completion setup scripts. buildFlutter build commands. channelList or switch flutter channels. cleanDelete the build/ directory. configConfigure Flutter settings. createCreate a new Flutter project. devicesList all connected devices. doctorShow information about the installed tooling. driveRuns Flutter Driver tests for the current project. emulatorsList, launch and create emulators. formatFormat one or more dart files. helpDisplay help information for flutter. installInstall a Flutter app on an attached device. logsShow log output for running Flutter apps. make-host-app-editableMoves host apps from generated directories to non-generated directories so that they can be edited by developers. packagesCommands for managing Flutter packages. precachePopulates the Flutter tool's cache of binary artifacts. runRun your Flutter app on an attached device. screenshotTake a screenshot from a connected device. stopStop your Flutter app on an attached device. testRun Flutter unit tests for the current project. traceStart and stop tracing for a running Flutter app. upgradeUpgrade your copy of Flutter.

快速开始
终端 终端在适合的目录下运行flutter create flutter_app创建一个名为flutter_app的应用。
IntelliJ IDEA 从Flutter入门应用程序模板创建一个新的Flutter IntelliJ项目:
  1. 在IntelliJ中,在 ‘Welcome’ 窗口点击 Create New Project
  2. 或者在主界面 File>New>Project…
  3. 在菜单中选择 Flutter , 然后点击 Next.
  4. 输入Project name 和 Project location,点击 Finish.
VS Code 从Flutter入门应用程序模板创建一个新的Flutter项目:
  1. 打开 Command Palette (Ctrl+Shift+P (Cmd+Shift+P on macOS)).
  2. 选择 Flutter: New Project命令并回车。
  3. 输入Project name 和 Project location
开发工具简单应用教程
在IDE中开发Flutter应用
英文还可以的同学参考官方的英文教程,官方提供了Android Studio / IntelliJ和VS Code的简单开发教学。
IntelliJ中直接在顶部工具栏就可以操做,VS Code按F5运行项目并显示工具栏。

flutter初体验(环境配置)
文章图片
相关参考
【flutter初体验(环境配置)】flutter中文网
在IDE中开发Flutter应用

    推荐阅读