Reputation: 143
I need to store the multi dimensional array into sqflite db and fetch the same. I can insert single dimensional array to sqflite and fetch. But i am struggling to do for multi dimensional array. Please help me to resolve this.
[{ "Date": "2020-02-17", "Data": [{ "Id": 1 }, { "Id": 2 }, { "Id": 3 }] }, { "Date": "2020-02-18", "Data": [{ "Id": 4 }, { "Id": 5 }, { "Id": 6 }] }]
Upvotes: 1
Views: 2000
Reputation: 516
You can encode your array as JSON and save as string into a database, then after fetching, decode JSON to a regular map.
All you need to do is this
import 'dart:convert';
final myArrayJson = jsonEncode(myArray);
final myArrayRegular = jsonDecode(myArrayJson);
Upvotes: 1