File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
sqlite3/example/custom_extension Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 11# uuid.c example
22
3- Custom SQLite extension (uuid.c) loaded in sqlite3.
3+ This example shows how to load SQLite extensions into Flutter apps using ` sqlite3_flutter_libs ` .
4+ As an example, it uses the [ uuid.c] ( https://github.com/sqlite/sqlite/blob/master/ext/misc/uuid.c )
5+ extension, but other extensions can be adapted similarly.
6+
7+ To build the extension:
8+
9+ 1 . A ` CMakeLists.txt ` (in ` src/ ` ) is written for Android, Linux and Windows.
10+ 2 . On Android, the NDK is set up to point at the CMake builds in ` android/build.gradle ` .
11+ 3 . For macOS and iOS (which don't use CMake as a build tool), the ` uuid.c ` file is added
12+ to ` macos|ios/Classes ` instead.
13+ 4 . Note that this example does not currently support WebAssembly. Loadable extensions don't
14+ work on the web, but you can compile a custom ` sqlite3.wasm ` bundle with the desired extensions
15+ included. The ` ../custom_wasm_build ` example has an example for that setup.
16+
17+ This build setup includes a shared library with the extension in your app. To use it, load the
18+ ` DynamicLibrary ` and then load it into sqlite3 like this:
19+
20+ ``` dart
21+ sqlite3.ensureExtensionLoaded(
22+ SqliteExtension.inLibrary(uuid.lib, 'sqlite3_uuid_init'),
23+ );
24+ ```
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ dependencies:
1313
1414 uuid :
1515 path : ../
16-
16+
1717 cupertino_icons : ^1.0.6
1818 sqlite3 : ^2.4.6
1919 sqlite3_flutter_libs : ^0.5.24
You can’t perform that action at this time.
0 commit comments