what I am trying to do:
I want that my flutter app comes with a predefined data set which is stored in isar. I am already able to modify my isar db via app inputs. But I want that the app itself already contains a filled isar file.
My problem: How can I add a isar db file to my app itself. Which I then can access on app start.
I could not find anything related to this in the Isar doc. The only idea I had is to open an Isar instance inside my project folder, but giving a path of my project folder to the directory attribut:
final isar = await Isar.open(
[SchemaName],
directory: "lib/db/isar_files", //its a empty folder
);
Just gives me an error:
Unhandled Exception: IsarError: Cannot open Environment: No such file or directory. Please make sure that the provided path is valid.
So I guess that is not the right way to do it?
Any help is appreciated :)
Seems like the keyword I was looking for is a "prepopulated" db. This is an already existing Question
Now I need to find out how to write and embed a isar db file into my app :)