core library

The core of the module model without any concrete role: modules, roles, sockets, contributions and the seams of the pipeline.

The pipeline imports only this library, so it cannot depend on a concrete role. Modules import package:smf_contracts/smf_contracts.dart, which adds the built-in roles.

Classes

AppIdentity
Platform identifiers of the generated app.
ArgsSocket
A socket for named arguments of a call, such as the arguments of MaterialApp.
BrickContribution
Template files of a module or role template: a mason bundle.
CodegenRequest
A request to run code generation in the generated app.
CodeSocket
A socket for code, one Fragment after another in the order of their contributors: statements, declarations, or, for a CodeSocket.text, lines of a non-Dart file such as XML.
ConflictPolicy<V extends Object>
Allows one value per key: equal values merge, different ones conflict.
Contribution
Something a module or a role template adds to the app.
ContributionOrigin
Who contributed something to the app: a module, the template of a role, or the pipeline itself.
DartFileIndex
What a rendered Dart file of the generated app declares and uses, as data.
FactoryListSocket
A socket for a list of function expressions that the owner of the socket calls: factories, such as () => MyNavigatorObserver(), which it calls as many times as it needs instances, or listeners, which it calls when something happens.
Fragment
A piece of code for a socket, with the imports it needs.
ImportRef
An import that a Fragment needs.
IndexedConstructor
A constructor of an indexed class.
IndexedDeclaration
A top-level declaration of an indexed file.
IndexedImport
An import or export directive of an indexed file.
IndexedInvocation
An invocation in an indexed file, such as locator<A>(), context.nav.home.details(id: 1) or HomeScreen().
IndexedMemberAccess
A property access, such as nav.home in context.nav.home.
IndexedParameter
A parameter of an indexed function or constructor.
IndexedReference
An identifier used without being invoked, such as the tear-off resolve<A> or a read of appRouter.
KeyedSocket<V extends Object>
A socket for entries with a key, such as Android permissions or Gradle plugins.
MaxPolicy
Keeps the greater of two values, such as the higher of two minimum versions.
MergePolicy<V extends Object>
How a KeyedSocket or ValueSocket merges two values contributed for the same key.
ModuleContext
What a module may know about the app it is generated into.
ModuleDescriptor
What a module is and how it relates to other modules and roles.
ModuleKind
A kind of module and the rules modules of that kind follow, such as "features live in lib/features/<id>/".
ModuleOrigin
A contribution of a module, possibly from one of its Variants.
ModuleRule<D extends Object>
A check that a role applies, during validation and before anything is rendered, to each module that provides, requires or uses the role.
ModuleRuleInput<D extends Object>
The module a ModuleRule checks.
ModuleRuleRequest
What the pipeline knows when it runs the module rules of a role for one module; see Role.checkModule.
NoDsl
The data type of a role that takes no data from modules.
NoValue
The value of the entries of a KeyedSocket whose entries are only keys, such as the permissions of the Android manifest.
PipelineOrigin
A contribution of the pipeline itself, such as the build_runner dependency it adds for a CodegenRequest.
PipelineSocket
A socket the pipeline fills itself, such as the dependencies section of pubspec.yaml.
PipelineSockets
The sockets of the pipeline in the templates of the app.
PostGenStep
A command the pipeline runs in the generated app after flutter pub get and code generation, such as flutterfire configure.
Preflight
Checks of the machine that a module needs before generation, such as an installed and logged-in Firebase CLI.
PreflightCheck
One check of a Preflight, such as "the Firebase CLI is installed".
PreflightFailed
The check itself could not run, for the reason in message.
PreflightMissing
What the check looks for is not there, or not as the module needs it, and instructions say how to fix it.
PreflightPassed
Everything the check looks for is in place.
PreflightStatus
The result of a PreflightCheck.
PubspecContribution
A part of the generated app's pubspec.yaml: a dependency, an SDK constraint, or settings of the flutter: section.
PubspecDependency
A dependency or dev dependency of the app.
PubspecEnvironment
SDK constraints of the app, the environment: section.
PubspecFlutter
Settings of the flutter: section of the app.
PubspecFont
A font family of a PubspecFlutter.
PubspecFontAsset
A font file of a PubspecFont.
RequiredClass
A top-level class that a provider must generate; the parameters are those of its unnamed constructor.
RequiredFunction
A top-level function that a provider must generate.
RequiredSymbol
A symbol that every provider of a role must generate, such as the createAppRouter() function of a router.
Role<D extends Object>
A replaceable part of an app, such as the router, the DI container or the app entry, described by what it offers to the rest of the app.
RoleChoiceContext<D extends Object>
The input of a RoleTemplate.choose hook.
RoleChoiceRequest
What the pipeline knows when it runs the RoleTemplate.choose hooks.
RoleData<D extends Object>
Data for a role in the role's own language, such as the routes of a feature for the router role.
RoleHookInput<D extends Object>
The input of a hook of a role's template or of one of its providers.
RoleHookRequest
What the pipeline knows when it runs the hooks of roles and providers.
RoleInterface
What a role guarantees to the rest of the app: the files its template generates and the symbols that other code uses.
RoleOption
A command line option of a role, such as --start of the router.
RoleOutput
What the RoleTemplate.render or RoleProvider.render hook adds to the app.
RoleProvider<D extends Object>
The implementation of a role by a module, such as the go_router module providing the router role.
RoleTemplate<D extends Object>
The code a role contributes itself, whichever module provides it, such as the interface a router's providers implement.
RoleTemplateOrigin
A contribution of the template of a role, which the pipeline treats as a pseudo-owner named role:<id>.
SmfEnvironment
What a hook with side effects may use: the machine, the user, and external commands.
SmfIssue
A problem found by a check: a validation hook of a role or provider, a module rule, a structural rule, or the pipeline.
SmfLogger
Reports progress and problems to the user.
SmfModule
A module: a piece of an app that the user can select, such as a router, a DI container or a feature.
SmfNames
Rules for the names that the module model turns into Dart identifiers, route paths and template tags: module ids, role ids and socket names.
SmfProcessResult
The result of a command run by SmfProcessRunner.run.
SmfProcessRunner
Runs external commands.
SmfProgress
The progress indicator of a long-running task.
SmfPrompter
Asks the user questions in the terminal.
SocketContribution
Code or a value for a socket.
SocketFamily<Key, K extends SocketKind>
A family of sockets of the same kind, one per key, such as the annotations of every screen of the router.
SocketKind
What a socket accepts and how its contributions become text.
SocketRef<K extends SocketKind>
A reference to a socket: a named place in a template that receives contributions of the kind K.
StructuralRule<D extends Object>
A check that a role applies to the generated code of an app, such as "resolve is called only in composition files".
StructuralRuleInput<D extends Object>
The generated app a StructuralRule checks.
StructuralRuleRequest
What the contract test harness knows when it runs the structural rules of a role; see Role.checkStructure.
ToolInstall
What PreflightCheck.install installed.
ToolRef
A resolved way to run a tool: an executable, arguments that always come first, and environment variables.
UnionPolicy<E extends Object>
Unites lists of values, keeping the order of first appearance and dropping every repeated value.
ValueSocket<V extends Object>
A socket for one value merged from all contributions, such as the minimum iOS version of the app.
Variants
Alternative contributions of a module for different providers of role, such as a feature screen with a BLoC and a Riverpod variant.
WrapperSocket
A socket that wraps a piece of code, such as the root widget of the app.

Enums

ArgShape
Whether an argument of an ArgsSocket takes one value or a list.
DeclarationKind
Kinds of top-level declarations.
HostOperatingSystem
The operating system the pipeline runs on.
IssueSeverity
How serious an SmfIssue is.
ParameterKind
Kinds of parameters.
PubspecSource
Where a PubspecDependency comes from.
RoleCardinality
How many providers of a role an app can have.

Extension Types

ModuleId
Identifies a module: a lower snake_case name such as go_router.

Extensions

KeyedSocketContributions on SocketRef<KeyedSocket<V>>
Contributions to a KeyedSocket.
KeySocketContributions on SocketRef<KeyedSocket<NoValue>>
Contributions to a KeyedSocket whose entries are only keys.
ValueSocketContributions on SocketRef<ValueSocket<V>>
Contributions to a ValueSocket.

Functions

compareLooseVersions(String a, String b) → int
Compares versions such as 13.0, 15, 8.7.3 or 33.3.1-jre, which minimum platform versions and Gradle artifacts use.

Typedefs

VariantContributions = List<Contribution> Function(ModuleContext context)
The contributions of a module's variant for one provider of a role.

Exceptions / Errors

MergeConflict
Thrown when two values for a key cannot be merged.
SmfCancelledException
Thrown when the user cancels the run, such as with Ctrl-C.
SmfUsageException
Thrown by a role hook when the user's input cannot work, such as a missing option in a non-interactive run.