Skip to content
pubscout

dart_pubspec_licenses

3.2.0, released 9 months ago by espresso3389.jp

Extracts open source license information from Dart packages using pubspec.yaml

$ flutter pub add dart_pubspec_licenses
Source repository

What it does

Reads the project's pubspec.lock to gather and assemble open source software license details. Generates a Dart file or a JSON file containing all package metadata and licenses.

AI-written summary of version 3.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to display an open source licenses page in your mobile, desktop, or web application
  • You want to automate license information collection during your build or release process

Skip it when

  • You need runtime dynamic extraction of licenses without pre-generating a file

Strengths

  • Supports generating either a Dart constant file or a JSON file
  • Detects SPDX license identifiers automatically
  • Handles complex workspaces and package directories

Weaknesses

  • Requires pub get / pub upgrade to be run before generating licenses
  • Does nothing at runtime as it is purely a build-time tool

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
5

Add the package to dev_dependencies in pubspec.yaml and run dart run dart_pubspec_licenses:generate

dev_dependencies:
  dart_pubspec_licenses: ^3.2.0

# Run command:
dart run dart_pubspec_licenses:generate

Alternatives

Packages that do the same job and could replace dart_pubspec_licenses.

Works with

Packages commonly used together with dart_pubspec_licenses: ones it builds on, ones built on it, and its own family.