Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

a dart build package to compile protocol buffer
files to dart source code using build_runner (i.e.
the dart build pipline) without needing to manually install the protoc
compiler or the dart protobuf plugin protoc_plugin.

the protoc_builder package downloads the necessary protobuf dependencies for your platform to a
temporary local directory, thereby streamlining the development process.

installation

add the necessary dependencies to your pubspec.yaml file:

dev_dependencies:
  build_runner: <latest>
  protoc_builder: <latest>

configuration

you must add your .proto files to a build.yaml file next to the pubspec.yaml:

targets:
  $default:
    sources:
      - $package$
      - lib/$lib$
      - proto/** # your .proto directory

this will use the default configuration for the protoc_builder.

you may also configure custom options:

targets:
  $default:
    sources:
      - $package$
      - lib/$lib$
      - proto/**
    builders:
      protoc_builder:
        options:
          # the version of the protobuf compiler to use.
          protobuf_version: "3.19.1" # make sure to use quotation marks.
          # the version of the dart protoc_plugin package to use.
          protoc_plugin_version: "20.0.0" # make sure to use quotation marks.
          # include paths given to the protobuf compiler during compilation.
          proto_paths:
            - "proto/"
          # the root directory for generated dart output files.
          out_dir: "lib/src/generated"

running

once everything is set up, you may simply run the build_runner package:

pub run build_runner build

the build_runner sometimes caches results longer than it should, so in some cases, it may be necessary to delete the .dart_tool/build directory.


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top