LiveNodeProfile constructor

LiveNodeProfile({
  1. String? path,
  2. void onWarning(
    1. String message
    )?,
})

Follows the profile at path (default: NodeProfile.defaultPath).

Reads it now and throws, as NodeProfile.load does, when it is invalid (FormatException) or exists but cannot be read (permissions, invalid UTF-8: FileSystemException): a node should not start on a broken profile, nor quietly without one.

Implementation

LiveNodeProfile({String? path, this.onWarning})
  : path = path ?? NodeProfile.defaultPath() {
  final file = File(this.path);
  final text = file.existsSync() ? file.readAsStringSync() : null;
  _raw = text == null ? const {} : NodeProfile._parse(text, this.path);
  _text = text;
}