欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

flutter安装及项目踩坑

程序员文章站 2022-06-16 08:26:45
1.安装brew (Failed to connect to raw.githubusercontent.com port 443: Connection refused)/bin/zsh -c “$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)”管网历史版本https://flutter.dev/docs/development/tools/sdk/releases?tab=macos#macos将sd...

1.安装brew (Failed to connect to raw.githubusercontent.com port 443: Connection refused)

/bin/zsh -c “$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)”

管网历史版本
https://flutter.dev/docs/development/tools/sdk/releases?tab=macos#macos

将sdk拖到文档目录

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/Yiwi/Documents/flutter/bin:$PATH

flutter doctor

flutter vscode插件推荐

  1. Flutter 与 Dart

  2. 模版神器
    Awesome Flutter Snippets

3.对Dart语法有帮助的神器
Bracket Pair Colorizer

  1. 对项目开发有帮助的插件
    Material Icon Theme

配置 Flutter iOS环境

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller ios-deploy cocoapods
pod setup

cd到目录下面
flutter pub get
cd ios目录下面
pod install

常见错误处理

1.warning: The iOS deployment target ‘IPHONEOS_DEPLOYMENT_TARGET’ is set to 4.3,
but the range of supported deployment target versions is 8.0 to 13.4.99.
config.build_settings[‘IPHONEOS_DEPLOYMENT_TARGET’] = ‘9.0’

2.flutter1.7.0版本对用的dio 库会出问题将dio 版本升到3.0.0以上(3.0.9)
dio.options.contentType = ContentType.parse(‘application/x-www-form-urlencoded’);
报错在后面加上.toString()

3.flutter1.5.0版本的fluro 里面会有个路由类名冲突

本文地址:https://blog.csdn.net/yxw125125/article/details/109641132