mdns_dart 2.0.1

SDKdartflutter
Platformandroidioswindowslinuxmacos

A comprehensive mDNS (Multicast DNS) service discovery and advertisement library for Dart, ported from HashiCorp Go implementation.

mdns_dart

About

mdns_dart is a pure Dart implementation of Multicast DNS (mDNS) for service discovery and advertising on local networks. This library is a direct port of the proven HashiCorp mDNS implementation, adapted for the Dart ecosystem. It requires no native dependencies and works across platforms, including Docker and bridge networks.

This project is not affiliated with HashiCorp. All original credit goes to HashiCorp; this port is maintained for Dart and Flutter developers.

Features

FeatureThis Librarymulticast_dnsnsdflutter_nsd
Interface BindingFull supportFull supportPlatform dependentPlatform dependent
Docker/Bridge NetworksWorks perfectlyLimitedPlatform dependentPlatform dependent
Service AdvertisingFull serverDiscovery onlyVia platform APIsVia platform APIs
Pure DartNo native depsPure DartPlatform pluginsPlatform plugins
Direct Socket ControlNo controlLimitedNo controlNo control
Cross-Network DiscoverySolvedBrokenPlatform dependentPlatform dependent

Installation

dart pub add mdns_dart

Or add to your pubspec.yaml:

dependencies:
  mdns_dart: ^latest

For the latest development version:

dart pub add mdns_dart --git-url https://github.com/animeshxd/mdns_dart.git

Usage

Import

import 'package:mdns_dart/mdns_dart.dart';

Basic Service Discovery

final results = await MDNSClient.discover('_http._tcp');
for (final service in results) {
  print('${service.name} at ${service.primaryAddress?.address}:${service.port}');
}

For more advanced usage, see the example/ directory.

License

This project is licensed under the MIT License, originally by HashiCorp. See the LICENSE file for details.