pubspec_checker 1.3.0 copy "pubspec_checker: ^1.3.0" to clipboard
pubspec_checker: ^1.3.0 copied to clipboard

A simple Dart package that checks the compatibility of all dependencies in the pubspec.yaml file for specified platforms

Pubspec Checker

DocumentationIssuesExampleLicensePub.dev

A simple Dart/Flutter package that checks the compatibility of all dependencies in the pubspec.yaml file for specified platforms. This package reads the pubspec.yaml file, fetches the package information from pub.dev, and verifies the platforms (like Android, iOS, web, macOS, Windows, and Linux) against the provided list.

✨ Features #

🎯 Platform Compatibility Checking #

  • Check package compatibility across 6 platforms: Android, iOS, Web, Windows, macOS, Linux
  • Specify platforms via command-line or programmatic API
  • Multi-platform support with a single command

📊 Detailed Reporting & Visualization #

  • Tabular format for clean, structured output that's easy to read and compare
  • Color-coded status indicators for instant visual recognition
  • Optional package links to pub.dev for quick reference
  • Summary statistics showing support counts per platform
  • Unknown package detection with clear warnings

🎨 Flexible Display Options #

  • Icon mode: Use emoji icons (✅ ❌ ❔) for visual clarity
  • ASCII mode: Use plain characters (Y, N, ?) for terminal compatibility
  • Link display: Show/hide package links to pub.dev
  • Progress indicators: Real-time progress during compatibility checks

Easy Integration #

  • Command-line interface: Quick one-liner checks
  • Programmatic API: Integrate into your own tools and workflows
  • Automatic pubspec detection: Automatically finds your pubspec.yaml
  • Multiple fallback strategies: Uses 4 different methods to gather platform data

🚀 Quick Start #

Installation #

Add pubspec_checker to your Flutter or Dart project:

dev_dependencies:
  pubspec_checker: ^1.3.0

Run this command:

flutter pub get
# or
dart pub get

📒 Basic CLI Usage #

Command-Line Interface (CLI) To use the package, run the following command:

dart run pubspec_checker <platforms> [options]

Parameters

  • <platforms>: The platforms to check compatibility for. Supported values are:
    • android
    • ios
    • web
    • windows
    • linux
    • macos

Options

  • -s or --show: Display the platform status indicator as icon (e.g. Supported : ✅ ❌ ❔, otherwise the default Y, N, ?).
  • -l or --links: Display the links to the package details.

📚 Examples #

Check compatibility for all platforms with links and show icons:

dart run pubspec_checker -s -l
//or
dart run pubspec_checker all -s -l

Check compatibility for android and ios:

dart run pubspec_checker android ios -s -l

Check compatibility for android and ios and shows package link:

dart run pubspec_checker android ios -l

Check compatibility for web:

dart run pubspec_checker web
dart run pubspec_checker:web #alternative command with colon

Example output showing status platform as icon (-s):

dart run pubspec_checker -l -s

Example output showing status platform by default (without -s):

dart run pubspec_checker -l

NOTE: 📝 By default we use ASCII characters (e.g., Y, N, ?) on platform status indicator to ensure proper alignment across different terminals such: (Command Prompt, PowerShell, Linux Terminal, Git Bash, etc). Emojis like ✅, ❌, and ❔ can sometimes have variable widths depending on the terminal or font.

💡 Additional information #

If you want to use the package programmatically, here’s how you can do it:

import 'package:pubspec_checker/pubspec_checker.dart';

void main() async {
  // Initialize with target platforms
  final platformChecker = PlatformChecker([
    PackagePlatform.ios,
    PackagePlatform.android
  ]);

  // Read dependencies from pubspec.yaml
  final pubspecReader = PubspecReader();
  final dependencies = pubspecReader.getDependencies();

  // Check compatibility
  final results = await platformChecker.checkDependenciesCompatibility(dependencies);

  // Process results
  for (final entry in results.entries) {
    final packageName = entry.key;
    final compatibility = entry.value;

    print('Package: $packageName');
    print('Version: ${compatibility.version}');
    print('Supported Platforms: ${compatibility.platforms.map((p) => p.platformName).join(', ')}');
    print('Link: ${compatibility.link}');
  }
}

If you want simply check the list of packages not the dependencies.

import 'package:pubspec_checker/pubspec_checker.dart';

void main() async {
  // Initialize with target platforms
  final platformChecker = PlatformChecker([
    PackagePlatform.ios,
    PackagePlatform.android
  ]);
  
  // Check compatibility of the packages
  final results = await platformChecker.checkPackagesCompatibility([
    'provider',
    'http',
    'flutter_bloc',
  ]);

  // Process results
  for (final entry in results.entries) {
    final packageName = entry.key;
    final compatibility = entry.value;

    print('Package: $packageName');
    print('Version: ${compatibility.version}');
    print('Supported Platforms: ${compatibility.platforms.map((p) => p.platformName).join(', ')}');
    print('Link: ${compatibility.link}');
  }
}

Notes

  • Platforms are provided using the PackagePlatform enum for compile-time safety.
  • Public APIs are documented with examples, while internal implementations are hidden from API docs.
  • When using the package programmatically, add it under dependencies, not dev_dependencies.

Sample Output:

🔧 How It Works #

Platform Detection Strategies #

pubspec_checker uses multiple methods to determine platform compatibility:

  1. Primary: Direct pubspec metadata from pub.dev API
  2. Fallback 1: Package score tags (platform:xxx tags)
  3. Fallback 2: Search-based platform detection
  4. Fallback 3: Web scraping of package pages

This multi-layered approach ensures maximum accuracy even when platform data is incomplete.

Architecture #

🐞 Contributing #

Contributions are welcome! If you encounter any issues or have feature requests, please open an issue or submit a pull request on GitHub.

🎖️ License #

This package is licensed under the MIT License.

3
likes
160
points
318
downloads
screenshot

Publisher

verified publisherbcssti.com

Weekly Downloads

A simple Dart package that checks the compatibility of all dependencies in the pubspec.yaml file for specified platforms

Repository (GitHub)
View/report issues

Topics

#tarsier #pubspec #checker #package #platforms

Documentation

API reference

License

MIT (license)

Dependencies

args, html, http, yaml

More

Packages that depend on pubspec_checker