• Home
Name Date Size #Lines LOC

..--

android/12-May-2024-988827

example/12-May-2024-2,1481,845

ios/12-May-2024-627562

lib/12-May-2024-461375

.gitignoreD12-May-2024134 1311

.metadataD12-May-2024308 118

CHANGELOG.mdD12-May-2024131 63

CMakeLists.txtD12-May-20243.8 KiB6250

LICENSED12-May-20241.1 KiB2217

README.mdD12-May-20242 KiB10272

analysis_options.yamlD12-May-20244.9 KiB158128

pubspec.yamlD12-May-2024548 3124

pubspec.yaml.inD12-May-2024563 3124

version.txtD12-May-20241

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