How to pre-populated database from assets using floor with flutter?

Viewed 139

I created a database that contains a table that already has data and I initialized floorDatabase in my flutter app, and I found the table but without data, it was empty. I have been trying to solve this for 2 days but I don't know what is the problem, in android it works, any help!

Here is my code: here to initialize and get the data

Future<List<CinemaTable>> getAllCinema() async{
    final database = await $FloorMovieDatabase.databaseBuilder('Databases/NotifyDB.db').build();
    var list = await database.movieDao.getAllCinema();
    return list;
  }

Database Class:

@Database(version: 1, entities: [CinemaTable, FavouriteTable])
abstract class MovieDatabase extends FloorDatabase {
  MovieDao get movieDao;
}

Here is a screenshot of the table with the data in SQLLite browser Here is a screenshot of the table with the data in SQLite browser

Here is the table in android studio Here is the table in android studio

.......

0 Answers
Related