getTableInfo static method

Future<List<Map<String, dynamic>>?> getTableInfo(
  1. String filePath,
  2. String tableName
)

Implementation

static Future<List<Map<String, dynamic>>?> getTableInfo(
    String filePath, String tableName) async {
  Database db = await getDatabase(filePath);
  final List<Map<String, dynamic>> tableInfo =
      await db.rawQuery("PRAGMA table_info($tableName);");

  // If the table does not exist, the result will be an empty list.
  // You can check if the list is empty and handle it accordingly.
  if (tableInfo.isEmpty) {
    return null; // Or you can return an empty list or handle the absence of the table in another way.
  }

  return tableInfo;
}