12
go-dev
 -blog
  -blog-server
  -blogpb
    - blog.proto
 -other 
 -dart

i have a directory like that on my project blogpb is the directory where i create .proto file to dart directory, when i run this command:

 protoc -I=. --dart_out=$DST_DIR $SRC_DIR/blogpb/blog.proto  
 // got : Could not make proto path relative: /blogpb/blog.proto: No such file or directory

 protoc --dart_out=grpc:lib/src/generated -Iprotos greet/greetpb/greet.proto
 // got : protos: warning: directory does not exist.
 //       Could not make proto path relative: greet/greetpb/greet.proto: No such file or directory

what is the wrong command above ? and how to create the generated into dart directory for this?

Eli Bendersky
  • 263,248
  • 89
  • 350
  • 412
jhgju77
  • 1,021
  • 1
  • 6
  • 14

1 Answers1

4

I could make it work that I must create directory lib/src/generated and change the command to

protoc --dart_out=grpc:lib/src/generated -Iblogpb blogpb/blog.proto    

-Iblogpb meant what the directory of our *.proto

if you want myprotos, you can change -Iblogpb to -Imyprotos :)

jhgju77
  • 1,021
  • 1
  • 6
  • 14
  • 1
    I don't know how, but it really worked. Changing the gradle version, changing packages versions, adding a package that fixes enum errors did not help, but your solution helped. Thank you very much! Only we moved the generation to `lib/generated` – politebarista Oct 06 '22 at 08:41