Following the instruction here to install Dart
For me, I just download the
debfile and install it.
sudo dpkg -i dart_2.1.0-1_amd64.deb
After that we can use
dartin terminal, but we cannot find
pub. The reason is beacuse it is located in
usr/lib/dart/binTherefore, we’d better change the PATH permanently.
Change the PATH permanently for
Then add the following to the end of
Logout and login again to let the modification take effect. Type
pubin terminal, we will see it works.
The simplest way is to use to precompiled
protocbinary and put it into
For me, I download the
protoc-3.6.1-osx-x86_64.zip. Unzip it, and put
Then, we type
protocin terminal, we will see it works.
In the terminal, type
pub global activate protoc_plugin
Right now, I’m in China. For reasons known to all, I have to use the mirror
However, it is installed in
$HOME/.pub-cache/bin. We’d better make it into
Using the same way in
Now, the last line looks like
You need to logout and login to again to take effect.
Finally, we can compile
For me, I just go to the directory containing the
.protofile, using the command below, and it will generate the
.dartfile(s) you need. You can copy them to your
protc --dart_out=. ./YourFile.proto
Install protobuf runtime library
Don’t forget to install the runtime library by adding
protobuf: ^0.11.0in your
That’s it! Hope it will save your time to build your flutter project with awesome protobuf!