Skip to content

A simple 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.

License

Notifications You must be signed in to change notification settings

marianz-bonfire/pubspec_checker

Repository files navigation

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 Check:
    • Specify platforms (e.g., android, ios, web, etc.) to check which packages are supported.
  • Detailed Reporting:
    • List all packages with their supported platforms. Optionally show package links for more details.
  • Easy to Use:
    • Command-line arguments for quick execution and flexibility.
  • 🆕Tabular Format:
    • Makes data clean, structured, and easy to read, especially when comparing multiple values. It also scales well when adding more details like links or summaries.

🚀 Getting started

Add pubspec_checker to your Flutter or Dart project:

dev_dependencies:
  pubspec_checker: ^1.0.9

Run this command:

flutter pub get

📒 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).
  • -l or --links: Display the links to the package details.

📚 Examples

Check compatibility for android and ios:

dart run pubspec_checker android ios

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

Check compatibility for all platforms with -s:

dart run pubspec_checker -s -l

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

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

dart run pubspec_checker -l

Example Output showing status platform in:

NOTE: 📝 By default we use ASCII characters (e.g., Y, X, ?) 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 {
  final checker = PlatformChecker(['ios', 'android']);
  final reader = PubspecReader();

  final dependencies = reader.getDependencies();
  final results = await checker.checkPackageCompatibility(dependencies);

  for (var package in results.entries) {
    print('Package: ${package.key}, Supported Platforms: ${package.value['platforms'].join(", ")}');
  }
}

NOTE: Using package in the code, make sure you add it under pubspec dependencies not in the dev_dependencies.

Sample Output:

🐞 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.

About

A simple 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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published