dart_oss_licenses 0.5.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 33

dart_oss_licenses #

CLI tool that generate OSS license list of dart used in your project.

Getting Started #

install Dart SDK.

For example, if you are using homebrew with mac.

$ brew tap dart-lang/dart
$ brew install dart

inatall dart-oss-licenses.

$ pub global activate dart_oss_licenses

run in your project root (exists pubspec.lock). But you have task to do before that.

$ cd <your project root>
$ dart-oss-licenses

For ios #

In ios, it is realized with settings.bundle. So make it.

On Menu of Xcode
File -> New -> File... -> Select Settings.bundle -> Next -> Create as <Project>/ios/Runner/Settings.bundle

Then Rewrite Root.plist as follows.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">


"Licenses" = "Licenses";

By doing this, the above command will succeed.

Application Code #

In order to transition from the application, write the following.

@objc class AppDelegate: FlutterAppDelegate {
    private var _result: FlutterResult?

    override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
    ) -> Bool {
        let controller: FlutterViewController = window?.rootViewController as! FlutterViewController
        let channel = FlutterMethodChannel(name: "sample/platform",
                                                 binaryMessenger: controller)
            (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
            switch call.method {
            case "toOssLicense":
                if let url = URL(string: UIApplicationOpenSettingsURLString) {
                    if #available(iOS 10.0, *) {
                        UIApplication.shared.open(url, options: [:], completionHandler: nil)
                    } else {
        GeneratedPluginRegistrant.register(with: self)
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)

For OSS used in native #

dart_oss_licenses supports dart's OSS only.
So native needs to use another tool for ios.

The recommendation is LicensePlist.
It also supports CocoaPods, Carthage and Manual(Git SubModule, direct sources and so on).

Merge results of dart_oss_licenses and LicensePlist.

For Android #

Currently, only AboutLibraries is supported.

Run command then generated in /android/app/src/main/res/values/license_strings.xml.

If it already exists, generated in /android/app/src/main/res/values/license_strings.xml.temp.

Since license_strings.xml is not perfect in some cases, you need to complete it yourself.

If the tool fails to acquire information, it is written TODO, so you can search for it and fix it.

Application Code #


dependencies {
    implementation "com.mikepenz:aboutlibraries:6.1.1"


class MainActivity() : FlutterActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {

        ).setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
            when (call.method) {
                "toOssLicense" -> {
                            <package name>
                        //start the activity

Dart #

Finally you can complete the following method with ui.

  static const platform = const MethodChannel('sample/platform');

  Future<void> toOssLicense() {
    return platform.invokeMethod('toOssLicense', {});

Contributing #

Anything, such as corresponding to other formats, is happy. Please feel free Pull Request.

How to create other format #

Please refer to formats package and implement the FormatHoldable interface.

then add a instance in formats/format_kind.dart.

 List<FormatHoldable> instanceAllFormats() {
   return [
+    SomethingFormat(),

0.5.1 #

  • Fix documents.

0.5.0 #

  • Public Release


main() {
  print("Please read README.md");

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate dart_oss_licenses

2. Use it

The package has the following executables:

$ dart-oss-licenses
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.

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

  • Dart: 2.8.4
  • pana: 0.13.13

Analysis suggestions

Binary only

Cannot assign flutter SDK tag because it is binary only

Binary only

Cannot assign flutter platform tags, it is a binary only package

Health suggestions

Fix bin/data/license_content_info.dart. (-1.49 points)

Analysis of bin/data/license_content_info.dart reported 3 hints:

line 44 col 25: Unnecessary new keyword.

line 69 col 25: Unnecessary new keyword.

line 94 col 25: Unnecessary new keyword.

Fix bin/http/package_http_client.dart. (-1.49 points)

Analysis of bin/http/package_http_client.dart reported 3 hints:

line 19 col 19: Unnecessary new keyword.

line 32 col 13: Unnecessary new keyword.

line 44 col 13: Unnecessary new keyword.

Fix bin/http/http_exception.dart. (-1 points)

Analysis of bin/http/http_exception.dart reported 2 hints:

line 6 col 17: Don't type annotate initializing formals.

line 6 col 35: Don't type annotate initializing formals.

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

Additional issues in the following files:

  • bin/formats/about_libraries_format.dart (1 hint)
  • bin/formats/commons/format_holdable.dart (1 hint)
  • bin/formats/settings_bundle_plist_format.dart (1 hint)
  • bin/http/license_http_client.dart (1 hint)

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

exitCode: 255 stdout: Documenting dart_oss_licenses... Initialized dartdoc with 37 libraries in 31.8 seconds Validating docs... no issues found Documented 0 public libraries in 5.9 seconds stderr: Unhandled exception: dartdoc could not find any libraries to document #0 Dartdoc.generateDocs (package:dartdoc/dartdoc.dart:218:9)

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (html).

Package is getting outdated. (-56.99 points)

The package was last published 81 weeks ago.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
html ^0.13.3+3 0.13.4+2 0.14.0+3
http ^0.12.0 0.12.1
meta ^1.1.6 1.2.1
tuple ^1.0.2 1.0.3
yaml ^2.1.15 2.2.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13
csslib 0.15.0 0.16.1
http_parser 3.1.4
matcher 0.12.8
path 1.7.0
pedantic 1.9.1
quiver 2.1.3
source_span 1.7.0
stack_trace 1.9.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0
utf 0.9.0+5
Dev dependencies
test ^1.0.0