extension_discovery
2.1.1, released 3 weeks ago by tools.dart.dev
Convention and utilities for discovering package extensions via config.yaml files.
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.
92Compare - black_hole_flutter
Flutter utility functions, extension methods, and custom widgets.
83Compare - dart_helper_utils
Dart extensions and helpers for maps, strings, collections, dates, async, and intl formatting.
80Compare - gtk
GTK utilities for Flutter Linux applications, providing settings and application lifecycle helpers.
76Compare
Works with
Packages commonly used together with extension_discovery: ones it builds on, ones built on it, and its own family.
- yamlextension_discovery depends on itA Dart library for parsing YAML documents into Dart data structures.
- analyzerSame familyPerforms static analysis of Dart code for tool integration and embedding.
- dart_styleSame familyProvides an API and CLI to format Dart source code automatically.
- pubspec_parseSame familyParse pubspec.yaml files with a type‑safe API and detailed error reporting.
- coverageSame familyCollects, manipulates, and formats code coverage data in Dart
- cli_configSame familyLibrary to read config from CLI args, env vars, and JSON/YAML files
- yaml_editSame familyYAML manipulation library preserving comments and whitespace
- build_runnerSame familyA build system for Dart code generation and modular compilation.