FileChange.fromJson constructor

FileChange.fromJson(
  1. Map json
)

Implementation

factory FileChange.fromJson(Map json) {
  final type = switch (json['type']) {
    final String type => FileChangeType.values.byName(type),
    _ => throw Exception('Invalid file change type: ${json['type']}'),
  };

  return switch (type) {
    FileChangeType.analysisOptions => AnalysisOptionsChange.fromJson(json),
    FileChangeType.lintKitVersion => LintKitVersionChange.fromJson(json),
  };
}