강의

멘토링

커뮤니티

Inflearn Community Q&A

suwlee2693's profile image
suwlee2693

asked

[Code Factory] [Intermediate] Flutter Real Practice! State Management, Cache Management, Code Generation, GoRouter, Authentication Logic, etc. Essential Skills to Become an Intermediate!

Caching RestaurantDetail

RestaurantDetail 캐싱

Written on

·

331

1

Restaurant 와 RestaurantDetail 가 서로 연결될 수 있게 설계를 했기 때문에, detail 캐싱이 가능한걸까요?

현업에서 강의와 다르게 설계가 되어 있다면 별도의 상태를 하나 더 만들어야 할까요?

==== 억지 가정 ====
현업에서
Restaurant 의 이미지는 thumbUrl 로, RestaurantDetail 의 이미지는 detailThumbUrl 로 설계가 되어 있다는 가정

flutter하이브리드-앱

Answer 1

0

codefactory님의 프로필 이미지
codefactory
Instructor

안녕하세요!

만약 말씀하신 형태라면 thumbUrl 프로퍼티를 JsonKey annotation을 사용해서 override 할 수 있습니다.

예를들어서 원하는 프로퍼티에 @JsonKey(name: 'detailThumbUrl') annotation을 추가 해주시면 thumbUrl 프로퍼티로 키 값이 매핑되지 않고 detailThumbUrl 키로 매핑되도록 할 수 있습니다.

하지만 그런 설계라면 우려하신대로 애초에 서버에서 잘못된 설계라고 말 할 수 있습니다.

감사합니다!

suwlee2693's profile image
suwlee2693

asked

Ask a question