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!

mobilinked commented 5 years ago

+1

We have switched from Xamarin to Swift, and now we are preparing to switch to Flutter.

nklhtv commented 5 years ago

+1

Diaglyonok commented 5 years ago

+1

hundeva commented 5 years ago

To have some actually useful update, FFI is actively worked on. Once that finishes, Realm could start to work on a Dart/Flutter package. You can find more here.

cianiandreadev commented 5 years ago

+1

dcharkes commented 5 years ago

Hi, I'm working on dart:ffi (dart-lang/sdk#34452). Dart/Flutter bindings for Realm would wrap a C API through dart:ffi. However, it seems that Realm does not have a C API yet (realm/realm-core/issues/1954)?

Any thoughts about this? I would love to have a C API to look at so that it might inform our development of dart:ffi.

bmunkholm commented 5 years ago

@dcharkes That's true we don't have an official C++ API as the realm-core is used to build APIs for all our SDK's and not be used (yet) as a public API. In practice however, The realm-java, realm-cocoa, realm-js, realm-dotnet all use the "internal" C++ API (as a C API) to interface to those languages. In order to make dart support, we would do the same as we have done for those other languages. I don't know much about Dart yet to say which of the SDK's would be the better one to look at.

Bridging to Java through JNI is a huge pain (in-the-somewhere) so hopefully it can be made much simpler than that. But the objective-C API is of course much nicer to interface to :-)

Memory management is the major issue to deal with besides introspection of objects. We really need a callback when objects are garbage collected. We also need the ability to introspect an object and it's properties and to proxy setting/getting properties of an object as our main job is to look abstract the database and pretend you are just dealing with normal objects.

dcharkes commented 5 years ago

@bmunkholm I browsed a bit through realm-java, but I'm not familiar with how to bind Java to C++. Can you point me to the code that does some of the binding, and the C++ functions/types it binds to?

bmunkholm commented 5 years ago

@dcharkes Ahh, feel lucky ;-) It's basically any C++ code in the repo. That's what binds to Java. For the introspection part Java is really complicated - something I hope is much simpler than manipulating byte-code...

This is a good place to start: https://github.com/realm/realm-java/tree/master/realm/realm-library/src/main/cpp Oh, and something I forgot: realm-object-store (pure c++) is a common layer on top of realm-core that actually handles a lot of API between the realm-core and the SDKs.

dcharkes commented 5 years ago

Ideally, you wouldn't need to write any extra C++ code as glue. But as you mentioned the mismatch between the API language and the Realm model needs to be addressed somewhere, either in Dart or in C++. @bmunkholm I would love to have a chat about this with you if you'd like, how do I reach you?

bmunkholm commented 5 years ago

@dcharkes You can email me at bm at realm.io

listepo commented 5 years ago

Experimental Realm binding

allessandrojs commented 5 years ago

maybe help this plugin. https://pub.dev/packages/flutter_realm https://github.com/mogol/flutter_realm

leen-nobbas commented 5 years ago

@realm-support https://medium.com/dartlang/announcing-dart-2-5-super-charged-development-328822024970 dart:ffi now in preview.

iapicca commented 5 years ago

Dart 2.5 introduced dart:ffi that allows to run C code in Dart. Is Realm team planning to release a an official package for Flutter?

ChaseGuru commented 5 years ago

@bunkholm I'm happy to see we've got over 500 upvotes here! The next highest on an issue looks to be 33. Hopefully that shows you there's interest.

@dcharkes It's awesome to see flutter's team looking into this so directly.

Did you guys have any updates? Does this newest dart release meet all the needs of realm? Was someone on one of the teams planning on writing the adaptation of realm to dart or was the hope that it would be a community project?

You guys are awesome! My whole company loves realm, and flutter (we're a 30 man dev shop). For us the biggest flaw in both is that they're currently mutually exclusive as flutter is awesome for writing mobile apps but has poor database options and realm is awesome but it seems like for flutter it's advantages wouldn't pass through platform channels super well and it would take a lot of boiler plate.

mclark4386 commented 5 years ago

@ChaseGuru I would love to know all the answers to those questions as well! We have the same love for both. As a side note, has anyone on your team looked at Moor? It's documentation is getting there and it's a bit young, but it seems to have promise.

rodydavis commented 5 years ago

I love moor 🚀😎 https://github.com/AppleEducate/moor_shared

Here is an example of it running across iOS android web and desktop!

xiprox commented 5 years ago

There is also Floor, which seems to be less known than Moor (especially since Moor was featured in The Boring Flutter Dev Show), but is just as interesting, if not more.

drewdipalma commented 5 years ago

Hi Folks – 

We are very excited to see that FFI support has been added by the Flutter team by now! Although we have done a Hackathon project experimenting with support, the Realm team is focused on a new major version of Realm Database that we're hoping to release by the end of the year. We know there have been a few questions lately around planning for Realm, so we'll also be releasing a public roadmap soon that will outline what we're currently working on and ideas that we have as we increase work on Realm (including Flutter support). Stay tuned!

-Drew (PM for Realm)

mit-mit commented 5 years ago

Hi @drewdipalma, sounds great. Let us know if there is anything we can do to support in the Dart & Flutter teams!

-- Michael (PM for the Dart platform)

doc-rj-celltrak commented 4 years ago

Hi @drewdipalma, any idea when the roadmap is going to be published? We're starting a large Flutter project and we'd love to plan for Realm if possible.

drewdipalma commented 4 years ago

We're hoping to have the roadmap published around mid-October. While I don't have a specific target date for official Realm Flutter support that I can provide, I can definitively say that work is not planned to start until after the next major release of Realm (targeting end of this year).

doc-rj-celltrak commented 4 years ago

Ok, thanks @drewdipalma we look forward to your updates!

de1mat commented 4 years ago

Looks like the Roadmap is live now: https://www.mongodb.com/realm#roadmap

Flutter is listed in the "Later - Beyond August 2020" section 😢

ghost commented 4 years ago

I wonder why "meaning you never pay for unused capacity" is still a selling point in 2019 when the markup is always way higher for such service anyway

To stay on subject, it's also written "potentially Flutter" which is even worse

de1mat commented 4 years ago

Vote for Flutter Support on the MongoDB Tracker here: https://feedback.mongodb.com/forums/923521-realm/suggestions/38839369-flutter-support

doc-rj commented 4 years ago

So it's likely at least a year out. Looks like we'll need another database solution. Was really hoping for the offline first approach of Realm. Anyone try AWS AppSync with a Flutter app?

patreu22 commented 4 years ago

A little bit disappointing imho. As a workaround we used the native Realm versions and built platform bridges. It works for some use cases but is for sure a very limited approach.

timahrentlov commented 4 years ago

There's a chance that Xamarin will have flutter widget support before that :o)

hundeva commented 4 years ago

As much as I would have liked to see this happening, unfortunately for Realm, but fortunately for devs, more and more, better and better alternatives are popping up, one after another, thus making Realm for Flutter, at best in late 2020, way behind the curve. I jumped to those other solutions, and I guess a lot of other people did and will do in the near future as well. I'd still be happy to have Realm as an alternative, but it would no longer be as appealing as it was a year ago.

de1mat commented 4 years ago

@hundeva what alternatives? I am very interested to hear what other options are available for Flutter that offer offline first, managed sync?

hundeva commented 4 years ago

Managed sync is something that I'm not really after, so not sure if there is a good alternative for that, but I heard there is Flutter support for Couchbase? If I'm correct they have that feature, maybe that's worth a shot.

p30arena commented 4 years ago

@hundeva https://blog.couchbase.com/fluttercouch-flutter-and-couchbase/

doc-rj-celltrak commented 4 years ago

@de1mat I think AWS AppSync and Couchbase are the best alternatives for offline first, managed sync. Either may be used with Flutter, but I'm hoping to use AppSync. Realm would have been awesome, but it's too far out on the roadmap.

https://github.com/ineat/flutter-aws-appsync-sample https://pub.dev/packages/couchbase_lite https://pub.dev/packages/fluttercouch

Darshak3623 commented 4 years ago

Realm + Flutter = ❤️

How can I use Realm in Flutter?

ggirotto commented 4 years ago

Realm + Flutter = ❤️

How can I use Realm in Flutter?

You cant. Realm doesn't support Flutter yet

insinfo commented 4 years ago

Any news on Flutter support?

leecommamichael commented 4 years ago

Any news on Flutter support?

@drewdipalma posted a roadmap, Flutter is not nearly their top priority. It's unfortunate, our teams at work are opting for React Native and Realm is not an insignificant factor in that direction.

de1mat commented 4 years ago

It's unfortunate, our teams at work are opting for React Native and Realm is not an insignificant factor in that direction.

I can totally relate to that. Keep coming back to the drawing board for the same reason, not really happy with any of the alternatives compared to realm.

ChaseGuru commented 4 years ago

Exact quote from their roadmap: "Later - Beyond August 2020"

In the second half of 2020, we expect to make the architecture and performance improvements that will allow us to bring MongoDB Realm from beta to GA.

At this point, we’ll begin work on key features like:

Bringing the functionality of Query Based Sync into MongoDB Realm by rewriting the feature to make it fully optimized for the new architecture. Making it possible to run MongoDB Realm anywhere, by adding support for additional regions and cloud providers as well as the ability to self-host MongoDB Realm. Merge Realm Studio’s functionality into MongoDB’s tooling. We’ll also move to a consumption-based billing model that aligns usage and payment, making it simple to get started for free and meaning you never pay for unused capacity.

Realm Database

We expect to continue working on Realm Database, tackling more advanced functionality to further simplify your code. While the roadmap isn’t set, we plan to explore features like:

Support for inheritance and new types like sets and maps in the RealmSchema, making it even easier to work with your data. Support for new Analytics and Transformational Queries so you can efficiently write code for complex use cases. Tagging Realm Object/Classes for Cascading Deletes, saving you time by reducing the amount of code you need to write. Realm Database Support for additional platforms and languages, potentially including Future Android Platforms (Kotlin/Flutter), IoT, Java Server, and Browser (advanced web apps).

So there might be development starting in a year. The take away is.. don't hold your breath.

bmunkholm commented 4 years ago

While we consider if/how/when to staff this effort, I'm curious to know if it would be possible to engage the Flutter community to actually contribute somehow to this project?

I'm not (necessarily) talking about doing the main development, but there are a lot of areas where it's possible to contribute if interested. That could be anything like minor features, API and code review/feedback, tests, demo applications, tutorials, docs, blog posts, talks, triaging or/and answering community questions, issue troubleshooting etc. etc.

And should anyone sit there with a wish to make this their fulltime/funtime job, but wondering how to feed the cat while doing this, I should mention we are hiring - mainly in Europe for this role.

ChaseGuru commented 4 years ago

Maybe devs of https://github.com/nhachicha/realm-dart-ffi/ or https://github.com/mogol/flutter_realm/ as they've demonstrating willingness put at least some time into support?

I'd consider it as well, though I wouldn't have much time outside of my normal job.

Perhaps if you guys did create some sort of starting point, and listed that it's looking for help, perhaps it would be easier for people to get involved?

cjarman commented 4 years ago

Not a priority.

Sent from my iPhone

On 17 Nov 2019, at 8:21 am, insinfo notifications@github.com wrote:

 Any news on Flutter support?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

mogol commented 4 years ago

I am supporting https://github.com/mogol/flutter_realm/

I add only features that I need. However if there is a feature request I might take it depending on free time as the package is side project to support pet project. And for sure, contributions from the community are welcome.

Support via FFI is definitely great, but it requires much bigger effort and platform channels cover most cases. IMO Given lack of documentation for the core library and connections with core team doing FFI outside the team will be painful. However the topic and the project are very interesting to me and if anyone wants to cooperate let me know

listepo commented 4 years ago

@drewdipalma any news?

osianSmith commented 4 years ago

Still on "beyond August 2020" timeline :(

drewdipalma commented 4 years ago

To provide a bit of an update, we've been trying to work with the Dart team to figure out if we can bring the timeline in on a Realm SDK for Flutter. Here's where we are:

jamesdixon commented 4 years ago

@drewdipalma thanks for helping to push this forward and keeping us updated!

dcharkes commented 4 years ago

A Flutter SDK for Realm is blocked behind 37022

Asynchronous callbacks can be done through the native ports mechanism. See the samples in samples/ffi/async. (In the future we would like to add a more concise syntax that requires less boilerplate code, that's why the issue is still open.)

and 35770

This is in review https://dart-review.googlesource.com/c/sdk/+/133984.