I have tried the following and only received information on the entire database.
listTables() async {
    sqflite.Database dbClient = await this.db;
    List<Map<String, dynamic>> tables = await dbClient
        .query('sqlite_master');
    print(tables);
  }
I am looking to get a list of the table names which exist in the database.
As you see in the output, the schema is simple. sqlite_master table rows have type = 'table' and a name column.
Debug print:
(await db.query('sqlite_master', columns: ['type', 'name'])).forEach((row) {
  print(row.values);
});
to get something like:
(table, Product)
(table, Client)
(table, Request)
(index, Request_clientId)
(index, Request_productId)
You can get the table names with the following code:
var tableNames = (await db
        .query('sqlite_master', where: 'type = ?', whereArgs: ['table']))
    .map((row) => row['name'] as String)
    .toList(growable: false);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With