omnibuild 0.5.2+2

  • Installing
  • Versions
  • 35


Pub Package

You can create an Omnibus messages specification in a YAML file and use the omnibuild executable to generate Dart code from this file. This executable should be executed using the command below, note that the output directory must have a trailing slash.

omnibuild -o <output directory> <input files>

Writing the YAML files

An Omnibus messages specification file looks as follows:

# Copyright that should be applied to the output file.
copyright: Example copyright

# Library name these messages are included in.
library: message_library

# Extensive description (main code documentation)
description: |
  General description of what the messages in this file do and in which
  scenarios they should be used.

# Messages list
- name: MyMessage      # Message name
  type: event          # _OmnibusMessageType (event, request, response)
  note: Documentation  # Message documentation

  # Message properties
  - name: impactFactor       # Property name
    note: Documentation      # Property documentation
    type: enum ImpactFactor  # Property type, prefix with 'enum ' if it is an
                             # enumeration as shown here.
    pass: named parameter    # Positional or named parameter
    dflt: ImpactFactor.high  # Default value (abbreviated to four letters so all
                             # properties can be aligned nicely)
    fltr: true               # Use for filtering.

- name: MyResponse
  type: response

This example would result in the following code.

// Example copyright


part of message_library;

/// General description of what the messages in this file do and in which
/// scenarios they should be used.

/// Documentation
class MyMessage extends OmnibusEvent {
  /// omnibusId
  static const id = 'message_library.v0.MyMessage';

  /// Documentation
  final ImpactFactor impactFactor;

  /// Constructor
  MyMessage({this.impactFactor: ImpactFactor.high}) : super(id);

  /// Construct from passive data structure.
  factory MyMessage.fromPds(final Map<String, dynamic> pds) {
    ImpactFactor impactFactor;

    // Read impactFactor.
    if (pds.containsKey('impactFactor') && pds['impactFactor'] is int) {
      impactFactor = ImpactFactor.values[pds['impactFactor']];
    } else {
      throw new ArgumentError.value(pds, 'pds',
          "does not contain a valid field for property 'impactFactor'");

    return new MyMessage(impactFactor: impactFactor);

  /// Generate passive data structure from message properties.
  Map<String, dynamic> toPds() {
    return {'impactFactor': impactFactor.index};

/// Message handler for MyMessage
class MyMessageHandler extends OmnibusEventHandler {
  /// Callback
  final OmnibusEventCallback<MyMessage> _callback;

  /// Documentation
  final ImpactFactor impactFactor;

  /// Constructor
  MyMessageHandler(this._callback, StateData state,
      {this.impactFactor: null})
      : super(, state);

  /// Process incoming message.
  List<Future<Null>> process(OmnibusEvent data) {
    MyMessage message =
        data is MyMessage ? data : new MyMessage.fromPds(data.toPds());

    if ((impactFactor == null || impactFactor == message.impactFactor)) {
      return [_callback(message, state)];
    } else {
      return [];

class MyResponse extends OmnibusResponse {
  /// omnibusId
  static const id = 'message_library.v0.MyResponse';

  /// Constructor
  MyResponse() : super(id);

  /// Construct from passive data structure.
  factory MyResponse.fromPds(final Map<String, dynamic> pds) {
    return new MyResponse();

  /// Generate passive data structure from message properties.
  Map<String, dynamic> toPds() {
    return {};

/// Create MyResponse Stream from the given responses.
Stream<MyResponse> streamMyResponse(OmnibusResponses responses) {
          (OmnibusResponse data) =>
              data is MyResponse ? data : new MyResponse.fromPds(data.toPds()))
      as Stream<MyResponse>;

This output file is written to the specified directory. The file name will be the same as the specification file except that the file extension is changed to .dart. You have to specify the specification version in the file name using this format: <name>.v<major_version_integer>.yaml. The version number can not be higher than the pub version. You are actually expected to increment this version along with the pub major version. This is part of the compatibility strategy.

Backward compatibility

The versioning method in the previous paragraph is part of the compatibility strategy of omnibuild. When you introduce breaking changes in the messages you should continue in a new file with incremented version and you should increment the pub major version to reflect this change. This way modules that rely on old messages can still safely update to the new version, although they should change their messages of course. This also allows modules to implement multiple versions in order to provide backward compatibility for old modules. A next step could be to remove the old version message file and adapt the Dart code of that version to an adapter library (functions that act as old message builders but in reality create messages in the new format while still taking the same parameters as before).

To take advantage of this strategy in the modules, you should import message libraries in the following way:

import 'package:messages/messages.v1.dart' as v1;

bus.bindEventHandler(, {}, eventHandler);

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate omnibuild

2. Use it

The package has the following executables:

$ omnibuild

Use this package as a library

1. Depend on it

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

  omnibuild: "^0.5.2+2"

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 flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:omnibuild/omnibuild.dart';
Version Uploaded Documentation Archive
0.5.2+2 Oct 17, 2016 Go to the documentation of omnibuild 0.5.2+2 Download omnibuild 0.5.2+2 archive
0.5.2+1 Apr 28, 2016 Go to the documentation of omnibuild 0.5.2+1 Download omnibuild 0.5.2+1 archive
0.5.2 Apr 27, 2016 Go to the documentation of omnibuild 0.5.2 Download omnibuild 0.5.2 archive
0.5.1+2 Apr 9, 2016 Go to the documentation of omnibuild 0.5.1+2 Download omnibuild 0.5.1+2 archive
0.5.1+1 Apr 7, 2016 Go to the documentation of omnibuild 0.5.1+1 Download omnibuild 0.5.1+1 archive
0.5.1 Apr 6, 2016 Go to the documentation of omnibuild 0.5.1 Download omnibuild 0.5.1 archive
0.5.0 Apr 6, 2016 Go to the documentation of omnibuild 0.5.0 Download omnibuild 0.5.0 archive
0.4.0 Apr 6, 2016 Go to the documentation of omnibuild 0.4.0 Download omnibuild 0.4.0 archive
0.3.0 Apr 5, 2016 Go to the documentation of omnibuild 0.3.0 Download omnibuild 0.3.0 archive
0.2.2 Mar 23, 2016 Go to the documentation of omnibuild 0.2.2 Download omnibuild 0.2.2 archive

All 16 versions...


We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


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


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:omnibuild/omnibuild.dart.


  • Maintain

    Changelog entries help clients to follow the progress in your code.

  • Package is getting outdated.

    The package was released 87 weeks ago.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use omnibuild.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
args ^0.13.3+4 0.13.7 1.4.3
dart_style ^0.2.4 0.2.16 1.1.0
mustache ^0.2.5 0.2.5+1 1.0.1
omnibus ^0.15.0 0.15.3+1
passive_data ^0.7.1 0.7.1+1
path ^1.3.9 1.6.1
yaml ^2.1.8 2.1.14
Transitive dependencies
analyzer 0.29.11 0.32.1
async 2.0.7
charcode 1.1.1
cli_util 0.0.1+2 0.1.3
collection 1.14.10
convert 2.0.1
crypto 2.0.5
csslib 0.14.4
glob 1.1.5
html 0.13.3+1
http 0.11.3+16
http_parser 3.1.2
isolate 1.1.0 2.0.1
logging 0.11.3+1
meta 1.1.5
package_config 1.0.3
plugin 0.2.0+2
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+8
when 0.2.0
which 0.1.3
Dev dependencies
test ^0.12.7