onDemand method

*<Null safety>*

void onDemand (String name, OnDemandRootFn rootNodeCallback)

Implementation

static void onDemand(String name, OnDemandRootFn rootNodeCallback) {
  var context = StartupContext.fromStartupInfo();
  var directory = context.outgoing.diagnosticsDir();
  var fileName = _nextInstanceWithName(name);
  var pseudoVmoNode = PseudoVmoFile.readOnly(() {
    var writer = VmoWriter.withSize(vmoSize);
    rootNodeCallback(RootNode(writer));
    return writer.vmo;
  });

  directory.addNode(fileName, pseudoVmoNode);
}