getColumnNames method

Future<List<String>> getColumnNames({
  1. String? table,
})

Get column names

var eloquent = UserEloquent();
// get column names of 'users' table;
eloquent.getColumnNames();

// You can specify table name.
eloquent.getColumnNames('cars'); // get column names of 'cars' table;

Implementation

Future<List<String>> getColumnNames({String? table}) async {
  Database _db = await getDatabase;
  var data = await _db.rawQuery(
      "PRAGMA table_info(" + (table ?? tableName) + ")", null);
  return data.map((e) => e['name'].toString()).toList();
}