refresh method

void refresh()

Implementation

void refresh() {
  String src = results['src'] as String;

  src = absolute(src);
  src = normalize(src);

  final File configFile = File(join(src, 'fgen.yaml'));

  String? output = results['output'];
  String? className = results['name'];
  bool? watch = results['watch'];
  bool? preview = results['preview'];

  YamlMap? yamlMap;
  if (configFile.existsSync()) {
    final String configFileText = configFile.readAsStringSync();
    filter = Filter(configFileText);
    yamlMap = loadYaml(configFileText) as YamlMap?;

    if (yamlMap != null) {
      output ??= yamlMap['output'] as String?;
      className ??= yamlMap['name'] as String?;
      watch ??= yamlMap['watch'] as bool?;
      preview ??= yamlMap['preview'] as bool?;
    }
  }

  output ??= defaultPath;
  className ??= 'R';
  watch ??= true;
  preview ??= true;

  this.src = src;
  this.output = output;
  this.className = className;
  isWatch = watch;
  this.preview = preview;
  configFileOptions = yamlMap;
}