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
- fileHeader ← String
-
Set the file header to be added before any generated imports. A blank line
will automatically be added after the file header.
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
. Therange
is 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
. Theoffset
is relative to the original source. ThebuildEdit
function 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
range
to the linked edit group with the givengroupName
. Therange
is 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
. Therange
is relative to the original source. ThebuildEdit
function 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
text
at the givenoffset
. Theoffset
is 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
. Therange
is relative to the original source. The original content will be replaced by the giventext
. This is fully equivalent toinherited -
canWriteType(
DartType? type, {ExecutableElement? methodBeingCopied}) → bool -
Check if the code for a type annotation for the given
type
can be written. -
convertFunctionFromSyncToAsync(
FunctionBody body, TypeProvider typeProvider) → void -
Create one or more edits that will convert the given function
body
from being synchronous to be asynchronous. This includes adding theasync
modifier to the body as well as potentially replacing the return type of the function toFuture
. -
format(
SourceRange range) → void -
Format the code covered by the
range
. -
importLibrary(
Uri uri, {String? prefix, String? showName}) → String -
Arrange to have an import added for the library with the given
uri
. If aprefix
is provided it will be used in the import directive. -
importLibraryElement(
Uri uri) → ImportLibraryElementResult -
Ensure that the library with the given
uri
is imported. -
importsLibrary(
Uri uri) → bool -
Return
true
if the given libraryuri
is already imported or will be imported by a scheduled edit. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
replaceTypeWithFuture(
TypeAnnotation typeAnnotation, TypeProvider typeProvider) → void -
Optionally create an edit to replace the given
typeAnnotation
with the typeFuture
(with the given type annotation as the type argument). ThetypeProvider
is used to check the current type, because if it is alreadyFuture
no edit will be added. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited