背景
今天在<极客>APP上看到一个《使用Flutter快速构建集美观与高性能于一体的移动应用》的介绍,瞬间想试试,于是找到了Flutter官网(https://flutter.cn/)并按步骤实操起来。
1、获取 Flutter SDK,下载安装在我的MacOS 10.14.4
2、配置环境变量
#打开配置文件
> cd ~
> open .bash_profile
#添加环境变量(第一行填写flutter实际安装路径)
export PATH=/Users/mac/tools/flutter/bin:$PATH
export PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub
export FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter
#安装完成后,使用以下命令诊断flutter安装情况
> flutter doctor
开发工具配置
1、开发工具使用:VScode
2、安装flutter插件
开发初体验
- Invoke View > Command Palette.
- Type “flutter”, and select the Flutter: New Project.
- Select Application.
- Create or select the parent directory for the new project folder.
- Enter a project name, such as
myapp
, and press Enter.
- Wait for project creation to complete and the
main.dart
file to appear.
安装以上步骤,会生成一套flutter工程,如下操作:
运行工程:
运行效果(启动运行较慢,后续开发热加载较快):
初体验完成,后续按照<官网>参考继续编写小应用即可。