Flutter의 Moor~MyDatabase multipletimes.WARNING이 나타날 때의 대응 방법
flutter: WARNING (moor): It looks like you've created the database class MyDatabase multiple times. When these two databases use the same QueryExecutor, race conditions will occur and might corrupt the database.
Try to follow the advice at https://moor.simonbinder.eu/faq/#using-the-database or, if you know what you're doing, set moorRuntimeOptions.dontWarnAboutMultipleDatabases = true
데이터베이스 클래스가 단식으로 생성되지 않을 때 나타나는 WARNING.하면, 만약, 만약...
대응 방법은 상술한 기록에 기재되어 있는데, 어디에 쓰입니까?따라서 해결 로그로 저장합니다.
Moor의OpenConnection 메서드에 기재되어 있습니다.
내 예야.
LazyDatabase _openConnection() {
// the LazyDatabase util lets us find the right location for the file async.
return LazyDatabase(() async {
// put the database file, called db.sqlite here, into the documents folder
// for your app.
final dbFolder = await getApplicationDocumentsDirectory();
final file = File(p.join(dbFolder.path, 'db.sqlite'));
moorRuntimeOptions.dontWarnAboutMultipleDatabases = true;
return VmDatabase(file);
});
}
Reference
이 문제에 관하여(Flutter의 Moor~MyDatabase multipletimes.WARNING이 나타날 때의 대응 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/kiiimii/articles/2e8319be2c6b52텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)