craft_runner library
Riverpod Craft CLI — code generation toolkit for Riverpod.
Extend a built-in plugin
import 'package:craft_runner/craft_runner.dart';
class LoggingProviderPlugin extends ProviderPlugin {
@override
String get id => 'provider';
@override
String generate(ProviderInfo data) {
final base = super.generate(data);
return base + '// custom logging code';
}
}
Run with custom plugins
Create tool/craft.dart in your project:
import 'package:craft_runner/craft_runner.dart';
import '../lib/plugins/logging_provider_plugin.dart';
void main(List<String> args) {
runWithPlugins([LoggingProviderPlugin()], args);
}
Then run: dart run tool/craft.dart watch
Classes
- AnnotationInfo
-
Metadata about a Dart annotation (e.g.,
@provider,@command). - Command
- CommandBuilder
- CommandPlugin
-
Built-in plugin that handles top-level
@commandfunctions. - DartClassElement
- A class element with its metadata.
- DartClassInfo
- Metadata about a Dart class declaration.
- DartElementInfo
- A parsed Dart element (class or function) with clean metadata.
- DartFunctionElement
- A function element with its metadata.
- DartFunctionInfo
- Metadata about a top-level function declaration.
- FileProcessor
- Handles file processing operations
- MethodInfo
- Metadata about a class method.
- ParameterInfo
- PluginCollectionResult
- Wraps a plugin's collected result with a reference to the plugin.
- ProjectWideCraftPlugin
- A craft_runner plugin that operates across the entire project rather than one file at a time.
- ProviderInfo
- ProviderPlugin
-
Built-in plugin that handles
@providerannotations. - PublicMethod
-
RiverpodCraftPlugin<
T> - The interface every riverpod_craft plugin implements.
Enums
Functions
-
runWithPlugins(
List< RiverpodCraftPlugin> plugins, List<String> args, {List<ProjectWideCraftPlugin> projectWidePlugins = const []}) → Future<void> - Runs the Riverpod Craft CLI with custom plugins registered.