【发布时间】:2021-03-20 21:12:24
【问题描述】:
我正在尝试使用 protoc-plugin 将 proto 文件生成到 dart 文件,请遵循此指令 https://grpc.io/docs/quickstart/dart/ 但是当我运行此命令行时
$ protoc --dart_out=grpc:lib/src/generated -Iprotos protos/helloworld.proto
发生这种类型的错误
PS G:\Flutter Implelemt\helloworld> protoc --dart_out=grpc:lib/src/generated -Iprotos
protos/helloworld.proto
protos: warning: directory does not exist.
Could not make proto path relative: protos/helloworld.proto: No such file or directory
PS G:\Flutter Implelemt\helloworld>
使用的依赖项
grpc: ^0.6.6
protobuf: ^1.1.0
protoc_plugin: ^19.2.0+1
helloworld.proto
syntax = "proto3";
package helloworld;
service Greeter {
rpc SayHello ( HelloRequest ) returns ( HelloReply ) {}
}
message HelloRequest {
string name = 1 ;
}
message HelloReply {
string message = 1 ;
}
我也试试下面的命令
PS G:\Flutter Implelemt\helloworld> protoc --dart_out=grpc:lib/src/pb --proto_path
lib/protos/helloworld.proto
Missing input file.
PS G:\Flutter Implelemt\helloworld>
如何在dart/flutter中生成或编译.proto文件
在此先感谢 :)
【问题讨论】:
-
您好,您的问题解决了吗?
标签: flutter dart grpc dart-pub proto