MoveFileOptions.fromJson constructor

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

Implementation

factory MoveFileOptions.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(jsonPath, "'moveFile options'", json);
  }
  String newFile;
  if (json case {'newFile': var encodedNewFile}) {
    newFile =
        clientUriConverter?.fromClientFilePath(
          jsonDecoder.decodeString('$jsonPath.newFile', encodedNewFile),
        ) ??
        jsonDecoder.decodeString('$jsonPath.newFile', encodedNewFile);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'newFile'", json);
  }
  return MoveFileOptions(newFile);
}