DBCollectionFree constructor
DBCollectionFree({
- required String name,
- required Db db,
- required DBFormFree form,
Constructor to initialize the name
of the collection and the db
instance.
When initialized, the constructor checks if the collection exists in the database, and creates it if it does not already exist.
Implementation
DBCollectionFree({required this.name, required this.db, required this.form}) {
db.getCollectionNames().then((coll) async {
if (!coll.contains(name)) {
await db.createCollection(name);
}
});
}