loadFromYaml static method

AnalysisOptions loadFromYaml(
  1. String yamlSource
)

Implementation

static AnalysisOptions loadFromYaml(String yamlSource) {
  final yaml =
      json.decode(json.encode(loadYaml(yamlSource))) as Map<String, dynamic>;
  final options = yaml['pt_linter'] as Map<String, dynamic>?;
  final excludeGlobs = options?['exclude_globs'] as List<dynamic>?;
  if (options == null || excludeGlobs == null) {
    return AnalysisOptions(excludeGlobs: []);
  }
  return AnalysisOptions(
    excludeGlobs: excludeGlobs.cast<String>().map((e) => Glob(e)).toList(),
  );
}