RenameOptions.fromJson constructor

RenameOptions.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json, {
  4. ClientUriConverter? clientUriConverter,
})

Implementation

factory RenameOptions.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(jsonPath, "'rename options'", json);
  }
  String newName;
  if (json case {'newName': var encodedNewName}) {
    newName = jsonDecoder.decodeString('$jsonPath.newName', encodedNewName);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'newName'", json);
  }
  return RenameOptions(newName);
}