Search packages, repositories and app categories

Package detailsv0.2.0

modbus

Simple Modbus client library for dart. Currently only the TCP connection is supported.

AndroidiOSmacOSWindowsLinux
30-day downloads
878
Likes
36
Pub points
140

Install package

flutter pub add modbus

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A simple Modbus client library for Dart that enables communication with Modbus devices over TCP. It provides a straightforward API to read and write data from industrial automation systems, making it ideal for IoT and SCADA applications. Currently, only TCP connection support is available, with no UDP or RTU implementations. The library is compatible across multiple platforms including Android, iOS, macOS, Windows, and Linux, allowing cross-platform development for industrial control solutions.

Use cases

  • Industrial IoT monitoring
  • SCADA system integration
  • Factory automation
  • Remote device data retrieval
  • Real-time sensor data collection

Key features

  • TCP-only Modbus support
  • Cross-platform compatibility
  • Simple API for reading/writing registers
  • Lightweight and easy to integrate
  • Supports standard Modbus function codes

Suitable for

  • Developers building industrial automation apps
  • IoT projects requiring Modbus communication
  • Backend services managing PLCs
  • Embedded system integrators using Dart
  • Cross-platform industrial software

Considerations

  • No support for RTU or UDP protocols
  • Limited to TCP-based Modbus devices
  • Requires proper network configuration for PLC access
  • Not suitable for high-frequency polling without optimization
  • Depends on stable network connectivity

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

modbus-dart

Simple Modbus client library for dart. Currently only the TCP connection is supported.

pub package

Usage

Single slave (Modbus RTU)
import 'package:modbus/modbus.dart' as modbus;


main(List<String> arguments) async {
    
  var client = modbus.createTcpClient(
    '10.170.1.20',
    port: 1001,
    mode: modbus.ModbusMode.rtu,
  );
    
  try {
    await client.connect();
    
    var slaveIdResponse = await client.reportSlaveId();
    
    print("Slave ID: " + slaveIdResponse);
  } finally {
    client.close();
  }
}
Multi slaves with one connection (Modbus RTU)
import 'package:modbus/modbus.dart' as modbus;


main(List<String> arguments) async {
    
  var client = modbus.createTcpClient(
    '10.170.1.20',
    port: 1001,
    mode: modbus.ModbusMode.rtu,
  );
    
  try {
    await client.connect();
    
    client.setUnitId(100);
    var slaveIdResponse = await client.reportSlaveId();
    
    print("Slave ID: " + slaveIdResponse);

    client.setUnitId(150);
    var slaveIdResponse = await client.reportSlaveId();

    print("Slave ID: " + slaveIdResponse);
  } finally {
    client.close();
  }
}

Limitations

SerialConnector is not implemented yet.

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

No data available yet.