flutter_oss_licenses 0.6.2

  • Readme
  • Changelog
  • Installing
  • 69

Introduction #

flutter_oss_licenses is a tool for generating OSS license list using pubspec.lock.

Please note that version 0.6.0 breaks compatibility with older version to get more information about packages.

Installing #

Adding the package name to dev_dependencies; not to dependencies because the package does nothing on runtime.

  flutter_oss_licenses: ^0.6.2

Generate oss_licenses.dart #

Before executing the command, you must update your pubspec.lock using pub get (or pub upgrade if you want).

$ flutter pub get

And then, the following command generates oss_licenses.dart on the project's lib/ directory:

$ flutter pub run flutter_oss_licenses:generate.dart

The file structure #

The generated file contains a simple Map<String, dynamic> that maps each project name to its corresponding license text, that is normally provided by LICENSE file on the project:

/// This code was generated by flutter_oss_licenses
/// https://pub.dev/packages/flutter_oss_licenses
final ossLicenses = <String, dynamic>{
  "hello_world_dummy": {
    "name": "hello_world_dummy",
    "description": "Sample hello world dummy description.",
    "homepage": "https://github.com/espresso3389",
    "authors": ["Takashi Kawasaki <espresso3389@gmail.com>"],
    "version": "1.0.0",
    "license": "## Hello, world\nDummy copyright here!",
    "isMarkdown": true,
    "isSdk": false,
    "isDirectDependency": false

And, you can use the map on your project code in your way. The package does not do anything on the list.

Command line options #

Either running generate.dart using pub run or directly, it accepts two or less options. The first option is output dart file name. The default is lib/oss_licenses.dart. And the another is project root, which is by default detected automatically.


The bin/generated.dart uses two environment variables; one is FLUTTER_ROOT and PUB_CACHE. They are normally set by flutter pub run but if you directly execute the script, you must set them manually.

Reporting issues #

Report any bugs on the project's issues.

URLs #

0.6.2 #

  • Minor error fixes.

0.6.1 #

  • Minor error fixes.

0.6.0 #

  • BREAKING CHANGE: The output format is completely changed to provide more information about packages.

0.5.2 #

  • Minor fix :(

0.5.1 #

  • Minor fix.

0.5.0 #

  • For Windows, new pub-cache directory is %APPDATA%\Pub\Cache.

0.4.1 #

  • FIXED: Generation process stops if PUB_CACHE is not explicitly defined.

0.3.0 #

  • Loosen version restriction on dependency packages because it conflicts with certain well-used packages.

0.2.0 #

  • Addresses facial things warned by pub.dev's health suggestions.

0.1.0 #

  • First rlease.

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate flutter_oss_licenses

2. Use it

The package has the following executables:

$ generate
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 Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix bin/generate.dart. (-1.99 points)

Analysis of bin/generate.dart reported 4 hints:

line 11 col 5: DO use curly braces for all flow control structures.

line 16 col 7: DO use curly braces for all flow control structures.

line 41 col 28: Use isNotEmpty instead of length

line 142 col 21: Avoid empty catch blocks.

Maintenance suggestions

The package description is too short. (-2 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 Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
meta ^1.1.0 1.1.8
path ^1.4.0 1.6.4
yaml ^2.1.0 2.2.0
Transitive dependencies
charcode 1.1.2
collection 1.14.12
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0