dart - OSx 上的 gRPC、ProtoCol BUffer 和 Flutter
问题描述
我想在 OSx 上开发的 Flutter/Dart 应用程序和 GoLang 服务器之间使用 gRPC / ProtoBuffers。我的想法是替换 REST 连接。我的问题是我无法在 OSx 上为 DART 安装 Protobuf .... 或者至少,我似乎无法弄清楚。
这个 URL 最后说 Protobuf for DART 仅支持 Ubuntu。
https://chromium.googlesource.com/external/github.com/google/protobuf/+/HEAD/README.md
问题
- 对于 Dart Flutter 的 OSx 上的 Protobuf 还没有工作,这是正确的吗?
- 有什么提示或技巧可以让它发挥作用吗?我在这里错过了什么?
解决方案
首先,您应该通过 homebrew 安装 protobuf。
brew install protobuf
如果您没有brew
命令,请参阅如何为 MacOsX 安装包管理器 HomeBrew。
其次,你应该安装 Dart,见这里https://www.dartlang.org/tools/sdk#install
三、安装插件 dart-protoc-plugin https://github.com/dart-lang/dart-protoc-plugin#how-to-build-and-use
四、查看本指南如何生成 .dart 类 https://developers.google.com/protocol-buffers/docs/darttutorial
第五,遵循 dart-grpc 的本指南 https://grpc.io/docs/tutorials/basic/dart.html
推荐阅读
- javascript - 使用循环键计算对象值
- git - 无法建立真实性主机 github.com (140.82.xxx.x) - RSA 密钥指纹为 SHA256:nThbgh78...您确定要继续吗?
- youtube-dl - 尝试使用 Youtube-DL 下载视频
- javascript - IndexedDB - IDBObjectStore.get 与 IDBKeyRange - 请求只返回单个对象?
- python - 检查文件是否正在python中复制?
- pandas - 从另一个缺少日期的数据框中返回最近三天的值
- laravel - 使用 FormData 将数据从 Vue 传递到 Laravel 的整数问题
- android - 我应该在哪里使用单例,我应该在哪里为 1 活动应用程序使用视图模型?
- flutter - 颤振:使用带有页面的导航器时如何处理后退按钮按下
- java - Springboot 2.4.0-RC1 和 Spring Cloud Config (Illford) - java.lang.VerifyError:无法从最终类继承