mogol / flutter_realm

Realm via Platform Channels
https://pub.dev/packages/flutter_realm
MIT License
115 stars 18 forks source link

Data saved is not persistent on the disk #11

Closed uc-apa closed 4 years ago

uc-apa commented 4 years ago

I have build and run the example project in this repository. Data is being stored successfully, but it is not persistent. When I go back the page and then come again, the saved data is missing. Please help me what am I missing. Demo Video

uc-apa commented 4 years ago

Also if you can specify, where is the default.realm file is put then it will be help to browse that with realm browser. It used to be in the app's document directory in react native but I did not find any realm file in document directory of flutter app in simulator. image

gonharry commented 4 years ago

On the RealmProvider set a Configuration with a persistant name or ID.

@override void initState() { super.initState(); final configuration = Configuration(inMemoryIdentifier: "your_persistan_ID"); realm = Realm.open(configuration); }

uc-apa commented 4 years ago

This solution worked. Thank you very much. But I would really like to know exactly where the realm file is saved so that I would be able to visualize the database with the realm browser. Whether it store a default.realm file same as RN or some different approach is followed.

vavadiyahiren commented 4 years ago

On the RealmProvider set a Configuration with a persistant name or ID.

@override void initState() { super.initState(); final configuration = Configuration(inMemoryIdentifier: "your_persistan_ID"); realm = Realm.open(configuration); }

I did this but even after adding the persistence id it seems it is storing in memory so after killing the application data is no longer available. Am I missing some configuration here?