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) {
    String newFile;
    if (json.containsKey('newFile')) {
      newFile =
          clientUriConverter?.fromClientFilePath(
            jsonDecoder.decodeString('$jsonPath.newFile', json['newFile']),
          ) ??
          jsonDecoder.decodeString('$jsonPath.newFile', json['newFile']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'newFile');
    }
    return MoveFileOptions(newFile);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'moveFile options', json);
  }
}