dart_amqp 0.0.8

  • README.md
  • Installing
  • Versions
  • 77


Build Status codecov

Dart AMQP client implementing protocol version 0.9.1

Main features:

  • asynchronous API based on Futures and Streams
  • supports PLAIN and AMQPLAIN authentication providers while other authentication schemes can be plugged in by implementing the appropriate interface.
  • implements the entire 0.9.1 protocol specification (except basic get and recover-async)

Things not working yet:

  • the driver does not currently support recovering client topologies when re-establishing connections. This feature may be implemented in a future version.
  • heartbeats.

Quick start

Listening to a queue:

import "package:dart_amqp/dart_amqp.dart";

void main() {
  Client client = new Client();

  .channel() // auto-connect to localhost:5672 using guest credentials
  .then((Channel channel) => channel.queue("hello"))
  .then((Queue queue) => queue.consume())
  .then((Consumer consumer) => consumer.listen((AmqpMessage message) {
    // Get the payload as a string
    print(" [x] Received string: ${message.payloadAsString}");

    // Or unserialize to json
    print(" [x] Received json: ${message.payloadAsJson}");

    // Or just get the raw data as a Uint8List
    print(" [x] Received raw: ${message.payload}");
    // The message object contains helper methods for 
    // replying, ack-ing and rejecting

Sending messages via an exchange:

import "package:dart_amqp/dart_amqp.dart";

void main() {
  // You can provide a settings object to override the
  // default connection settings
  ConnectionSettings settings = new ConnectionSettings(
      host : "remote.amqp.server.com",
      authProvider : new PlainAuthenticator("user", "pass")
  Client client = new Client(settings : settings);
  .then((Channel channel) => channel.exchange("logs", ExchangeType.FANOUT))
  .then((Exchange exchange) {
    // We dont care about the routing key as our exchange type is FANOUT
    exchange.publish("Testing 1-2-3", null);
    return client.close();


See the Api documentation.

RPC calls over AMQP

This example illustrates how to get a basic RPC server/client up and running using just the provided api calls.

The driver does not provide any helper classes for easily performing RPC calls over AMQP as not everyone needs this functionality. If you need RPC support for your application you may want to consider using the dart_amqp_rpc package.


The example folder contains implementations of the six RabbitMQ getting started tutorials.


See the Contributing Guide.


dart_amqp is distributed under the MIT license.




  • Fixes #6 (stack overflow when processing large TCP packets)


  • Merged Faisal Abid's PR that forces the client to request a 0 heartbeat timeout


  • Merged Raj Maniar's PR that allows users to register a listener for exceptions caught by the client


  • Merged Raj Maniar's PR that adds support for handling basicReturn messages


  • Initial version

1. Depend on it

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

  dart_amqp: "^0.0.8"

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.

3. Import it

Now in your Dart code, you can use:

import 'package:dart_amqp/dart_amqp.dart';
Version Uploaded Documentation Archive
0.0.8 Aug 20, 2017 Go to the documentation of dart_amqp 0.0.8 Download dart_amqp 0.0.8 archive
0.0.6 Jun 7, 2016 Go to the documentation of dart_amqp 0.0.6 Download dart_amqp 0.0.6 archive
0.0.5 Apr 21, 2016 Go to the documentation of dart_amqp 0.0.5 Download dart_amqp 0.0.5 archive
0.0.4 Jan 6, 2016 Go to the documentation of dart_amqp 0.0.4 Download dart_amqp 0.0.4 archive
0.0.3 Oct 31, 2015 Go to the documentation of dart_amqp 0.0.3 Download dart_amqp 0.0.3 archive
0.0.2 Oct 2, 2015 Go to the documentation of dart_amqp 0.0.2 Download dart_amqp 0.0.2 archive
0.0.1 May 10, 2015 Go to the documentation of dart_amqp 0.0.1 Download dart_amqp 0.0.1 archive


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

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

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


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


Detected platforms: Flutter, other

Primary library: package:dart_amqp/dart_amqp.dart with components: io.


  • Fix lib/src/client/impl/channel_impl.dart.

    Strong-mode analysis of lib/src/client/impl/channel_impl.dart failed with the following error:

    line: 417 col: 3
    Invalid override. The type of '_ChannelImpl.close' ('() → Future<dynamic>') isn't a subtype of 'Channel.close' ('() → Future<Channel>').

  • Fix lib/src/enums/error_type.dart.

    Strong-mode analysis of lib/src/enums/error_type.dart failed with the following error:

    line: 26 col: 50
    super call must be last in an initializer list (see https://goo.gl/EY6hDP): 'super(value)'.

  • Fix issues reported by dartanalyzer.

    dartanalyzer reported 2 error(s) and 0 warning(s).

  • 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.

  • 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.

    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 dart_amqp.dart.


Package Constraint Resolved Available
Direct dependencies
logging >=0.9.3 <0.10.0 0.9.3 0.11.3+1
Dev dependencies
coverage ^0.7.0
dart_codecov_generator ^0.4.0
http >=0.11.1+1 <0.12.0
mock >=0.11.0+2 <0.12.0
unittest any
xml >=2.2.3 <3.0.0