init method
Initializes the database.
This method sets up the database connection and creates the specified tables if they do not already exist.
databaseFile
: The path to the database file.tables
: A list of tables to initialize in the database.
Returns the initialized Database
instance.
Implementation
Future<sql.Database> init(String databaseFile,
[List<BaseTable> tables = const []]) async {
if (_database != null) {
return _database!;
}
// If _database is null, initialize it
_database = await open(databaseFile, tables);
return _database!;
}