-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
# uuid.c example | ||
|
||
Custom SQLite extension (uuid.c) loaded in sqlite3. | ||
This example shows how to load SQLite extensions into Flutter apps using `sqlite3_flutter_libs`. | ||
As an example, it uses the [uuid.c](https://github.com/sqlite/sqlite/blob/master/ext/misc/uuid.c) | ||
extension, but other extensions can be adapted similarly. | ||
|
||
To build the extension: | ||
|
||
1. A `CMakeLists.txt` (in `src/`) is written for Android, Linux and Windows. | ||
2. On Android, the NDK is set up to point at the CMake builds in `android/build.gradle`. | ||
3. For macOS and iOS (which don't use CMake as a build tool), the `uuid.c` file is added | ||
to `macos|ios/Classes` instead. | ||
4. Note that this example does not currently support WebAssembly. Loadable extensions don't | ||
work on the web, but you can compile a custom `sqlite3.wasm` bundle with the desired extensions | ||
included. The `../custom_wasm_build` example has an example for that setup. | ||
|
||
This build setup includes a shared library with the extension in your app. To use it, load the | ||
`DynamicLibrary` and then load it into sqlite3 like this: | ||
|
||
```dart | ||
sqlite3.ensureExtensionLoaded( | ||
SqliteExtension.inLibrary(uuid.lib, 'sqlite3_uuid_init'), | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ dependencies: | |
|
||
uuid: | ||
path: ../ | ||
|
||
cupertino_icons: ^1.0.6 | ||
sqlite3: ^2.4.6 | ||
sqlite3_flutter_libs: ^0.5.24 | ||
|