I'm a newbie in flutter and android application. I have developed a quiz app. It loading a Json data from Firebase and i want to save it to Sqlite(for query fast purpose). My problem is Json data quite complicated, it have multi data array nested(refer Json data as bellow)
Since Sqlite doesn't allow nesting tables within tables, I not sure how to organize or convert the data to Sqlite most reasonable. I am thinking of saving all my Json as a String, but I know it not a good idea. Any have a better idea, very appreciate it
{
"title": "TEST title",
"des": null,
"ver": 0,
"partOne": [
{
"number": 1,
"correctAns": 3,
"question": "question 1 here?",
"ansA": "answer A here",
"ansB": "answer B here",
"ansC": "answer C here",
"ansD": "answer D here"
},
// about 100 question
...
// about 100 part
...
]
}
you can try
Hive
orObjectbox
. Both of them are local DB that easy to use and also faster thanSQFLite
.If you want to learn more about
Hives
, you can learn hereIf you want to learn more about
Objectbox
, you can learn herethis is the database performance benchmark between
Hive
,Objectbox
, andSQFLite
(image source: link)I have try both
hive
andobjectbox
. Its recommended for you if you have a complex data and want to solve the storing problem.Goodluck, hope it helps!