flutter将proto文件编译成dart文件

1.https://github.com/protocolbuffers/protobuf/releases去这里下载。
2.然后:(在解压缩的目录下执行)
C:\Users\soda\Downloads\protobuf-all-3.20.0\protobuf-3.20.0>dart pub global activate protoc_plugin
3.你会看到:
Pub installs executables into C:\Users\soda\AppData\Local\Pub\Cache\bin, which is not on your path.

3.切到对应目录下(你也可以加到环境变量里去)
C:\Users\soda\AppData\Local\Pub\Cache\bin>protoc --dart_out=E:/test2 -I E:/test2/ rserver.proto

注意:最后那个文件和路径之间有两个空格,切记

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容