Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
android/ | 12-May-2024 | - | 988 | 827 | ||
example/ | 12-May-2024 | - | 2,148 | 1,845 | ||
ios/ | 12-May-2024 | - | 627 | 562 | ||
lib/ | 12-May-2024 | - | 461 | 375 | ||
.gitignore | D | 12-May-2024 | 134 | 13 | 11 | |
.metadata | D | 12-May-2024 | 308 | 11 | 8 | |
CHANGELOG.md | D | 12-May-2024 | 131 | 6 | 3 | |
CMakeLists.txt | D | 12-May-2024 | 3.8 KiB | 62 | 50 | |
LICENSE | D | 12-May-2024 | 1.1 KiB | 22 | 17 | |
README.md | D | 12-May-2024 | 2 KiB | 102 | 72 | |
analysis_options.yaml | D | 12-May-2024 | 4.9 KiB | 158 | 128 | |
pubspec.yaml | D | 12-May-2024 | 548 | 31 | 24 | |
pubspec.yaml.in | D | 12-May-2024 | 563 | 31 | 24 | |
version.txt | D | 12-May-2024 | 1 |
README.md
1# EJDB2 Flutter integration 2 3Embeddable JSON Database engine http://ejdb.org Dart binding. 4 5See https://github.com/Softmotions/ejdb/blob/master/README.md 6 7For API usage examples take a look into [/example](https://github.com/Softmotions/ejdb/tree/master/src/bindings/ejdb2_flutter/example) 8application. 9 10## Example 11 12pubspec.yaml 13 14```yaml 15dependencies: 16 ejdb2_flutter: 17``` 18 19```dart 20import 'package:ejdb2_flutter/ejdb2_flutter.dart'; 21 22var db = await EJDB2Builder('test.db').open(); 23 24var id = await db.put('parrots', {'name': 'Bianca', 'age': 4}); 25 print('Bianca record: ${id}'); 26 27id = await db.put('parrots', {'name': 'Darko', 'age': 8}); 28print('Darko record: ${id}'); 29 30final q = db.createQuery('/[age > :age]', 'parrots'); 31await for (final doc in q.setInt('age', 3).execute()) { 32 print('Found ${doc}'); 33} 34 35await db.close(); 36``` 37 38## Supported platforms 39 40- iOS 41- Android 42 43## iOS notes 44 45In order to build app with this binding you have 46to add the following code into application `Podfile`: 47 48```ruby 49pre_install do |installer| 50 # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289 51 Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} 52end 53``` 54 55## Android notes 56 57For release builds you have to setup proguard rules as follows: 58 59`build.gradle` 60``` 61 buildTypes { 62 ... 63 release { 64 ... 65 minifyEnabled true 66 useProguard true 67 proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 68 } 69 } 70``` 71 72`proguard-rules.pro` 73``` 74... 75 76# Keep EJDB 77-keep class com.softmotions.ejdb2.** { *; } 78 79``` 80 81## How build it manually 82 83```sh 84git clone https://github.com/Softmotions/ejdb.git 85 86cd ./ejdb 87mkdir ./build && cd build 88 89cmake .. -DCMAKE_BUILD_TYPE=Release \ 90 -DANDROID_NDK_HOME=<path to Android NDK> \ 91 -DBUILD_FLUTTER_BINDING=ON 92make 93 94# Move generate to ejdb2 flutter pub package with example app 95cd src/bindings/ejdb2_flutter/pub_publish 96flutter pub get 97cd ./example 98 99# Start Android emulator 100flutter run 101``` 102