DartEditBuilder class abstract
An EditBuilder used to build edits in Dart files.
Clients may not extend, implement or mix-in this class.
- Implemented types
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addLinkedEdit(
String groupName, void buildLinkedEdit(DartLinkedEditBuilder builder)) → void -
Add a region of text that is part of the linked edit group with the given
groupName
. ThebuildLinkedEdit
function is used to write the content of the region of text and to add suggestions for other possible values for that region.override -
addSimpleLinkedEdit(
String groupName, String text, {LinkedEditSuggestionKind kind, List< String> suggestions}) → void -
Add the given text as a linked edit group with the given
groupName
. If both akind
and a list ofsuggestions
are provided, they will be added as suggestions to the group with the given kind.inherited -
canWriteType(
DartType? type, {ExecutableElement? methodBeingCopied}) → bool -
Check if the code for a type annotation for the given
type
can be written. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
selectAll(
void writer()) → void -
Set the selection to cover all of the code written by the given
writer
.inherited -
selectHere(
) → void -
Set the selection to the current location within the edit being built.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
write(
String string) → void -
Add the given
string
to the content of the current edit.inherited -
writeClassDeclaration(
String name, {Iterable< DartType> ? interfaces, bool isAbstract = false, void membersWriter()?, Iterable<DartType> ? mixins, String? nameGroupName, DartType? superclass, String? superclassGroupName}) → void -
Write the code for a declaration of a class with the given
name
. If a list ofinterfaces
is provided, then the class will implement those interfaces. IfisAbstract
istrue
, then the class will be abstract. If amembersWriter
is provided, then it will be invoked to allow members to be generated. If a list ofmixins
is provided, then the class will mix in those classes. If anameGroupName
is provided, then the name of the class will be included in the linked edit group with that name. If asuperclass
is given then it will be the superclass of the class. (If a list ofmixins
is provided but nosuperclass
is given then the class will extendObject
.) -
writeConstructorDeclaration(
String className, {ArgumentList? argumentList, void bodyWriter()?, String? classNameGroupName, String? constructorName, String? constructorNameGroupName, List< String> ? fieldNames, void initializerWriter()?, bool isConst = false, void parameterWriter()?}) → void -
Write the code for a constructor declaration in the class with the given
className
. IfisConst
istrue
, then the constructor will be marked as being aconst
constructor. If aconstructorName
is provided, then the constructor will have the given name. If both a constructor name and aconstructorNameGroupName
is provided, then the name of the constructor will be included in the linked edit group with that name. If aparameterWriter
is provided then it is used to write the constructor parameters (enclosing parenthesis are written for you). Otherwise, if anargumentList
is provided then the constructor will have parameters that match the given arguments. If no argument list is given, but a list offieldNames
is provided, then field formal parameters will be created for each of the field names. If aninitializerWriter
is provided then it is used to write the constructor initializers (the:
prefix is written for you). If abodyWriter
is provided then it is used to write the constructor body, otherwise an empty body is written. -
writeFieldDeclaration(
String name, {void initializerWriter()?, bool isConst = false, bool isFinal = false, bool isStatic = false, String? nameGroupName, DartType? type, String? typeGroupName}) → void -
Write the code for a declaration of a field with the given
name
. If aninitializerWriter
is provided, it will be invoked to write the content of the initializer. (The equal sign separating the field name from the initializer expression will automatically be written.) IfisConst
istrue
, then the declaration will be preceded by theconst
keyword. IfisFinal
istrue
, then the declaration will be preceded by thefinal
keyword. (If bothisConst
andisFinal
aretrue
, then only theconst
keyword will be written.) IfisStatic
istrue
, then the declaration will be preceded by thestatic
keyword. If anameGroupName
is provided, the name of the field will be included in the linked edit group with that name. If atype
is provided, then it will be used as the type of the field. (The keywordvar
will be provided automatically when required.) If atypeGroupName
is provided, then if a type was written it will be in the linked edit group with that name. -
writeFunctionDeclaration(
String name, {void bodyWriter()?, bool isStatic = false, String? nameGroupName, void parameterWriter()?, DartType? returnType, String? returnTypeGroupName}) → void -
Write the code for a declaration of a function with the given
name
. If abodyWriter
is provided, it will be invoked to write the body of the function. (The space between the name and the body will automatically be written.) IfisStatic
istrue
, then the declaration will be preceded by thestatic
keyword. If anameGroupName
is provided, the name of the function will be included in the linked edit group with that name. If areturnType
is provided, then it will be used as the return type of the function. If areturnTypeGroupName
is provided, then if a return type was written it will be in the linked edit group with that name. If aparameterWriter
is provided, then it will be invoked to write the declarations of the parameters to the function. (The parentheses around the parameters will automatically be written.) -
writeGetterDeclaration(
String name, {void bodyWriter(), bool isStatic = false, String nameGroupName, DartType returnType, String returnTypeGroupName}) → void -
Write the code for a declaration of a getter with the given
name
. If abodyWriter
is provided, it will be invoked to write the body of the getter. (The space between the name and the body will automatically be written.) IfisStatic
istrue
, then the declaration will be preceded by thestatic
keyword. If anameGroupName
is provided, the name of the getter will be included in the linked edit group with that name. If areturnType
is provided, then it will be used as the return type of the getter. If areturnTypeGroupName
is provided, then if a return type was written it will be in the linked edit group with that name. -
writeImportedName(
List< Uri> uris, String name) → void -
Write the given
name
, possibly with a prefix, assuming that the name can be imported from any of the givenuris
. -
writeln(
[String string]) → void -
Add the given
string
to the content of the current edit and then add an end-of-line marker.inherited -
writeLocalVariableDeclaration(
String name, {void initializerWriter()?, bool isConst = false, bool isFinal = false, String? nameGroupName, DartType? type, String? typeGroupName}) → void -
Write the code for a declaration of a local variable with the given
name
. If aninitializerWriter
is provided, it will be invoked to write the content of the initializer. (The equal sign separating the variable name from the initializer expression will automatically be written.) IfisConst
istrue
, then the declaration will be preceded by theconst
keyword. IfisFinal
istrue
, then the declaration will be preceded by thefinal
keyword. (If bothisConst
andisFinal
aretrue
, then only theconst
keyword will be written.) If anameGroupName
is provided, the name of the variable will be included in the linked edit group with that name. If atype
is provided, then it will be used as the type of the variable. (The keywordvar
will be provided automatically when required.) If atypeGroupName
is provided, then if a type was written it will be in the linked edit group with that name. -
writeMixinDeclaration(
String name, {Iterable< DartType> ? interfaces, void membersWriter()?, String? nameGroupName, Iterable<DartType> ? superclassConstraints}) → void -
Write the code for a declaration of a mixin with the given
name
. If a list ofinterfaces
is provided, then the mixin will implement those interfaces. If amembersWriter
is provided, then it will be invoked to allow members to be generated. If anameGroupName
is provided, then the name of the class will be included in the linked edit group with that name. -
writeOverride(
ExecutableElement element, {StringBuffer? displayTextBuffer, bool invokeSuper = false}) → void -
Append a placeholder for an override of the specified inherited
element
. If provided, write a string value suitable for display (e.g., in a completion popup) in the givendisplayTextBuffer
. IfinvokeSuper
istrue
, then the correspondingsuper.name()
will be added in the body. -
writeParameter(
String name, {bool isCovariant, bool isRequiredNamed, ExecutableElement? methodBeingCopied, String? nameGroupName, DartType? type, String? typeGroupName, bool isRequiredType}) → void -
Write the code for a single parameter with the given
name
. -
writeParameterMatchingArgument(
Expression argument, int index, Set< String> usedNames) → void -
Write the code for a parameter that would match the given
argument
. The name of the parameter will be generated based on the type of the argument, but if the argument type is not known theindex
will be used to compose a name. In any case, the set ofusedNames
will be used to ensure that the name is unique (and the chosen name will be added to the set). -
writeParameters(
Iterable< ParameterElement> parameters, {ExecutableElement? methodBeingCopied, bool includeDefaultValues = true, bool requiredTypes}) → void -
Write the code for a list of
parameters
, including the surrounding parentheses and default values (unlessincludeDefaultValues
isfalse
). -
writeParametersMatchingArguments(
ArgumentList arguments) → void -
Write the code for a list of parameters that would match the given list of
arguments
. The surrounding parentheses are not written. -
writeReference(
Element element) → void -
Write the code that references the
element
. If theelement
is a top-level element that has not been imported into the current library, imports will be updated. -
writeSetterDeclaration(
String name, {void bodyWriter()?, bool isStatic = false, String? nameGroupName, DartType? parameterType, String? parameterTypeGroupName}) → void -
Write the code for a declaration of a setter with the given
name
. If abodyWriter
is provided, it will be invoked to write the body of the setter. (The space between the name and the body will automatically be written.) IfisStatic
istrue
, then the declaration will be preceded by thestatic
keyword. If anameGroupName
is provided, the name of the getter will be included in the linked edit group with that name. If aparameterType
is provided, then it will be used as the type of the parameter. If aparameterTypeGroupName
is provided, then if a parameter type was written it will be in the linked edit group with that name. -
writeType(
DartType? type, {bool addSupertypeProposals = false, String? groupName, ExecutableElement? methodBeingCopied, bool required = false}) → bool -
Write the code for a type annotation for the given
type
. If thetype
is eithernull
or represents the type 'dynamic', then the behavior depends on whether a type isrequired
. Ifrequired
istrue
, then 'var' will be written; otherwise, nothing is written. -
writeTypeParameter(
TypeParameterElement typeParameter, {ExecutableElement? methodBeingCopied}) → void -
Write the code to declare the given
typeParameter
. The enclosing angle brackets are not automatically written. -
writeTypeParameters(
List< TypeParameterElement> typeParameters, {ExecutableElement? methodBeingCopied}) → void -
Write the code to declare the given list of
typeParameters
. The enclosing angle brackets are automatically written. -
writeTypes(
Iterable< DartType> ? types, {String? prefix}) → void -
Write the code for a comma-separated list of
types
, optionally prefixed by aprefix
. If the list oftypes
isnull
or does not contain any types, then nothing will be written.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited