Skip to content
pubscout

extension_discovery

2.1.1, released 3 weeks ago by tools.dart.dev

Convention and utilities for discovering package extensions via config.yaml files.

Rock solid
$ flutter pub add extension_discovery
Source repository

What it does

Provides utilities to discover package extensions based on a file convention (`extension/<targetPackage>/config.yaml`). It scans `.dart_tool/package_config.json` to locate matching packages and read their extension configurations.

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

Use it when

  • You are building a development tool that allows other packages to provide extensions.
  • You need to discover configuration files from dependent packages in a project workspace.

Skip it when

  • You are targeting compiled Flutter applications or AOT-compiled executables where `package_config.json` is missing.
  • You need runtime extension loading in production environments.

Strengths

  • Simplifies modular tool development and plugin discovery in Dart workspaces.
  • Caches results for fast loading based on modification timestamps.

Weaknesses

  • Does not work in AOT-compiled or JIT-restricted runtime environments without manual workspace configurations.
  • Requires custom documentation and validation by the authors of the extendable package.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2

Not documented

import 'package:extension_discovery/extension_discovery.dart';

Future<void> sayHello(String language) async {
  final extensions = await findExtensions('hello_world');
  for (final ext in extensions) {
    final config = ext.config;
    print(config);
  }
}

Alternatives

Packages that do the same job and could replace extension_discovery.

  • mime

    Utilities to resolve MIME types from file names, magic bytes, and to parse multipart streams.

  • black_hole_flutter

    Flutter utility functions, extension methods, and custom widgets.

  • dart_helper_utils

    Dart extensions and helpers for maps, strings, collections, dates, async, and intl formatting.

  • gtk

    GTK utilities for Flutter Linux applications, providing settings and application lifecycle helpers.

Works with

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