No implementation found for method getDatabasesPath on channel com.tekartik.sqflite

Viewed 2819

I have a flutter app, works well on mobile, am trying to have the same app on web. am using moor to sync and store data locally incase there is no internet and when internet is back it syncs with the server. Now when I try to run the same app on the web, moor is complaining

Error: MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)

the plugin says it supports web, from here. Am not finding much information on how to resolve this, how can I configure moor to run on the web without that error?

2 Answers

The plugin moor you are using is built on top of sqlite, which itself is not supported on web, and at bottom of moor plugin page also it's mentioned that web support is experimental now.

Sqlite plugin doesn't has support for web yet, but it does support android, ios and Macos. I would suggest anyone facing this problem to use other databases or cloud based databases instead of sqlite if you are using flutter web. Hope the plugin gets supported on web also.

Update: You can try this example to use sqlite on web, it might work.

Got the same error when first run the web app. If you follow clean architecture you can easily provide the right "database" instance.

This is what I did:

  1. Create a local data store interface
  2. Check if web using kIsWeb
  3. If kIsWeb it true I return an in memory cache otherwise I just return the mobile app database that you already implemented for you Android and iOS apps
Related