InjectBeforePattern class final

Inserts code immediately before the first match of pattern in targetFile.

Example

InjectBeforePattern(
  targetFile: 'lib/main.dart',
  pattern: RegExp(r'Magic\.init'),
  code: 'AnalyticsPlugin.configure();',
)
Inheritance

Constructors

InjectBeforePattern({required String targetFile, required Pattern pattern, required String code, Pattern? fallbackPattern})
Creates an InjectBeforePattern operation.
const

Properties

code → String
Code snippet to insert before the matched pattern.
final
fallbackPattern → Pattern?
Tried when pattern matches nothing. See InjectAfterPattern.fallbackPattern.
final
hashCode → int
The hash code for this object.
no setterinherited
pattern → Pattern
Pattern whose first match determines the insertion point.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
targetFile → String
Target Dart file relative to the project root.
final

Methods

describe() → String
Returns a human-readable dry-run line for this operation.
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