pip_services3_commons 1.1.7 icon indicating copy to clipboard operation
pip_services3_commons: ^1.1.7 copied to clipboard

Common patterns for Pip.Services in Dart. This framework is part of the [Pip.Services](https://github.com/pip-services/pip-services) project.

Pip.Services Logo
Portable Abstractions and Patterns for Dart #

This module is a part of the Pip.Services polyglot microservices toolkit. It provides a set of basic patterns used in microservices or backend services. Also the module implemenets a reasonably thin abstraction layer over most fundamental functions across all languages supported by the toolkit to facilitate symmetric implementation.

The module contains the following packages:

  • Commands - commanding and eventing patterns
  • Config - configuration framework
  • Convert - soft value converters
  • Data - data patterns
  • Errors - application errors
  • Random - random data generators
  • Refer - locator (IoC) pattern
  • Reflect - reflection framework
  • Run - execution framework
  • Validate - validation framework

Quick links:

Use #

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

  pip_services3_commons: version

Now you can install package from the command line:

pub get

Then you are ready to start using the Pip.Services patterns to augment your backend code.

For instance, here is how you can implement a component, that receives configuration, get assigned references, can be opened and closed using the patterns from this module.

class MyComponentA implements IConfigurable, IReferenceable, IOpenable {

  String _param1 = 'ABC';
  int _param2 = 123;
  MyComponentB _anotherComponent;
  bool _opened = true;

  void configure(ConfigParams config) {
    this._param1 = config.getAsStringWithDefault('param1', this._param1);
    this._param2 = config.getAsIntegerWithDefault('param2', this._param2);

  void setReferences(IReferences refs) {
    this._anotherComponent = refs.getOneRequired<MyComponentB>(
      Descriptor('myservice', 'mycomponent-b', '*', '*', '1.0')

  bool isOpen() {
    return this._opened;

  Future open(String? correlationId) {
    return Future(() {
      this._opened = true;
      print('MyComponentA has been opened.');

  Future close(String? correlationId) {
    return Future(() {
      this._opened = true;
      print('MyComponentA has been closed.');

Then here is how the component can be used in the code

import 'package:pip_services3_commons/src/config/ConfigParams.dart';
import 'package:pip_services3_commons/src/refer/References.dart';
import 'package:pip_services3_commons/src/refer/DependencyResolver.dart';

var myComponentA = MyComponentA();

// Configure the component
  'param1', 'XYZ',
  'param2', 987

// Set references to the component
   Descriptor('myservice', 'mycomponent-b', 'default', 'default', '1.0',) myComponentB

// Open the component

Develop #

For development you shall install the following prerequisites:

  • Dart SDK 2
  • Visual Studio Code or another IDE of your choice
  • Docker

Install dependencies:

pub get

Run automated tests:

pub run test

Generate API documentation:


Before committing changes run dockerized build and test as:


Contacts #

The library is created and maintained by Sergey Seroukhov, Levichev Dmitry, Alexey Dvoykin.

The documentation is written by Egor Nuzhnykh, Alexey Dvoykin, Mark Makarychev, Levichev Dmitry.

pub points


verified publisher iconentinco.com

Common patterns for Pip.Services in Dart. This framework is part of the [Pip.Services](https://github.com/pip-services/pip-services) project.

Repository (GitHub)
View/report issues


API reference


Icon for licenses.MIT (LICENSE)


analyzer, uuid


Packages that depend on pip_services3_commons