How to stop class database file getting created multiple times when using moor?

342 Views Asked by At

I'm getting this error:

flutter: WARNING (moor): It looks like you've created the database class AppDatabase multiple times. When these two databases use the same QueryExecutor, race conditions will occur and might corrupt the database.

class AppDatabase extends _$AppDatabase {
  AppDatabase() :  super(_openConnection());
  int get schemaVersion => 1;
  

}

But I want to have multiple instance of Db class. Is there any way to create multiple instance of Db class?

Thanks

0

There are 0 best solutions below