1

【笔记】Flutter学习笔记

 1 year ago
source link: https://loli.fj.cn/2023/06/09/Flutter%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【笔记】Flutter学习笔记

Flutter学习笔记

下载Flutter

brew install flutter

配置国内源(可选)

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

下载AndroidStudio

传送门

  • 在AndroidStudio中的Android SDK Manager中安装Android SDK Command-line Tools

flutter doctor --android-licenses

下载真机调试环境(可选)

  • 如果有一台Android手机作为真机调试工具,需要在Android SDK Manager中下载对应Android版本的SDK Platforms

下载Cocoapods

通过brew安装Cocoapods

brew install cocoapods
pod setup

直接通过Ruby安装Cocoapods

sudo gem install cocoapods
  • activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
  • gem版本过低,需要升级版本
sudo gem install activesupport -v 6.1.7.3
下载时查看日志
  • 如果下载缓慢可以在下载时查看日志
sudo gem install cocoapods -V
换源(可选)
  • 如果下载缓慢可以替换国内源
查看当前源
gem sources -l
替换国内源
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
还原默认源
gem sources --add https://rubygems.org/ --remove https://gems.ruby-china.com/

下载XCode

传送门

  • 切换命令行工具为XCode而不是XCode Command-line Tool
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
  • 首次启动XCode
sudo xcodebuild -runFirstLaunch

Flutter环境检测

flutter doctor

查看详细信息

flutter doctor -v

查看所有设备

flutter devices

<project_name>:项目名称

--org com:添加包名

com:包名,域名反写,不需要再添加一次项目名
--description <text>:添加项目描述

flutter create <project_name>
flutter run

运行在所有设备上

<device>:启动调试的设备ID或设备名

all:所有设备同时启动调试

flutter run -d <device>
  • 在启动后的终端通过快捷键可以实现指定命令

r:热加载
R:热重启
p:显示/隐藏定位网格
o:切换Android/ios预览模式
q:退出调试

哔哩哔哩——筱筱知晓
稀土掘金——旺仔小小馒头


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK