-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package import statement generated with well-defined type is not correct. #76
Comments
Imports look correct to me. What error are you getting? If I try your sample as is, I get this error when trying to analyze the project:
if that's the error you're seeing, then the reason is that you haven't generated Dart sources for Somewhat unfortunately, the protoc compiler only generates sources for the files you've listed on the command line, so you'll need to add timestamp there as well. On my machine, it's If you're getting another error, please let me know what it is. |
That is exactly the error I am getting. I tried following the example for what you suggested, using the only example I could find was in C#. Is there a Dart equivalent? |
That did not solve the problem. I have tried adding the following code on OSX: PROTO_ROOT_DIR = $(shell brew --prefix)/Cellar/protobuf/3.5.1_1/include/google/protobuf
.PHONY: mobile-stub
mobile-stub:
@mkdir -p lib/client
@protoc -I. -I$(PROTO_ROOT_DIR)/timestamp.proto --dart_out=grpc:lib/client service.proto I originally wrote the code in Go and tried to compile to Dart. I attempted to move the service.proto to the dart app - and it created the same output as when I originally opened the issue. |
You need to have protoc generate the Dart stubs for google/protobuf/timestamp.proto as well, so you either have to add
On my macOS box, The reason you don't need to do this for Go, is that the Go protobuf package includes prebuilt stubs for these types. |
Very clear and thank you for your patience. This issue can be closed. |
I had the same problem dealing with money.proto and my solution was.
|
When compiling using the following command, the import statement is not Dart code. Are there any examples for how to handle this - thank you!
<version of the grpc-dart packages used; see your
pubspec.lock
file>Repro steps
protoc -Iprotos -I $(GOPATH)src/github.com/golang/protobuf/ptypes/timestamp --dart_out=grpc:proto_out/service.proto
Expected result: Usable dart import package declaration for the well-defined types
Actual result: package import declaration causes an error and compilation is not possible.
Details
Below is a snipped of the
.proto
file. I am trying to create a client stub (the server is written in Go). I have confirmed the client stub exported from Go works.Upon running the
protoc
command the output is:The text was updated successfully, but these errors were encountered: