Skip to content
pubscout

modbus_client

1.4.5, released 7 months ago by cabella.net

Base Modbus client package for sending requests via Serial and TCP/IP.

WASM-ready
$ flutter pub add modbus_client
Source repository

What it does

Provides the core implementation for Modbus clients communicating with remote Modbus servers over TCP, UDP, or Serial (ASCII/RTU) connections. Supports a wide range of element types, endianness configurations, and file records.

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

Use it when

  • You need to communicate with Modbus servers/devices over TCP, UDP, or Serial in Dart or Flutter.
  • You require granular element definitions like registers, coils, and bit masks with custom scaling and multipliers.

Skip it when

  • You are building web or mobile apps that do not require industrial hardware communication protocols.

Strengths

  • Supports multiple transport protocols via companion packages (TCP, UDP, Serial).
  • Comprehensive support for various Modbus element types and custom requests.

Weaknesses

  • Requires platform-specific serial libraries (like flutter_libserialport) for serial communication in Flutter/Dart.
  • Protocol and library limits apply for byte sizes and frame lengths.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
3

For serial implementations in Flutter projects, you need to add the flutter_libserialport package to your own project.

import 'package:modbus_client/modbus_client.dart';
import 'package:modbus_client_tcp/modbus_client_tcp.dart';

void main() async {
  var batteryTemperature = ModbusInt16Register(
      name: "BatteryTemperature",
      type: ModbusElementType.inputRegister,
      address: 22);
  var modbusClient = ModbusClientTcp("192.168.0.1", unitId: 1);
  await modbusClient.send(batteryTemperature.getReadRequest());
  modbusClient.disconnect();
}

Alternatives

Packages that do the same job and could replace modbus_client.

Works with

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