ModuleKind class final

A kind of module and the rules modules of that kind follow, such as "features live in lib/features/<id>/".

Kinds are data: the pipeline applies them without knowing any kind. The kinds of the built-in modules are in ModuleKinds of package:smf_contracts/smf_contracts.dart. A rule that only a role knows goes into roleRules, where the role finds it.

Paths are relative to the project root and may contain <id>, which stands for the module id; directories may end with a slash.

Annotations
  • @immutable

Constructors

ModuleKind({required String id, required String label, Set<Role<Object>> mustProvide = const {}, Set<Role<Object>> impliedRequires = const {}, List<String> fileRoots = const [], List<String> forbiddenFileRoots = const [], Set<Role<Object>> requiredData = const {}, Set<Role<Object>> forbiddenData = const {}, bool allowsVariants = true, List<KindRule> roleRules = const []})
Creates the kind id.
const

Properties

allowsVariants → bool
Whether modules of the kind may have Variants.
final
fileRoots → List<String>
Directories every generated file of the module must be in, or empty to allow any, such as lib/features/<id>/.
final
forbiddenData → Set<Role<Object>>
Roles no module of the kind may contribute data to.
final
forbiddenFileRoots → List<String>
Directories no generated file of the module may be in.
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
A unique id in lower snake_case, such as feature.
final
impliedRequires → Set<Role<Object>>
Roles every module of the kind requires without listing them; they are added to ModuleDescriptor.effectiveRequires.
final
label → String
The name of the kind in prompts, where the modules without a role are grouped by kind, such as Features.
final
mustProvide → Set<Role<Object>>
Roles every module of the kind must provide, each with a provider in ModuleDescriptor.providers; the pipeline checks it.
final
requiredData → Set<Role<Object>>
Roles every module of the kind must contribute data to.
final
roleRules → List<KindRule>
Rules of roles for the modules of the kind, which each role reads with ruleOf; the pipeline applies none of them.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

allowsFile(ModuleId module, String path) → bool
Whether the module module may generate the file at path.
fileRootsOf(ModuleId module) → List<String>
fileRoots for the module module.
forbiddenFileRootsOf(ModuleId module) → List<String>
forbiddenFileRoots for the module module.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ruleOf<T extends KindRule>() → T?
The first of roleRules of the type T, or null if the kind has none.
toString() → String
A string representation of this object.
override

Operators

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