mac flutter pb解析报错:protoc-gen-dart: program not found or is not executable

在mac对pb文件转dart文件的时候报错:protoc-gen-dart: program not found or is not executable

原因是没有安装protoc-gen-dart或者protoc-gen-dart没有设置到环境变量中

解决办法:

1、安装protoc-gen-dart

flutter pub global activate protoc_plugin

2、执行protoc命令的时候带上--plugin参数

protoc --dart_out=. --plugin=protoc-gen-dart=$HOME/.pub-cache/bin/protoc-gen-dart ./aaa.proto

你可能感兴趣的:(macos,flutter,android)