Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
344 views
in Technique[技术] by (71.8m points)

Is it a good practice to use models in GetX Flutter to parse JSON data?

Hello there I am creating an application in Flutter and I am receiving JSON response from the API and I know that we need to parse the response to use in the Flutter app but I found that if we use the normal way as: jsonData['key'] to get and show the data because this way you can handle any kind of response easily but when I am using the models way then I am facing a lot of issues in which the data structure and data types included.

and I think the model only provides an object structure in which you can access data as an object way like jsonData.key instead of the jsonData['key'] this is only my thinking you can correct me if I am wrong here.

I just want to know that if I am using a non-model way then will it affect my app or not?

question from:https://stackoverflow.com/questions/65857053/is-it-a-good-practice-to-use-models-in-getx-flutter-to-parse-json-data

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Use an Object is a good practice because helps to take advantage of the strong typed language. This allows you to have a better debug process, catch potential error during writing time (and in compilation time). And this is independent of the state management package that you choose.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...