protobuf_runner 1.0.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 50

protobuf_runner

Builds Dart protocol buffers.

Example:

Make a protobuf file:

syntax = "proto2";

package address_book;

message Person {
    required string name = 1;
    required int32 id = 2;
    optional string email = 3;

    enum PhoneType {
        MOBILE = 0;
        HOME = 1;
        WORK = 2;
    }

    message PhoneNumber {
        required string number = 1;
        optional PhoneType type = 2 [default = HOME];
    }

    repeated PhoneNumber phones = 4;
}

message AddressBook {
    repeated Person people = 1;
}

Run the command:

pbuf address_book.proto

Enjoy your new Protocol Buffer!

import 'package:dart_protobuf_example/address_book.pb.dart';

main() {
  var people = [
    new Person()..name = "Jack Ryan"..email = "jack.ryan@gmail.com",
    new Person()..name = "Brad Ryan"..email = "brad.ryan@gmail.com"
  ];
  var x = new AddressBook();
  x.people.addAll(people);
  print(x.writeToJson());
  // prints {"1":[{"1":"Jack Ryan","3":"jack.ryan@gmail.com"},{"1":"Brad Ryan","3":"brad.ryan@gmail.com"}]}
}

Getting Started:

Install the latest protoc command:

brew install protoc

Install dart_protoc_plugin on your machine:

git clone git@github.com:dart-lang/dart-protoc-plugin.git
cd dart-protoc-plugin
pub get

Install this tool:

pub global activate protobuf_runner

Usage

Option 1: using the DART_PROTOC_PLUGIN environment variable:

export DART_PROTOC_PLUGIN=/path/to/dart-protoc-plugin 
pbuf /path/to/project/lib/address_book.proto

Option 2: using the --plugin flag:

pbuf --plugin=/path/to/dart-protoc-plugin /path/to/project/lib/address_book.proto

Contributing

to install locally:

pub global activate --source path  /path/to/protobuf_runner/

Issues

Please use the Issue Tracker

Changelog

0.0.1

  • Initial version, created by Stagehand

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  protobuf_runner: "^1.0.0"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

Version Uploaded Documentation Archive
1.0.0 Mar 5, 2017 Go to the documentation of protobuf_runner 1.0.0 Download protobuf_runner 1.0.0 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
50

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in libraries.

Suggestions

  • Fix analysis_options.yaml.

    We were unable to parse analysis_options.yaml.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use protobuf_runner.dart.

  • Enable strong mode analysis.

    Strong mode helps you to detect bugs and potential issues earlier.Start your analysis_options.yaml file with the following:

    analyzer:
      strong-mode: true
    

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
args ^0.13.7 0.13.7 1.3.0
path ^1.4.1 1.5.1