企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## flutter create ``` flutter create projectName 用法: -template=type 指定不同的项目类型, -template=ap|/modul|/package|plugin|skeleton 指定平台: -platforms=ios|android|windows|linux||macosweb -a: 指定android开发使用的语言,默认是kotlin -i: 指定ios使用的语言,默认是swit ``` 示例 创建一个module ``` flutter create --template=module --platforms=android,ios helloiMooc ``` 对已经存在的项目添加其他平台 ``` flutter create . ``` ## flutter build 格式 ``` flutter build <subcommand> [arguments] Available subcommands: aar Build a repository containing an AAR and a POM file. 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. web Build a web application bundle. windows Build a Windows desktop application. ``` 示例 ``` flutter build web ``` ## flutter upgrade 升级 flutter sdk 等组件 ``` flutter upgrade [--force] ``` ## flutter devices ``` > flutter devices Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! Found 4 connected devices: sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 15 (API 35) (emulator) Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19045.4529] Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.116 Edge (web) • edge • web-javascript • Microsoft Edge 126.0.2592.87 ``` ## flutter pub ``` > flutter pub <subcommand> [arguments] cache 列出本地缓存的软件包 deps 列出项目依赖项的详细信息 downgrade Downgrade packages in a Flutter project. get Get the current package's dependencies. global Work with Pub global packages. login Log into pub.dev. logout Log out of pub.dev. outdated Analyze dependencies to find which ones can be upgraded. pub Pass the remaining arguments to Dart's "pub" tool. publish Publish the current package to pub.dartlang.org. remove Removes a dependency from the current package. run Run an executable from a package. test Run the "test" package. token Manage authentication tokens for hosted pub repositories. upgrade Upgrade the current package's dependencies to latest versions. uploader Manage uploaders for a package on pub.dev. version Print Pub version. ``` ## flutter test 格式 ``` flutter test [arguments] [files or directories] ``` 示例 ``` 运行所有单元测试:flutter test 运行所有集成测试:flutter test test_driver/*.dart 运行指定的测试文件:flutter test test/<filename>.dart 运行指定的测试套件:flutter test test/<filename>.dart -n <test-suite-name> 生成测试覆盖率报告:flutter test --coverage 在特定的测试环境下运行测试:flutter test -c profile 随机运行测试用例以避免顺序偏差:flutter test --test-randomize-ordering-seed=random ```