mdns 0.0.1

  • Example
  • Installing
  • Versions
  • 19

mDNS for Flutter

A Flutter plugin for mDNS/DNS-SD discovery and advertising. Ultimately this plugin will be compatible with Android and iOS.

See for additional info


See example/lib/main.dart for a simple example

Currently Working

  • Service Discovery on Android

TODO (in this order)

  • Service Discovery on iOS
  • Service advertising on Android
  • Service advertising on iOS

[0.0.1] - Monday, January 22nd, 2018

Added in this release:

  • Discovery for Android
  • Example flutter app with basic discovery function


import 'package:flutter/material.dart';
import 'package:mdns/mdns.dart';

void main() => runApp(new MyApp());

const String discovery_service = "_workstation._tcp";

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  List<String> messageLog = <String>[];
  DiscoveryCallbacks discoveryCallbacks;
  initState() {

    discoveryCallbacks = new DiscoveryCallbacks(
      onDiscovered: (ServiceInfo info){
        print("Discovered ${info.toString()}");
          messageLog.insert(0, "DISCOVERY: Discovered ${info.toString()}");
      onDiscoveryStarted: (){
        print("Discovery started");
        setState((){messageLog.insert(0, "DISCOVERY: Discovery Running");});
      onDiscoveryStopped: (){
        print("Discovery stopped");
        setState((){messageLog.insert(0, "DISCOVERY: Discovery Not Running");});
      onResolved: (ServiceInfo info){
        print("Resolved Service ${info.toString()}");
          messageLog.insert(0, "DISCOVERY: Resolved ${info.toString()}");

    messageLog.add("Starting mDNS for service [$discovery_service]");

  startMdnsDiscovery(String serviceType){
    Mdns mdns = new Mdns(discoveryCallbacks: discoveryCallbacks);

  Widget build(BuildContext context) {

    return new MaterialApp(
      home: new Scaffold(
        body: new ListView.builder(
          reverse: true,
          itemCount: messageLog.length,
          itemBuilder: (BuildContext context, int index) {
            return new Text(messageLog[index]);

Use this package as a library

1. Depend on it

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

  mdns: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:mdns/mdns.dart';
Version Uploaded Documentation Archive
0.0.1 Jan 22, 2018 Go to the documentation of mdns 0.0.1 Download mdns 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Health issues and suggestions

Fix lib/mdns.dart. (-57.81 points)

Analysis of lib/mdns.dart failed with 3 errors:

line 89 col 63: The argument type '(Map<dynamic, dynamic>) → Null' can't be assigned to the parameter type '(dynamic) → void'.

line 94 col 65: The argument type '(Map<dynamic, dynamic>) → Null' can't be assigned to the parameter type '(dynamic) → void'.

line 99 col 64: The argument type '(bool) → Null' can't be assigned to the parameter type '(dynamic) → void'.

Document public APIs (-10 points)

37 out of 37 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8