DartFileEditBuilder class abstract
A FileEditBuilder used to build edits for Dart files.
Clients may not extend, implement or mix-in this class.
- Implemented types
Constructors
Properties
- eol → String
-
The end of line marker used for this file.
no setterinherited
- fileHeader ← String
-
Sets the file header to be added before any generated imports.
no getter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
requiredImports
→ List<
Uri> -
A list of new URIs that must be imported for the types being referenced in
edits.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addDeletion(
SourceRange range) → void -
Add a deletion of text specified by the given
range. Therangeis relative to the original source. This is fully equivalent toinherited -
addInsertion(
int offset, void buildEdit(DartEditBuilder builder)) → void -
Add an insertion of text at the given
offset. Theoffsetis relative to the original source. ThebuildEditfunction is used to write the text to be inserted. This is fully equivalent tooverride -
addLinkedPosition(
SourceRange range, String groupName) → void -
Add the region of text specified by the given
rangeto the linked edit group with the givengroupName. Therangeis relative to the original source. This is typically used to include preexisting regions of text in a group. If the region to be included is part of newly generated text, then the method EditBuilder.addLinkedEdit should be used instead.inherited -
addReplacement(
SourceRange range, void buildEdit(DartEditBuilder builder)) → void -
Add a replacement of text specified by the given
range. Therangeis relative to the original source. ThebuildEditfunction is used to write the text that will replace the specified region.override -
addSimpleInsertion(
int offset, String text) → void -
Add an insertion of the given
textat the givenoffset. Theoffsetis relative to the original source. This is fully equivalent toinherited -
addSimpleReplacement(
SourceRange range, String text) → void -
Add a replacement of the text specified by the given
range. Therangeis relative to the original source. The original content will be replaced by the giventext. This is fully equivalent toinherited -
canWriteType(
DartType? type, {ExecutableElement? methodBeingCopied, List< TypeParameterElement> ? typeParametersInScope}) → bool -
Checks whether the code for a type annotation for the given
typecan be written. -
convertFunctionFromAsyncToSync(
{required FunctionBody body, required TypeSystem typeSystem, required TypeProvider typeProvider}) → void -
Creates one or more edits that will convert the given function
bodyfrom being asynchronous to be synchronous. This includes removing theasyncmodifier to the body as well as potentially replacing the return type of the function to theFuturetype argument. -
convertFunctionFromSyncToAsync(
{required FunctionBody body, required TypeSystem typeSystem, required TypeProvider typeProvider}) → void -
Creates one or more edits that will convert the given function
bodyfrom being synchronous to be asynchronous. This includes adding theasyncmodifier to the body as well as potentially replacing the return type of the function toFuture. -
format(
SourceRange range) → void -
Formats the code covered by the
range. -
importLibrary(
Uri uri, {String? prefix, String? showName, bool useShow = false}) → String -
Arranges to have an import added for the library with the given
uri. -
importLibraryElement(
Uri uri, {String? prefix, String? showName, bool useShow = false}) → ImportLibraryElementResult -
Ensures that the library with the given
uriis imported. -
importsLibrary(
Uri uri) → bool -
Returns whether the given library
uriis already imported or will be imported by a scheduled edit. -
insertCaseClauseAtEnd(
void buildEdit(DartEditBuilder builder), {required Token switchKeyword, required Token rightParenthesis, required Token leftBracket, required Token rightBracket}) → void - Inserts the code for a case clause at the end of a switch statement or switch expression.
-
insertConstructor(
CompilationUnitMember container, void buildEdit(DartEditBuilder builder)) → void - Inserts the code for a constructor.
-
insertField(
CompilationUnitMember compilationUnitMember, void buildEdit(DartEditBuilder builder)) → void - Inserts the code for a field.
-
insertGetter(
CompilationUnitMember compilationUnitMember, void buildEdit(DartEditBuilder builder)) → void - Inserts the code for a getter.
-
insertIntoUnitMember(
CompilationUnitMember compilationUnitMember, void buildEdit(DartEditBuilder builder), {bool lastMemberFilter(ClassMember existingMember)?}) → void -
Inserts into a
CompilationUnitMember. -
insertMethod(
CompilationUnitMember compilationUnitMember, void buildEdit(DartEditBuilder builder)) → void - Inserts the code for a method.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
replaceTypeWithFuture(
{required TypeAnnotation typeAnnotation, required TypeSystem typeSystem, required TypeProvider typeProvider}) → void -
Optionally creates an edit to replace the given
typeAnnotationwith the typeFuture(with the given type annotation as the type argument). -
replaceTypeWithFutureArgument(
{required TypeAnnotation typeAnnotation, required TypeSystem typeSystem, required TypeProvider typeProvider}) → void -
Optionally creates an edit to replace the given
typeAnnotationwith theFuturetype argument. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited