Im trying to convert old code to new code syntax. I have a issue with RxList.
So I change postModel.assign(postDetail);
But In my news_detail page How I can access to value?
First of all you shouldn''t use postModel
as a List as your API clearly returns a single post (NewsModel) by id and not a list of post (List of NewsModel). So using var postModel = <NewsModel>[].obs;
is totally unnecessary in my opinion.
What you could do is:
final postModel = NewsModel().obs;
And then on API call:
postModel.value = postDetail;
And then on View:
Image.network(controller.postModel.value.imageUrl);