ModifyWidgetArguments class
Removes, overrides and appends named arguments of a widget, such as
swapping home for routerConfig on MaterialApp.router.
Every instance of widgetName in the file is changed: the arguments named
in removeArgs go with their comma, those in addArgs that the widget
already has get the new value, and the rest of addArgs are appended,
keeping a trailing comma at the end of the list. Each matched widget loses
its const (or new), since the new arguments need not be constant, and
so do the widget creations and collection literals around it whose
const makes it constant; a const declaration around it stays. An
edit inside an argument that an outer widget removes or overrides goes
away with that argument.
Without a matching widget nothing is edited. Only the changed arguments are touched, so the others and their comments stay as written, but the whole file is reformatted. Running it again changes nothing: the removed arguments are gone, and addArgs overrides what it added instead of repeating it.
- Inheritance
-
- Object
- Contribution
- ModifyWidgetArguments
Constructors
Properties
-
addArgs
→ Map<
String, String> -
Named arguments to set: one the widget already has gets the new value,
the others are appended.
final
- dartFormater → DartFormatter
-
The formatter contributions run over the code they produce.
no setterinherited
- file → String
-
The path of the file to change, relative to the project root.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
removeArgs
→ List<
String> -
The names of the named arguments to remove, such as
home.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- widgetName → String
-
The name of the widget to change, such as
Text.final
Methods
-
apply(
String original) → Future< String> -
Returns
original, the content of file, with this change applied.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited