realm-dart
realm-dart copied to clipboard
Implement filtering like in C#
Description
Hello,
The C# framework allows filtering using the property name directly. In dart, the filter is carried out in character string.
var cars = realm.all<Car>().query('make == "Tesla"');
var cars = realm.All<Dog>().Where(car => car.Make == "Tesla");
The C# way is much more interesting, it allows autocompletion, avoid bugs.
Is it planned to implement the same way as in C# ?
Thanks you very much. Mohamed
How important is this improvement for you?
Would be a major improvement
Hi, We have plans of doing something similar to .NET thanks for the feedback.
Thank you @blagoev
Do you have more details on the roadmap.
We would like to migrate to flutter (from Xamarin) for a project on a large company in France.
We would like to use Realm for our local database but we have two blocking points:
- Realm flutter is still in beta (when the first release is planned)
- and the method of filtering
Thanks
I can't share specific timelines but I can assure you the team is working hard to get there. Will be glad to hear more about what features are you missing from the beta. We call it a beta mostly cause we are still missing some features compared to the rest of the Realm SDKs.
Hi, We have just released a Release Candidate version. Hope that you could try and that it will work for the French project you wanted to start on.
cheers
Thank you for this wonderful work
Hi,
Any update for this feature ?
Thanks
@bmunkholm Hello, do you have an estimated date? This feature is for me a necessity to use realm in my company.
Can you clarify why this is a necessity? I mean, it's definitely nicer to use expressions rather than strings, but I wouldn't view this as a dealbreaker - as far as I can tell, there's no database library for dart that offers LINQ-like syntax for querying.
Thank you for your reply. Here are the reasons why I think this is a "major" feature.
-
Productivity: Autocompletion will automatically offer the user the properties of a class.
-
Maintenance: In case of variable name change or to know where a variable is used
-
Bug: avoid syntax errors, forget a letter or reverse
In addition, some competitors already offer this feature: SQL ORM (Based on sqlite): https://pub.dev/packages/sqfentity https://pub.dev/packages/drift
NO SQL ORM: https://pub.dev/packages/hive https://pub.dev/packages/objectbox
Thanks
Oh, I think I understand - it's a bit of technicality, but it threw me off initially - those packages are not using expressions for the queries, but rather the builder pattern. That should be significantly easier to implement if we decided to go that route, so I guess something to consider.
Dart not allowing to return the name of a property (nameof in C#). I think it will be difficult to do everything in expression. But first of all to be able to have the list of properties (ex: nameKey for name) in the generated class will be a good start.
I think the first method with expressions like in c# needs an update side dart
Any movement on this?
Not in the short term, no. Since this is more of a nice-to-have than net new functionality, it's lower priority than features we're missing, such as geospatial support or ability to call mongodb API directly.
I think this is an essential feature @nirinchev . As part of our project we choose another database because of the lack of this feature.
That's fair enough. At the end of the day, each database will have strong and weak sides and everyone should choose the one that fits their use case best. Strongly typed query API is something we do want to do eventually, but we haven't seen enough commercial interest to justify the investment at this point. If someone from the community would like to pick that up, we'd be happy to assist.