一、安装get_cli脚手架
1、终端执行:flutter pub global activate get_cli
2、安装成功后,终端会提示配置环境变量
需要配置两个文件:
vim ~/.bash_profile
vim ~/.zshrc
让配置环境变量生效
source ~/.bash_profile
source ~/.zshrc
二、get_cli命令行
初始化项目:get init
创建页面:get create page:页面名 on 目录名
创建控制器:get create controller:控制器名 on 目录名
创建view:get create view:view名 on 目录名
创建provider:get create provider:provider名 on 目录名
三、报错解决
这行get init时,出现一下错误
Unhandled exception:
Synchronous waiting using dart:cli waitFor and C API Dart_WaitForEvent is deprecated and disabled by default. This feature will be fully removed in Dart 3.4 release. You can currently still enable it by passing --enable_deprecated_wait_for to the Dart VM. See https://dartbug.com/52121.
解决方法:
执行: flutter pub global activate --source=git https://github.com/inyong1/get_cli.git
参考文章:github
网友评论