SourceEdit class
A class representing a change on a String, intended to be compatible with
package:analysis_server
's SourceEdit.
For example, changing a string from
foo: foobar
to
foo: barbar
will be represented by
SourceEdit(offset: 4, length: 3, replacement: 'bar')
- Annotations
-
- @sealed
Constructors
- SourceEdit(int offset, int length, String replacement)
-
Creates a new SourceEdit instance.
offset
,length
andreplacement
must be non-null, andoffset
andlength
must be non-negative.factory -
SourceEdit.fromJson(Map<
String, dynamic> json) -
Constructs a SourceEdit from JSON.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- length → int
-
The length of the substring to be replaced.
final
- offset → int
-
The offset from the start of the string where the modification begins.
final
- replacement → String
-
The replacement string to be used.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
apply(
String original) → String - Applies one SourceEdits to an original string, and return the final output.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Encodes this object as JSON-compatible structure.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
applyAll(
String original, Iterable< SourceEdit> edits) → String - Applies a series of SourceEdits to an original string, and return the final output.