resolveIncludes function Null safety

Future<Document?> resolveIncludes(
  1. Document? document,
  2. Directory currentDirectory,
  3. void onError(
    1. JaelError error
    )?
)

Expands all include[src] tags within the template, and fills in the content of referenced files.

Implementation

Future<Document?> resolveIncludes(Document? document,
    Directory currentDirectory, void Function(JaelError error)? onError) async {
  if (document == null) {
    return null;
  }
  var rootElement =
      await _expandIncludes(document.root, currentDirectory, onError);
  if (rootElement != null) {
    return Document(document.doctype, rootElement);
  } else {
    return null;
  }
}