Moor: Accessing DB from native app.

Created on 21 Oct 2019  路  6Comments  路  Source: simolus3/moor

I have an app written natively that uses Flutter for some features and stores information using Moor. Now I want to access the "Moor" database from my native code (probably using Room library from Android), is it posible?

question

All 6 comments

It should work in theory, but you might run into synchronization problems if you open the database from Moor & Room simultaneously.

If you open the database via FlutterQueryExecutor.inDatabasePath, the location of the database file will be in Context.getDatabasePath() on Android. If you model the same table structure in Room, the interop should work. I've never tried it though.

I wonder if it would affect the synchronization. The idea is to make a
native homescreen widget for android, and I don't know if the connection
would work. I'll try to set it up and see how it goes. Thanks for the quick
response!

Hey @CodingAleCR, I want to try something similar. Did you succeed in accessing the same database from both Flutter and native with Room?

Hi, I've had to put my side project on hold due to some personal issues, but I'm hoping to retake it soon. In case you were wondering, my idea was to use Moor to do the modeling and then copy that into the Room Database model. It's theoretically possible but haven't got around to making it a thing.

@nevi-me @CodingAleCR am about to give this a try.

How did you guys go with your projects?

Have kept it on hold since it took a different direction. Still think that it's theoretically possible though. I'm curious to see how it goes for you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ltei picture Ltei  路  3Comments

Beloin picture Beloin  路  4Comments

omidraha picture omidraha  路  3Comments

novas1r1 picture novas1r1  路  4Comments

VadimOsovsky picture VadimOsovsky  路  3Comments