objectbox / objectbox-dart

Flutter database for super-fast Dart object persistence
https://docs.objectbox.io/getting-started
Apache License 2.0
927 stars 115 forks source link

Web Support #110

Closed enzotar closed 3 years ago

enzotar commented 3 years ago

Is Flutter Web supported?

greenrobot commented 3 years ago

Not at this time.

There will be a way e.g. providing the native part via WebAssembly or a online API via sync, but this is not decided yet.

Any input is welcome. E.g. what's your use case and how important is the web component for you? Would you be OK with a online-only solution or do you need a offline DB for the web? etc.

enzotar commented 3 years ago

Use case is for an offline-first Flutter app that can also be accessed from the browser.

Currently using HiveDB but an offline DB with more features would help.

vaind commented 3 years ago

superseded by #185

NaikSoftware commented 2 years ago

How to disable ObjectBox for web build? Would be great if ObjectBox allow building for web without errors, but throwing errors only in runtime. It's would allow me to use different databases for web and native. I think it can be achievable througth conditional imports in library.

greenrobot-team commented 2 years ago

@NaikSoftware Maybe using conditional imports can be helpful? https://dart.dev/guides/libraries/create-library-packages#conditionally-importing-and-exporting-library-files

NaikSoftware commented 2 years ago

@greenrobot yes, I did it with conditional imports - created two files with global function that returns different storage implementations for web and other platforms. But would be much simpler if ObjectBox not crashed on compile time for web. In that case would be enough this code if (!kIsWeb) objBoxUsage() else smth else

Stratj-YannDupuis commented 2 years ago

we have a big project for ObjectBox and support web will be a big must for us !

papmodern commented 1 year ago

@NaikSoftware Can you please share your workaround? I've tried the same way but it brings a lot of conflictions with generated file

NaikSoftware commented 1 year ago

@NaikSoftware Can you please share your workaround? I've tried the same way but it brings a lot of conflictions with generated file

create file with function such as DbImpl getDb() => ObjectBoxDbImpl(); and separate file with same function, but returning WebDbImpl(); After that use conditional import import db_impl.dart if (dart.library.html) db_impl_web.dart;

Paroca72 commented 7 months ago

First thing first, thanks for your work because is an open source project and I have just to thanks you. But is this project still active?

I seen some rarely updates but nothing important like, for example, inheritance that still not implemented for flutter and I think this is the base for all DB libraries. Also for the web, its seems you no have plan about this feature.. but many other DB libraries have already implement this feature. Unfortunately my project is becoming too big and I cannot easily change the DB engine.

So what I'm asking is if you have some big changes planned for this library in the near future.

Thanks for the patient.

greenrobot-team commented 7 months ago

@Paroca72 This issue is closed. To discuss a web API see #185. Also see other issues or raise a feature request.

We release and talk about new features once they are ready. And yes, ObjectBox for Dart is still an active project. See https://pub.dev/packages/objectbox/changelog for the latest changes.