Skip to content

Commit

Permalink
[sqflite] doc
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Jun 18, 2024
1 parent 04d639b commit 2de3e1f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages_web/sqflite_common_ffi_web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ var db = openDatabase(path);
```
## Limitations

### Use the same web port when debugging

The database is stored in the browser indexeddb. Like any other web storage, it is tied to the port. (i.e. localhost:8080 is different from localhost:8081).
When debugging, you should use the same port to keep the same indexeddb database.

### No shared worker available

When shared worker are not supported - for example in Android Chrome as of 2022-10-20 -, a basic web worker is used.
Expand Down
19 changes: 19 additions & 0 deletions sqflite/doc/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,25 @@ You could get a more recent version using [`sqflite_common_ffi`](https://pub.dev
You could then add [`sqlite3_flutter_libs`](https://pub.dev/packages/sqlite3_flutter_libs) for ios/android or include your own
sqlite shared library for desktop or mobile (one for each platform).
### Open error
Such error is often reported with something similar to:
```text
SqfliteFfiException(sqlite_error: 14, , open_failed: SqliteException(14): while opening the database, bad parameter or other API misuse, bad parameter or other API misuse (code 21)})
```
Please check and ensure that:
- The database path is correct (please provide it in the bug report, best is to print it out to report it exactly as it is used)
- The parent folder exists (you should create it if it does not exist)
- The parent folder is writable (try to create a file in it if you still get the error).
Solutions:
- Use the `path_provider` package to find the best location for you database (`getDatabasesPath()` is only relevant for Android)
- Build the database path properly (using `join` from the `path` package)
- Create the parent folder if it does not exist
## Error in Flutter web
Look at package [sqflite_common_ffi_web](https://pub.dev/packages/sqflite_common_ffi_web) for experimental Web support.
Expand Down

0 comments on commit 2de3e1f

Please sign in to comment.