Flutter学习笔记(一)

安装flutter:https://flutter.io/setup-macos/

环境要求:

  • Operating Systems: macOS (64-bit)

  • Disk Space: 700 MB (does not include disk space for IDE/tools).

  • Tools: Flutter depends on these command-line tools being available in your environment.

  • bash, mkdir, rm, git, curl, unzip, which

配置国内镜像

export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

下载代码到本地:

cd /usr/local git clone -b dev https://github.com/flutter/flutter.git

添加到path目录,可全局访问

export PATH="$PWD/flutter/bin:$PATH"

安装IDE插件

Android Studio: Flutter、Dart

VS Code: Flutter

运行flutter环境检查程序,检查本地环境安装情况 cd ./flutter flutter doctor

IOS环境配置:

  1. 安装Xcode 9.0及以上
  2. sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
  3. 接受xcode协议,打开Xcode工具接受协议,或执行命令: sudo xcodebuild -license
  4. 发布到真机需要安装的环境:

安装homebrew,如果已安装跳过

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装依赖的软件:

brew update brew install --HEAD libimobiledevice brew install ideviceinstaller ios-deploy cocoapods pod setup

常用命令:

启动IOS模拟器:

open -a Simulator

运行flutter程序:

flutter run //运行程序
flutter test //运行测试用例

执行flutter安装环境检查

flutter doctor

常用命令

flutter packages get //下载依赖
flutter packages upgrade //更新依赖
flutter packages test //运行测试
flutter packages pub

flutter完整命令列表:

analyze Analyze the project's Dart code.
attach Attach to a running application.
bash-completion Output command line shell completion setup scripts.
build Flutter build commands.
channel List or switch flutter channels.
clean Delete the build/ directory.
config Configure Flutter settings.
create Create a new Flutter project.
devices List all connected devices.
doctor Show information about the installed tooling.
drive Runs Flutter Driver tests for the current project.
emulators List, launch and create emulators.
format Format one or more dart files.
fuchsia_reload Hot reload on Fuchsia.
help Display help information for flutter.
install Install a Flutter app on an attached device.
logs Show log output for running Flutter apps.
packages Commands for managing Flutter packages.
precache Populates the Flutter tool's cache of binary artifacts.
run Run your Flutter app on an attached device.
screenshot Take a screenshot from a connected device.
stop Stop your Flutter app on an attached device.
test Run Flutter unit tests for the current project.
trace Start and stop tracing for a running Flutter app.
upgrade Upgrade your copy of Flutter.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom阅读 2,729评论 0 3
  • Making it easy to add Flutter to an existing app is work ...
    共田君阅读 1,976评论 0 2
  • 打包发布android的准备 1.1 创建app keystore文件 如果有 keystore,请跳至下一步。如...
    AJI大侠阅读 1,068评论 0 0
  • 在我们学游泳时有没有这样的体验,初学者越是惧怕水,非常担心自己会沉下去,就越会非常的用力划水,结果整个姿势都会很僵...
    长风VS破浪阅读 238评论 0 0
  • 小鹿有个同事是个急脾气。然而,小鹿却是一个踏踏实实做事的慢性子。 这两个人撞到一起,竟然没有擦出火花也是非常的难得...
    微笑加油阅读 836评论 0 2