smf_contribution_engine library
Patches existing Dart files: adds imports and statements, inserts list elements, replaces widgets and edits their arguments.
Each change is a Contribution that finds its target in the parsed file.
PatchEngine applies contributions to a project and renders the Mustache
placeholders in the text they insert.
Classes
- Contribution
- A change to one Dart file, such as an import to add or a widget to replace.
- InsertImport
- Adds an import directive to file, unless the file already has it.
- InsertIntoFunction
- Inserts statements into the body of a top-level function, next to the statements that contain an anchor text.
- InsertIntoListInFunction
-
Adds an element at the start of a list literal passed as a named
argument, such as the
providersof aMultiProviderbuilt inmain. - InsertIntoListInMethodInClass
-
Adds an element at the end of a list literal passed as a named argument
in a method, such as the
supportedLocalesof theMaterialAppbuilt inMainApp.build. - InsertIntoMethodInClass
-
Inserts statements into the body of a method, after the statements that
contain an anchor text, such as a call in
initStateaftersuper.initState();. - ModifyWidgetArguments
-
Removes, overrides and appends named arguments of a widget, such as
swapping
homeforrouterConfigonMaterialApp.router. - PatchEngine
- Applies contributions to the files under projectRoot.
- ReplaceWidget
-
Replaces the type name of a widget, such as
MaterialAppwithMaterialApp.router, keeping its arguments.