simple_dlna 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 43

Simple DLNA #

A simple DLNA DMC library implemented by Dart.
It is tiny and only the most basic network video casting function is supported.

Structure #

structure

Example #

Android

Manifest.xml

 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
 <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android:name="android.permission.WAKE_LOCK" />
 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Import

import 'package:simple_dlna/dlna.dart';
var dlnaManager = DLNAManager();
dlnaManager.setRefresher(DeviceRefresher(onDeviceAdd: (dlnaDevice) {
    print('add ' + dlnaDevice.toString());
}, onDeviceRemove: (dlnaDevice) {
    print('remove ' + dlnaDevice.toString());
}, onDeviceUpdate: (dlnaDevice) {
    print('update ' + dlnaDevice.toString());
}, onSearchError: (error) {
    print(error);
}));
dlnaManager.startSearch();
dlnaManager.stopSearch();

Send the video url to the device

var didlObject = VideoObject(title, url, VideoObject.VIDEO_MP4);
await widget.dlnaManager.actSetVideoUrl(_didlObject);

Release server

dlnaManager.release();

Search Cache function

For the quick search, when the device is found, it is saved locally.

dlnaManager.enableCache();
var localDevices = dlnaManager.getLocalDevices();

[0.0.1] #

  • Fist commit.

example/main.dart

import 'package:simple_dlna/simple_dlna.dart';

Future<void> main() async {
  var dlnaService = DLNAManager();
  dlnaService.setRefresher(DeviceRefresher(onDeviceAdd: (dlnaDevice) {
    print('add ' + dlnaDevice.toString());
  }, onDeviceRemove: (dlnaDevice) {
    print('remove ' + dlnaDevice.toString());
  }, onDeviceUpdate: (dlnaDevice) {
    print('update ' + dlnaDevice.toString());
  }, onSearchError: (error) {
    print(error);
  }));
  dlnaService.startSearch();
}

Use this package as a library

1. Depend on it

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


dependencies:
  simple_dlna: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:simple_dlna/simple_dlna.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
6
Health:
Code health derived from static analysis. [more]
82
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
76
Overall:
Weighted score of the above. [more]
43
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because:

  • package:simple_dlna/simple_dlna.dart that imports:
  • package:simple_dlna/src/dlna_manager.dart that imports:
  • package:simple_dlna/src/ssdp/device_manager.dart that imports:
  • package:simple_dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: linux

Package does not support Flutter platform ios

Because:

  • package:simple_dlna/simple_dlna.dart that imports:
  • package:simple_dlna/src/dlna_manager.dart that imports:
  • package:simple_dlna/src/ssdp/device_manager.dart that imports:
  • package:simple_dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: linux

Package does not support Flutter platform linux

Because:

  • package:simple_dlna/simple_dlna.dart that imports:
  • package:simple_dlna/src/dlna_manager.dart that imports:
  • package:simple_dlna/src/dlna_connectivity.dart that imports:
  • package:connectivity/connectivity.dart that declares support for platforms: android, ios, macos, web

Package does not support Flutter platform macos

Because:

  • package:simple_dlna/simple_dlna.dart that imports:
  • package:simple_dlna/src/dlna_manager.dart that imports:
  • package:simple_dlna/src/ssdp/device_manager.dart that imports:
  • package:simple_dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: linux

Package does not support Flutter platform web

Because:

  • package:simple_dlna/simple_dlna.dart that imports:
  • package:simple_dlna/src/dlna_manager.dart that imports:
  • package:simple_dlna/src/ssdp/device_manager.dart that imports:
  • package:simple_dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: linux

Package does not support Flutter platform windows

Because:

  • package:simple_dlna/simple_dlna.dart that imports:
  • package:simple_dlna/src/dlna_manager.dart that imports:
  • package:simple_dlna/src/ssdp/device_manager.dart that imports:
  • package:simple_dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that declares support for platforms: android, ios, linux, macos, web

Package not compatible with SDK dart

Because:

  • simple_dlna that is a package requiring null.

Health issues and suggestions

Document public APIs. (-0.58 points)

348 out of 353 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/ssdp/description_parser.dart. (-12.66 points)

Analysis of lib/src/ssdp/description_parser.dart reported 27 hints, including:

line 8 col 7: Name non-constant identifiers using lowerCamelCase.

line 9 col 7: Name non-constant identifiers using lowerCamelCase.

line 10 col 7: Name non-constant identifiers using lowerCamelCase.

line 11 col 7: Name non-constant identifiers using lowerCamelCase.

line 12 col 7: Name non-constant identifiers using lowerCamelCase.

Fix lib/src/didl.dart. (-1.99 points)

Analysis of lib/src/didl.dart reported 4 hints:

line 2 col 10: Don't explicitly initialize variables to null.

line 3 col 10: Don't explicitly initialize variables to null.

line 4 col 10: Don't explicitly initialize variables to null.

line 5 col 10: Don't explicitly initialize variables to null.

Fix lib/src/soap/av_transport/set_url.dart. (-1.99 points)

Analysis of lib/src/soap/av_transport/set_url.dart reported 4 hints:

line 49 col 13: Avoid using braces in interpolation when not needed.

line 53 col 15: Avoid using braces in interpolation when not needed.

line 56 col 14: Avoid using braces in interpolation when not needed.

line 57 col 48: Avoid using braces in interpolation when not needed.

Fix additional 6 files with analysis or formatting issues. (-2 points)

Additional issues in the following files:

  • lib/src/ssdp/ssdp_controller.dart (2 hints)
  • lib/src/dlna_device.dart (1 hint)
  • lib/src/ssdp/local_device_parser.dart (1 hint)
  • lib/src/dlna_action_result.dart (Run flutter format to format lib/src/dlna_action_result.dart.)
  • lib/src/dlna_connectivity.dart (Run flutter format to format lib/src/dlna_connectivity.dart.)
  • lib/src/dlna_manager.dart (Run flutter format to format lib/src/dlna_manager.dart.)

Maintenance suggestions

The package description is too short. (-14 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
connectivity ^0.4.8 0.4.9
flutter 0.0.0
shared_preferences ^0.5.6 0.5.8
xml2json ^4.2.0 4.3.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
connectivity_for_web 0.3.0
connectivity_macos 0.1.0+3
connectivity_platform_interface 1.0.6
convert 2.1.1
file 5.2.1
flutter_web_plugins 0.0.0
intl 0.16.1
js 0.6.2
meta 1.1.8 1.2.2
path 1.7.0
path_provider_linux 0.0.1+2
path_provider_platform_interface 1.0.2
petitparser 3.0.4
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
shared_preferences_linux 0.0.2+1
shared_preferences_macos 0.0.1+10
shared_preferences_platform_interface 1.0.4
shared_preferences_web 0.1.2+7
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
xml 4.2.0
Dev dependencies
flutter_test