@TryLoveCatch
2019-09-19T07:14:20.000000Z
字数 5338
阅读 1766
flutter
export PUB_HOSTED_URL=https://pub.flutter-io.cnexport FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
Using Flutter in China
官网链接,里面有最新的镜像地址
Flutter中文版
右上角,有一个使用镜像,点击就能看到最新的镜像地址
另外,下载之后,如果需要不同的flutter版本,我们是可以通过git来切换tag的
open ~/.bash_profileexport FLUTTER_HOME=/Users/lipeng/work/flutter-sdkexport PATH=$PATH:$FLUTTER_HOME/flutter/binsource ~/.bash_profileecho $path
flutter doctor
这个命令会检查你当前的配置环境,并在命令行窗口中生成一份报告。
Doctor summary (to see all details, run flutter doctor -v):[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.13.6 17G65, localezh-Hans-CN)[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)! Some Android licenses not accepted. To resolve this, run: flutter doctor--android-licenses[✗] Xcode - develop for iOS and macOS✗ Xcode installation is incomplete; a full installation is necessary for iOSdevelopment.Download at: https://developer.apple.com/xcode/download/Or install Xcode via the App Store.Once installed, run:sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer✗ CocoaPods not installed.CocoaPods is used to retrieve the iOS and macOS platform side's plugincode that responds to your plugin usage on the Dart side.Without CocoaPods, plugins will not work on iOS or macOS.For more info, see https://flutter.dev/platform-pluginsTo install:brew install cocoapodspod setup! Brew can be used to install CocoaPods.Download brew at https://brew.sh/.[✗] iOS tools - develop for iOS devices✗ libimobiledevice and ideviceinstaller are not installed. To install withBrew, run:brew updatebrew install --HEAD usbmuxdbrew link usbmuxdbrew install --HEAD libimobiledevicebrew install ideviceinstaller✗ ios-deploy not installed. To install:brew install ios-deploy! Brew can be used to install tools for iOS device development.Download brew at https://brew.sh/.[!] Android Studio (version 3.2)✗ Flutter plugin not installed; this adds Flutter specific functionality.✗ Dart plugin not installed; this adds Dart specific functionality.[!] VS Code (version 1.36.0)✗ Flutter extension not installed; install fromhttps://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter[✓] Connected device (1 available)! Doctor found issues in 5 categories.
对照提示,进行修改
然后再次执行
flutter doctor

flutter cleanflutter packages get
flutter -h
执行结果:
Manage your Flutter app development.Common commands:flutter create <output directory>Create a new Flutter project in the specified directory.flutter run [options]Run your Flutter application on an attached device or in an emulator.Usage: flutter <command> [arguments]Global options:-h, --help Print this usage information.-v, --verbose Noisy logging, including all shell commands executed.If used with --help, shows hidden options.-d, --device-id Target device id or name (prefixes allowed).--version Reports the version of this tool.--suppress-analytics Suppress analytics reporting when this command runs.--bug-report Captures a bug report file to submit to the Flutter team.Contains local paths, device identifiers, and log snippets.--packages Path to your ".packages" file.(required, since the current directory does not contain a ".packages" file)Available commands: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/ and .dart_tool/ directories.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.help Display help information for flutter.install Install a Flutter app on an attached device.logs Show log output for running Flutter apps.make-host-app-editable Moves host apps from generated directories to non-generated directories so that they can be edited by developers.precache Populates the Flutter tool's cache of binary artifacts.pub Commands for managing Flutter packages.run Run your Flutter app on an attached device.screenshot Take a screenshot from a connected device.test Run Flutter unit tests for the current project.upgrade Upgrade your copy of Flutter.version List or switch flutter versions.
我们可以看到flutter支持的command:
analyzebuildchannelcleanconfigcreatedevicesdoctordriveemulatorsformathelpinstalllogsmake-host-app-editableprecachepubrunscreenshottestupgradeversion
我们已build为例
flutter build -h
执行结果:
Flutter build commands.Usage: flutter build <subcommand> [arguments]-h, --help Print this usage information.Available subcommands:aot Build an ahead-of-time compiled snapshot of your app's Dart code.apk Build an Android APK file from your app.appbundle Build an Android App Bundle file from your app.bundle Build the Flutter assets directory from your app.ios Build an iOS application bundle (Mac OS X host only).Run "flutter help" to see global options.
flutter --versionFlutter 1.7.8+hotfix.4 • channel stable • https://github.com/flutter/flutter.gitFramework • revision 20e59316b8 (5 weeks ago) • 2019-07-18 20:04:33 -0700Engine • revision fee001c93fTools • Dart 2.4.0
导入项目的时候,遇到了这个问题,那是因为需要需要下载这些包:
flutter packages get