injectAfterMagicInit static method
Insert snippet immediately after the closing ); of
await Magic.init(...) in source.
Delegates to MainDartEditor.injectAfterAnchor with anchor: 'Magic.init'.
The underlying helper uses a paren-depth counter so multi-line
Magic.init(...) calls with nested configFactories lists are handled
correctly.
Idempotent: returns source unchanged when snippet (trimmed) is already
present anywhere in source, or when no Magic.init call can be found.
@param source The full source text to transform.
@param snippet The text block to insert, including trailing newline(s).
@return The transformed source, or source unchanged.
Implementation
static String injectAfterMagicInit({
required String source,
required String snippet,
}) {
return MainDartEditor.injectAfterAnchor(
source: source,
anchor: 'Magic.init',
snippet: snippet,
);
}