Skip to content
pubscout

mqtt_client

10.14.0, released 4 weeks ago by darticulate.com

A Dart MQTT client supporting TCP, WebSocket, secure connections and all QoS levels.

WASM-readyRock solid
$ flutter pub add mqtt_client
Source repository

What it does

It implements MQTT v3.1 and v3.1.1, handling connection, subscription, publishing and keep‑alive automatically. It works on Android, iOS, web, desktop and server platforms.

AI-written summary of version 10.14.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Building IoT or chat apps that need MQTT communication
  • Integrating with cloud MQTT brokers like Google IoT Core, AWS IoT, Azure IoT Hub
  • Creating Flutter apps that require real‑time messaging over MQTT

Skip it when

  • You only need HTTP or WebSocket APIs
  • Your project already uses a different MQTT client that better fits your architecture

Strengths

  • Supports TCP, secure TCP, WebSocket and secure WebSocket
  • Handles all QoS levels and keep‑alive automatically
  • Batch and multi‑unsubscriptions, making it efficient for many topics
  • Cross‑platform support (Android, iOS, web, desktop, server)

Weaknesses

  • No native support for MQTT v5 (requires separate package)
  • Requires platform permissions for network access on mobile
  • Documentation is concise but may need digging for advanced use

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
7

Add INTERNET and ACCESS_NETWORK_STATE permissions on Android; add NSLocalNetworkUsageDescription and NSBonjourServices on iOS. No build_runner needed.

import 'package:mqtt_client/mqtt_client.dart';

final client = MqttClient('broker.hivemq.com', 'testClient');
await client.connect();
client.subscribe('topic/test', MqttQos.atLeastOnce);
client.publishMessage('topic/test', MqttQos.atLeastOnce, 'Hello');

Alternatives

Packages that do the same job and could replace mqtt_client.

  • mqtt5_client

    A server and browser based MQTT Version 5 client for Dart supporting TCP and WebSockets.

  • dart_mcp

    A Dart library for building Model Context Protocol (MCP) servers and clients.

  • stream_chat

    Low‑level Dart client for Stream Chat API

  • centrifuge

    Dart client for real‑time communication with Centrifuge/Centrifugo over WebSockets.

Works with

Packages commonly used together with mqtt_client: ones it builds on, ones built on it, and its own family.