Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I initialize the database once? Singleton pattern #836

Open
a13020796019 opened this issue Jul 15, 2024 · 0 comments
Open

How can I initialize the database once? Singleton pattern #836

a13020796019 opened this issue Jul 15, 2024 · 0 comments

Comments

@a13020796019
Copy link

@database(
version: 1,
entities: [StaffInfoModel, MeetingInfoModel, MeetingFileInfoModel])
abstract class SqliteDatabase extends FloorDatabase {
StaffInfoDao get staffInfoDao;
MeetingInfoDao get meetingInfoDao;
MeetingFileInfoDao get meetingFileInfoDao;
}

final database = await $FloorSqliteDatabase .databaseBuilder('app_database.db')
.build();

      final meetingInfoDao = database.meetingInfoDao;
      ///先删除
      await meetingInfoDao.deleteMeetingInfoByConferId(
          applicationController.uuid, conferController.conferId!);
      final MeetingInfoModel meetingInfo = MeetingInfoModel(
          conferId: conferController.conferId!,
          uuid: '',
          name: homeDetailEntity.meeting!.title!,
          startTime: homeDetailEntity.meeting!.startTime!,
          endTime: '',
          room: homeDetailEntity.meeting!.room!);

      meetingInfoDao.insertMeetingInfo(meetingInfo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant