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());

List of Users from api show in dialog and pass the selected item to your page.

Here is the code

First file is add_user_page.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class AddUserPage extends StatefulWidget {
@override
_AddUserPageState createState() => _AddUserPageState();
}

class ListItem {
int value;
String name;

ListItem(this.value, this.name);
}

class Users…

Shriya

Android & Flutter Programmer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store