Protobuf compile issues

Hi,

I’m new to IDX and Flutter and wanted to learn by creating a simple app. I created a protobuf to represent the data and I can’t seem to compile it and get the generated classes. I tried installing the protobuf package and rebuilt the workspace. I’m running the protoc command in the terminal and get the following message:

protoc-gen-dart: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
–dart_out: protoc-gen-dart: Plugin failed with status code 1.

Wondering if anyone has this working and could share the steps?

Screenshot of my dev.nix file.

Thanks!

Hi @Knasr - is the package you are installing the same as this?

If so, can you try adding it via the Terminal using the commands described here? protobuf install | Dart package

Thanks,
Kirupa

Thanks for the help. I don’t think it’s the same package so I want to install it using the recommendation. However, I removed the other package and extension manually in the dev.nix file and selected to rebuild the environment. I think my manual edits put the workspace in a broken state. Now I’m stuck on the “Building environment” screen and I don’t see any option how to revert the changes and get back into my project. Is there a way to get back into see my files and update them?

I started a new project to try out the commands suggested. It did not resolve the issue with the protobuf compilation.

It updated the pubspec.yaml to have this

dependencies:
  protobuf: ^3.1.0

but when I run the protoc command I still get this error

protoc-gen-dart: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--dart_out: protoc-gen-dart: Plugin failed with status code 1.

Run

dart pub global activate protoc_plugin

This command would create protoc-gen-dart inside the folder

~/.pub-cache/bin/
1 Like

Perfect, that works. Thank you!

2 Likes