Can't create multiple tables for one data base on Sqflite

Hi, first of all, im from Venezuela so the variables in my program are on spanish, sorry for that, i have this problem that i want to do a data base on Sqflite where i need multiple tables, but i don’t understand how to make the tables for a same data base, i’ve searched many tutorials and all that i found it’s how to make one data base with one table, i know that’s because Sqlite don’t let you make more than one instance at the same time.

For what i’ve tried so far, im developing an app register for sponsors, employes, reports and other things that manage a organization, i need one table for each process (not only those, theres plenty more tables) that will be registered on the app, but the syntax that im using won’t let me make more tables than one, or at least i don’t know how, here’s my dart project.

this is the code] im handling to make the data base:

class ClientDatabaseProvider{

static final ClientDatabaseProvider db = ClientDatabaseProvider._();
Database _database;

Future get database async {
if(_database != null) return _database;
_database = await getDatabaseInstanace();
return _database;

Future getDatabaseInstanace() async {
Directory directory = await getApplicationDocumentsDirectory();
String path = join(directory.path, “Patrocinante.db”);
return await openDatabase(path, version: 1,
onCreate: (Database db, int version) async {
await db.execute(“CREATE TABLE Patrocinante (”
“id integer primary key,”
“name TEXT,”
“phone TEXT,”
“tipoindustria TEXT,”
“nit TEXT,”
“aliado TEXT,”
“direccion TEXT,”
“pais TEXT,”
“estado TEXT,”
“ciudad TEXT,”
“codigopostal TEXT,”
“email TEXT,”
“paginaweb TEXT,”
“bolsaempleo TEXT,”
“referido TEXT,”
“masinfo TEXT,”
“exterior TEXT,”
“phone2 TEXT”

And i want to create another table like this:

db.execute(“CREATE TABLE Usuario (”
“id integer primary key,”
“username TEXT,”
“password TEXT,”
“nivel TEXT,”

And also have the posibility to add another tables, or it is viable to just put all attributes of all tables into one big table of the data base? because i don’t seem much of a solution, another way could be to link my already created data base on SqLite but in that case, how can i make the code so it ressemble this app af it is, connecting with the already created data base?

I needed to create more than just multiple tables; but multiple database. I have since developed a dart package; sqlite_at_runtime that stretches to as far as creating all these entities at run time.

Below is an example code that creates three tables with similar attributes.

await Sqlartime.tableCreate(['sample1','sample2','sample3'],['name TEXT','age INTEGER','temp REAL']);
1 Like