parts_resolver library

Resolve a multi-file Dart library (one main file + part files) into a single source string suitable for DartEncoder.encode.

extension X on Class blocks where Class is declared in the main file are merged into that class body so the encoded output dispatches the extension methods as regular class members. Other top-level declarations from part files are appended after the main source.

Uses the analyzer AST (offsets only — no regex on Dart source).

Functions

resolveDartLibrary(String mainPath) String
Resolve the library rooted at mainPath (with part directives) into a single concatenated source string with extension methods merged into their target class bodies.
resolveDartLibraryFromSource(String mainSource, {required String partLoader(String mainPath)}) String
Like resolveDartLibrary but takes an in-memory mainSource plus a partLoader that resolves each part 'X.dart'; URI to source code.