GeneratorHooks class

Scripts that run automatically whenever a particular event occurs in a Generator.

Constructors

GeneratorHooks({HookFile? preGenHook, HookFile? postGenHook, List<int>? pubspec, String checksum = ''})
Scripts that run automatically whenever a particular event occurs in a Generator.
const

Properties

checksum String
The hash of the hooks directory and its contents.
final
hashCode int
The hash code for this object.
no setterinherited
postGenHook → HookFile?
Hook run immediately after the generate method is invoked.
final
preGenHook → HookFile?
Hook run immediately before the generate method is invoked.
final
pubspec List<int>?
Contents of the hooks pubspec.yaml if exists.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

compile({Logger? logger}) Future<void>
Compile all hooks into modules for faster execution. Hooks are compiled lazily by default but calling compile can be used to compile hooks ahead of time.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
postGen({Map<String, dynamic> vars = const <String, dynamic>{}, String? workingDirectory, void onVarsChanged(Map<String, dynamic> vars)?, Logger? logger}) Future<void>
Runs the post-generation (post_gen) hook with the specified vars. An optional workingDirectory can also be specified.
preGen({Map<String, dynamic> vars = const <String, dynamic>{}, String? workingDirectory, void onVarsChanged(Map<String, dynamic> vars)?, Logger? logger}) Future<void>
Runs the pre-generation (pre_gen) hook with the specified vars. An optional workingDirectory can also be specified.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromBrickYaml(BrickYaml brick) Future<GeneratorHooks>
Creates GeneratorHooks from a provided BrickYaml.