fromJson static method

LspServerConfig? fromJson(
  1. String name,
  2. Object? json
)

Parses one servers entry from JSON. Returns null when required fields are missing or invalid (omp's normalizeServerConfig).

Implementation

static LspServerConfig? fromJson(String name, Object? json) {
  if (json is! Map<String, dynamic>) return null;
  final command = json['command'];
  final fileTypes = _stringList(json['fileTypes']);
  final rootMarkers = _stringList(json['rootMarkers']);
  if (command is! String || command.isEmpty) return null;
  if (fileTypes == null || rootMarkers == null) return null;
  return _fromValidJson(name, command, fileTypes, rootMarkers, json);
}