LibraryPathSet.fromJson constructor

LibraryPathSet.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json
)

Implementation

factory LibraryPathSet.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String scope;
    if (json.containsKey('scope')) {
      scope = jsonDecoder.decodeString('$jsonPath.scope', json['scope']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'scope');
    }
    List<String> libraryPaths;
    if (json.containsKey('libraryPaths')) {
      libraryPaths = jsonDecoder.decodeList('$jsonPath.libraryPaths',
          json['libraryPaths'], jsonDecoder.decodeString);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'libraryPaths');
    }
    return LibraryPathSet(scope, libraryPaths);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'LibraryPathSet', json);
  }
}