MagicMainDartEditor class
Magic-specific thin wrapper around MainDartEditor that pins the
'Magic.init' anchor so callers never hardcode the magic-internal call
site name.
All methods are pure functional transforms: they accept a source string and
return the modified string with no file I/O. Both methods delegate directly
to the generic MainDartEditor.injectBeforeAnchor / MainDartEditor.injectAfterAnchor
helpers so the magic-side wrapper carries zero duplicated logic.
Usage
// Insert plugin-install code before Magic.init().
final updated = MagicMainDartEditor.injectBeforeMagicInit(
source: source,
snippet: ' DuskPlugin.install();\n',
);
// Insert post-init adapter code after Magic.init().
final updated = MagicMainDartEditor.injectAfterMagicInit(
source: source,
snippet: ' MagicDuskIntegration.install();\n',
);
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
-
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
Static Methods
-
injectAfterMagicInit(
{required String source, required String snippet}) → String -
Insert
snippetimmediately after the closing);ofawait Magic.init(...)insource. -
injectBeforeMagicInit(
{required String source, required String snippet, String? indent}) → String -
Insert
snippetimmediately before the line containingMagic.initinsource.