Shriya

You can alter your already created table.
Add a new column in table.

Future<dynamic> alterTable(String TableName, String ColumneName) async {
var dbClient = await db;
var count = await dbClient.execute("ALTER TABLE $TableName ADD "
"COLUMN
$ColumneName TEXT;");
print(await dbClient.query(TABLE_CUSTOMER));
return count;
}

Call the function as:

alterTable(TABLE_CUSTOMER, Country);

--

--

How to get key of the list and save into the database.

If your data have simple key value structure.

var data = {
"key1": "value1",
"key2": "value2",
"key3": "value3",
};

var myMap = Map<String, dynamic>.from(data);
print(myMap);
print("Key:" + myMap.keys.toList().toString());

Response from api and convert into map:

var map1 = Map.fromIterable(responseJson['result'] as List);
print(map1);
List<dynamic> keysList = map1.keys.toList();
var myMap = Map<String, dynamic>.from(keysList[0]);
print("Keys: " + myMap.keys.toList().toString());

--

--