realm / realm-object-server

Tracking of issues related to the Realm Object Server and other general issues not related to the specific SDK's
https://realm.io
293 stars 42 forks source link

Dart / Flutter Support #55

Closed johnpryan closed 3 years ago

johnpryan commented 7 years ago

Flutter is a new way to build cross-platform mobile apps using Dart.

It would be great to see a native implementation of Realm for Dart and Flutter. Flutter has access to the dart:io package, which should provide everything necessary to write a native library for Realm.

How much effort / public demand take to get an official client?

Thanks!

Sartori-RIA commented 4 years ago

+1 Still waiting for Realm for Flutter

listepo commented 4 years ago

I think the community would help in the development there is not enough official start of development

csga5000 commented 4 years ago

@listepo It looks like the realm team is wanting to accelerate the process

Additionally there has been some community work done but it's not in a mature state, and I'd love to see an official implementation (and am eager to hear when it might be possible to start): https://github.com/nhachicha/realm-dart-ffi/ https://github.com/mogol/flutter_realm/

ishaileshmishra commented 4 years ago

Any timeline when realm support will be available for flutter ?

josepaulodelacruz commented 4 years ago

Any alternatives for realm? preferably nosql databases.

adamansky commented 4 years ago

Any alternatives for realm? preferably nosql databases.

Take a look on https://ejdb.org

listepo commented 4 years ago

Any alternatives for realm? preferably nosql databases.

Take a look on Hive

goxiaoy commented 4 years ago

Any alternatives for realm? preferably nosql databases.

Take a look on https://www.couchbase.com/ https://github.com/SaltechSystems/couchbase_lite

thoughtspeed7 commented 4 years ago

Any updates on the timelines when Realm will be supported on Flutter?

ianpward commented 4 years ago

We are still hard-blocked by the Dart team awaiting a Finalizer implementation - https://github.com/dart-lang/sdk/issues/35770

We cannot move forward without this functionality

najibghadri commented 4 years ago

4 years for an SDK pretty sad :(

leecommamichael commented 4 years ago

4 years for an SDK pretty sad :(

Flutter wasn’t a viable enterprise target since the last year or so. In this case, the Realm team needs to balance current deliverables with this newfound demand for Flutter.

These are hard releases to make stable as is, but this is a feature both Mongo and Google are enabling for us. It is always more time consuming to coordinate two teams, and in this case one is blocking the other’s progress. That happens within one business all the time, imagine fixing that problem between two.

That being said I’m waiting impatiently as well.

najibghadri commented 4 years ago

Is it not possible to workaround gc finalizer callback somehow? By reading through their (dart) issues and their pace it seems like this feature is really not on top of their priority and probably won't be done neither until the end of this year. Suppose that is the case, until you start developing the SDK and finishing it is at least half to one more year so that is plus one and a half year from now on. On the other hand because of this you have a missing platform that has become - as you said - viable since a year and looking at your issues this is the most requested one by a huge margin.

ChaseGuru commented 4 years ago

@najibghadri Late last year dkcharkes said they are planning on having the feature in the next quarters. We're coming up on the end of that time frame, and you can see the team is active in the dart:ffi issue.

For now I think people should thumbs up the issue, and google will get to it at some point. But I think your timelines are inaccurate. According to his timeline it should be coming very soon - though as software deadlines go it may take a bit longer - but saying it could take .5-1 years is just making numbers up not based on anything they said as you suggested.

de1mat commented 4 years ago

Yes we need more thumbs up on the following issue: https://github.com/dart-lang/sdk/issues/35770

mraleph commented 4 years ago

Yes we need more thumbs up on the following issue: dart-lang/sdk#35770

The feature is actively being worked on. We understand pretty well the importance of it. However this feature requires very careful design which we want to get just right - that is why it is taking longer than other FFI features.

If people want to highlight their interest they should feel free to 👍 dart-lang/sdk#35770 - I would like however to discourage people from leaving "me too", "+1" and "realm database needs this" comments on the issue, as these comments don't really contribute anything to the discussion. Thank you for understanding.

leecommamichael commented 4 years ago

Yes we need more thumbs up on the following issue: dart-lang/sdk#35770

The feature is actively being worked on. We understand pretty well the importance of it. However this feature requires very careful design which we want to get just right - that is why it is taking longer than other FFI features.

If people want to highlight their interest they should feel free to 👍 dart-lang/sdk#35770 - I would like however to discourage people from leaving "me too", "+1" and "realm database needs this" comments on the issue, as these comments don't really contribute anything to the discussion. Thank you for understanding.

No, Thank you for continuing to do what's in developers' best interest with Dart. I don't think a language of that size has ever moved to strong types and AOT. Well done!

Sunbreak commented 4 years ago

https://github.com/dart-lang/sdk/issues/35770#issuecomment-650158676

dart:ffi supports GC finalizers now!

listepo commented 4 years ago

Any news? Also, we have ffigen and gluecodium

listepo commented 4 years ago

@drewdipalma can we see the new Roadmap?

ianpward commented 4 years ago

@listepo We are very interested In Flutter and are working with the Dart team right now on how best to design an integration with the VM - stay tuned

ghost commented 3 years ago

What about Flutter for web? Doesn't it compile to javascript instead of machine code? So should the dart version of realm also have to compile into the javascript version of realm?

csga5000 commented 3 years ago

@vjlomocso I could be wrong here, but I don't know how well realm would work in a browser. It manages it's own database in its own file(s), and in browser you can't just "make a file", there are few options for storing data in web, including indexdb, local storage and cookies. So I don't know if they can support web. In addition, their core is in C or C++, so adding dart support works because they can just integrate with that. But in web, even if webasm can compile those languages, it's going to be trying to access system apis that won't exist in webasm (like creating files).

You probably will have to use a framework that allows use of indexdb under the covers to support web. Like hive I think.

This isn't my area of expertise so could be wrong

ghost commented 3 years ago

@csga5000 But the reason why flutter might be more attractive than other frameworks is that they even plan to include web in their supported platforms. .NET MAUI for example is very cross-platform, but use blazor for web and xaml for everything else. Flutter just uses the exact same code even for web.

Does that mean that in order to use realm, you have to commit that you are never going to support a web version with it in the future?

ChaseGuru commented 3 years ago

@vjlomocso First of all, if it's "impossible" to use realm in web, then no cross platform or native web framework will support it, so flutter could still be the best platform for web even if supporting web isn't as nice as supporting mobile due to limitations or a lack of realm.

Second it may still be possible - if something that wraps index db could substitute realm for web, and have an similar or identical api (so that your same code works). index-db doesn't exactly have observers yet tho, so there's at least one or two items that wouldn't work currently without some sort of hacky workaround. That's separate than the support we're adding here in how it would be done, because this is supporting the full realm database which may not be possible in a sandboxed browser app. It may also be possible to write a version of realm that operates only in memory for web. So realm could function as expected, except none of your data would persist a hard page refresh or tab closure (and it wouldn't span tabs either unless you can share that memory across them somehow). This may be fine for many use cases (since your page needs internet to load anyway) - and would take fairly minimal changes to your app. (it could still get it's data from realm, it could just "start" empty until it loads, and some pages you may have to load the data again you didn't have to previously if it's freshly loaded).

And lastly, just because realm isn't supported for web doesn't mean you can't make your app work for web. Since you're working with web (asside from pwa's) your website won't work without internet, so you may not need caching in the same way, so you could add a work-around so that your code doesn't cache data on web, it just uses what's in memory. You could write your code properly abstracted such that you can swap something else out for web as well. (Ex. have a data layer, and then use behavior subjects to pass events back up to the UI).

To address "you have to commit that you are never going to support a web version with it in the future?" - I can see you potentially mean with realm not necessarily your entire app. I think it would be fair to say there may be limitations that force you to make adaptations for web which is an unfortunate (and fortunate) consequence of the fact that a web browser application is different from a mobile app and runs in a very differently sandboxed environment. Realm isn't just "UI", it currently runs low level code and manages it's own data on the disk.

mclark4386 commented 3 years ago

@vjlomocso might I suggest https://moor.simonbinder.eu/ we have moved to using that in almost all of our flutter work. We are also now looking into https://docs.hivedb.dev/#/ , but haven't used it in production yet, so can't vouch for it yet. Both of those support not only ios and android, but also web. Realm kinda dropped the ball here, so there are some great alternatives now!

ChaseGuru commented 3 years ago

Yeah I already mentioned Hive. Haven't seen moor. I think realm is a bit more involved than those projects, but I do think people are stepping in to try and fill the need.

de1mat commented 3 years ago

How do these alternatives help with syncing user data across devices. Or are you using something different for that?

leecommamichael commented 3 years ago

How do these alternatives help with syncing user data across devices. Or are you using something different for that?

Firebase is probably your only option with Flutter that has out-of-the-box syncing. Personally, I have a service with a database and use moor table-watchers to automatically make requests to push the data up.

doc-rj-celltrak commented 3 years ago

@de1mat FWIW, we're using AppSync through our own plugin, and we may eventually move to AWS' official Flutter solution, though no idea when DataStore will be done: https://github.com/aws-amplify/amplify-flutter

allanwolski commented 3 years ago

You can use Couchbase.

https://www.couchbase.com https://pub.dev/packages/couchbase_lite

jlavyan commented 3 years ago

There are also another library only for iOS where used latest mongodb prerelease

https://pub.dev/packages/flutterrealm_light

mdrideout commented 3 years ago

Not that this thread should turn into a discussion of alternatives, but I've been weighing my options as I patiently await Realm on Flutter.

It appears to me that many solutions for true offline-first performant realtime databases are waiting for some dart improvements for full implementation. Perhaps this is a reason Firestore uses the dumbed-down caching method for offline mode. I would suggest to stick with Firestore until Realm (or AWS's solution) is available, unless you actually need the additional offline-first feature set NOW that firestore doesn't provide. In that case, you either have to build your own sync solution, or use something like couchbase - which in my opinion has a steep learning curve and isn't as well suited to lower-cost simpler apps (compared to how simple Firestore is to implement, and how cheap it is to use on small stuff).

Firestore offline does work very well, but with limited offline querying abilities, and performance degrades if you start queuing up thousands of offline writes.

I've dabbled with Hive and Sembast that manually sync to the cloud - and it's a lot of extra development to build a sync solution that tests well in a wide variety of use cases.

I'm very much looking forward to Realm for some projects I have that require true offline-first implementation (better offline querying and performance for heavy offline data collection).

ianpward commented 3 years ago

Hey All, Product from Realm here, we have approved a Dart/Flutter SDK preview. Stay tuned.

timahrentlov commented 3 years ago

Woot!

sultanmyrza commented 3 years ago

@ianpward have initial repo for Real Dart/Flutter SDK?

hardiksachan commented 3 years ago

@ianpward when is it going to be released?

leecommamichael commented 3 years ago

Ian knew to let us know in the thread, he’ll know to announce it here later, let’s give ‘em a break. 😂

Pushplaybang commented 3 years ago

Can't wait!!

renefloor commented 3 years ago

Please, for following you don't need to comment and give everybody in this thread a notification. I prefer if everybody keeps this thread clean so people don't have to unfollow this thread when they are sick of notifications.

It is great news that the realm team is working on a Flutter implementation and let's all wait patiently.

If you want to follow this thread, just subscribe with the button: image

rolkon commented 3 years ago

Hello! Don't know if this is a bit off-topic, but I just found a rather recent (unofficial) mongodb realm plugin for flutter: https://pub.dev/packages/flutter_mongodb_realm

thomas4Bitcraft commented 3 years ago

Any updates?

adrianvintu commented 3 years ago

4 years and still no implementation? How many customers and $$$ have they lost already?!

ianpward commented 3 years ago

Soon. Soon. Keep an eye on our next newsletter

saeed-golshan commented 3 years ago

Hi @ianpward why you are not working officially Realm project but say about soon newsletter? Is your project third party library?

cedvdb commented 3 years ago

@saeed-golshan he said he was the product manager

saeed-golshan commented 3 years ago

Ok I found him on this issue answer. I think that will introduce in MongoDB.live conference July 13–14, 2021

listepo commented 3 years ago

It happened realm-dart

saeed-golshan commented 3 years ago

It's appeared but in preview mode with some config needed and just local realm but make us happy

SatyamKr07 commented 3 years ago

Just a question... Is this unofficial realm package https://pub.dev/packages/flutter_mongodb_realm worth it? And can't the official realm dart team take the help of this package in some way ?