diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 39e7eef..a1618e5 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -6,6 +6,10 @@ PODS: - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) + - ObjectBox (1.8.1) + - objectbox_flutter_libs (0.0.1): + - Flutter + - ObjectBox (= 1.8.1) - package_info_plus (0.4.5): - Flutter - path_provider_foundation (0.0.1): @@ -22,6 +26,7 @@ PODS: DEPENDENCIES: - Flutter (from `Flutter`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) + - objectbox_flutter_libs (from `.symlinks/plugins/objectbox_flutter_libs/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`) @@ -30,6 +35,7 @@ DEPENDENCIES: SPEC REPOS: trunk: - FMDB + - ObjectBox - Toast EXTERNAL SOURCES: @@ -37,6 +43,8 @@ EXTERNAL SOURCES: :path: Flutter fluttertoast: :path: ".symlinks/plugins/fluttertoast/ios" + objectbox_flutter_libs: + :path: ".symlinks/plugins/objectbox_flutter_libs/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" path_provider_foundation: @@ -50,6 +58,8 @@ SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a + ObjectBox: a7900d5335218cd437cbc080b7ccc38a5211f7b4 + objectbox_flutter_libs: 61d74196d924fbc773da5f5757d1e9fab7b3cc78 package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 diff --git a/lib/main.dart b/lib/main.dart index de96b52..acdb238 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -15,9 +15,18 @@ import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; -void main() { - // this function makes application always run in portrait mode +import 'objectbox.dart'; + +/// Provides access to the ObjectBox Store throughout the app. +late ObjectBox objectbox; + +Future main() async { + // This is required so ObjectBox can get the application directory + // to store the database in. WidgetsFlutterBinding.ensureInitialized(); + + objectbox = await ObjectBox.create(); + SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]) .then((_) { runApp(MyApp()); @@ -83,6 +92,7 @@ class MyApp extends StatelessWidget { localizationsDelegates: [ AppLocalizationsDelegate(), GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, GlobalWidgetsLocalizations.delegate ], // Returns a locale which will be used by the app diff --git a/lib/model.dart b/lib/model.dart new file mode 100644 index 0000000..dbd3061 --- /dev/null +++ b/lib/model.dart @@ -0,0 +1,22 @@ +import 'package:intl/intl.dart'; +import 'package:objectbox/objectbox.dart'; + +import 'objectbox.g.dart'; + +// ignore_for_file: public_member_api_docs + +@Entity() +class Note { + int id; + + String text; + String? comment; + + /// Note: Stored in milliseconds without time zone info. + DateTime date; + + Note(this.text, {this.id = 0, this.comment, DateTime? date}) + : date = date ?? DateTime.now(); + + String get dateFormat => DateFormat('dd.MM.yyyy hh:mm:ss').format(date); +} diff --git a/lib/objectbox-model.json b/lib/objectbox-model.json new file mode 100644 index 0000000..5188865 --- /dev/null +++ b/lib/objectbox-model.json @@ -0,0 +1,47 @@ +{ + "_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.", + "_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.", + "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.", + "entities": [ + { + "id": "1:2802681814019499133", + "lastPropertyId": "4:6451339597165131221", + "name": "Note", + "properties": [ + { + "id": "1:3178873177797362769", + "name": "id", + "type": 6, + "flags": 1 + }, + { + "id": "2:4285343053028527696", + "name": "text", + "type": 9 + }, + { + "id": "3:2606273611209948020", + "name": "comment", + "type": 9 + }, + { + "id": "4:6451339597165131221", + "name": "date", + "type": 10 + } + ], + "relations": [] + } + ], + "lastEntityId": "1:2802681814019499133", + "lastIndexId": "0:0", + "lastRelationId": "0:0", + "lastSequenceId": "0:0", + "modelVersion": 5, + "modelVersionParserMinimum": 5, + "retiredEntityUids": [], + "retiredIndexUids": [], + "retiredPropertyUids": [], + "retiredRelationUids": [], + "version": 1 +} \ No newline at end of file diff --git a/lib/objectbox.dart b/lib/objectbox.dart new file mode 100644 index 0000000..1d139cb --- /dev/null +++ b/lib/objectbox.dart @@ -0,0 +1,72 @@ +import 'model.dart'; +import 'objectbox.g.dart'; // created by `flutter pub run build_runner build` + +/// Provides access to the ObjectBox Store throughout the app. +/// +/// Create this in the apps main function. +class ObjectBox { + /// The Store of this app. + late final Store store; + + /// A Box of notes. + late final Box noteBox; + + ObjectBox._create(this.store) { + noteBox = Box(store); + + // Add some demo data if the box is empty. + if (noteBox.isEmpty()) { + _putDemoData(); + } + } + + /// Create an instance of ObjectBox to use throughout the app. + static Future create() async { + // Future openStore() {...} is defined in the generated objectbox.g.dart + final store = await openStore(); + return ObjectBox._create(store); + } + + void _putDemoData() { + final demoNotes = [ + Note('Quickly add a note by writing text and pressing Enter'), + Note('Delete notes by tapping on one'), + Note('Write a demo app for ObjectBox') + ]; + store.runInTransactionAsync(TxMode.write, _putNotesInTx, demoNotes); + } + + Stream> getNotes() { + // Query for all notes, sorted by their date. + // https://docs.objectbox.io/queries + final builder = noteBox.query().order(Note_.date, flags: Order.descending); + // Build and watch the query, + // set triggerImmediately to emit the query immediately on listen. + return builder + .watch(triggerImmediately: true) + // Map it to a list of notes to be used by a StreamBuilder. + .map((query) => query.find()); + } + + static void _putNotesInTx(Store store, List notes) => + store.box().putMany(notes); + + /// Add a note within a transaction. + /// + /// To avoid frame drops, run ObjectBox operations that take longer than a + /// few milliseconds, e.g. putting many objects, in an isolate with its + /// own Store instance. + /// For this example only a single object is put which would also be fine if + /// done here directly. + Future addNote(String text) => + store.runInTransactionAsync(TxMode.write, _addNoteInTx, text); + + /// Note: due to [dart-lang/sdk#36983](https://github.com/dart-lang/sdk/issues/36983) + /// not using a closure as it may capture more objects than expected. + /// These might not be send-able to an isolate. See Store.runAsync for details. + static void _addNoteInTx(Store store, String text) { + // Perform ObjectBox operations that take longer than a few milliseconds + // here. To keep it simple, this example just puts a single object. + store.box().put(Note(text)); + } +} diff --git a/lib/objectbox.g.dart b/lib/objectbox.g.dart new file mode 100644 index 0000000..aca6092 --- /dev/null +++ b/lib/objectbox.g.dart @@ -0,0 +1,139 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// This code was generated by ObjectBox. To update it run the generator again: +// With a Flutter package, run `flutter pub run build_runner build`. +// With a Dart package, run `dart run build_runner build`. +// See also https://docs.objectbox.io/getting-started#generate-objectbox-code + +// ignore_for_file: camel_case_types +// coverage:ignore-file + +import 'dart:typed_data'; + +import 'package:flat_buffers/flat_buffers.dart' as fb; +import 'package:objectbox/internal.dart'; // generated code can access "internal" functionality +import 'package:objectbox/objectbox.dart'; +import 'package:objectbox_flutter_libs/objectbox_flutter_libs.dart'; + +import 'model.dart'; + +export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file + +final _entities = [ + ModelEntity( + id: const IdUid(1, 2802681814019499133), + name: 'Note', + lastPropertyId: const IdUid(4, 6451339597165131221), + flags: 0, + properties: [ + ModelProperty( + id: const IdUid(1, 3178873177797362769), + name: 'id', + type: 6, + flags: 1), + ModelProperty( + id: const IdUid(2, 4285343053028527696), + name: 'text', + type: 9, + flags: 0), + ModelProperty( + id: const IdUid(3, 2606273611209948020), + name: 'comment', + type: 9, + flags: 0), + ModelProperty( + id: const IdUid(4, 6451339597165131221), + name: 'date', + type: 10, + flags: 0) + ], + relations: [], + backlinks: []) +]; + +/// Open an ObjectBox store with the model declared in this file. +Future openStore( + {String? directory, + int? maxDBSizeInKB, + int? fileMode, + int? maxReaders, + bool queriesCaseSensitiveDefault = true, + String? macosApplicationGroup}) async => + Store(getObjectBoxModel(), + directory: directory ?? (await defaultStoreDirectory()).path, + maxDBSizeInKB: maxDBSizeInKB, + fileMode: fileMode, + maxReaders: maxReaders, + queriesCaseSensitiveDefault: queriesCaseSensitiveDefault, + macosApplicationGroup: macosApplicationGroup); + +/// ObjectBox model definition, pass it to [Store] - Store(getObjectBoxModel()) +ModelDefinition getObjectBoxModel() { + final model = ModelInfo( + entities: _entities, + lastEntityId: const IdUid(1, 2802681814019499133), + lastIndexId: const IdUid(0, 0), + lastRelationId: const IdUid(0, 0), + lastSequenceId: const IdUid(0, 0), + retiredEntityUids: const [], + retiredIndexUids: const [], + retiredPropertyUids: const [], + retiredRelationUids: const [], + modelVersion: 5, + modelVersionParserMinimum: 5, + version: 1); + + final bindings = { + Note: EntityDefinition( + model: _entities[0], + toOneRelations: (Note object) => [], + toManyRelations: (Note object) => {}, + getId: (Note object) => object.id, + setId: (Note object, int id) { + object.id = id; + }, + objectToFB: (Note object, fb.Builder fbb) { + final textOffset = fbb.writeString(object.text); + final commentOffset = + object.comment == null ? null : fbb.writeString(object.comment!); + fbb.startTable(5); + fbb.addInt64(0, object.id); + fbb.addOffset(1, textOffset); + fbb.addOffset(2, commentOffset); + fbb.addInt64(3, object.date.millisecondsSinceEpoch); + fbb.finish(fbb.endTable()); + return object.id; + }, + objectFromFB: (Store store, ByteData fbData) { + final buffer = fb.BufferContext(fbData); + final rootOffset = buffer.derefObject(0); + + final object = Note( + const fb.StringReader(asciiOptimization: true) + .vTableGet(buffer, rootOffset, 6, ''), + id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0), + comment: const fb.StringReader(asciiOptimization: true) + .vTableGetNullable(buffer, rootOffset, 8), + date: DateTime.fromMillisecondsSinceEpoch( + const fb.Int64Reader().vTableGet(buffer, rootOffset, 10, 0))); + + return object; + }) + }; + + return ModelDefinition(model, bindings); +} + +/// [Note] entity fields to define ObjectBox queries. +class Note_ { + /// see [Note.id] + static final id = QueryIntegerProperty(_entities[0].properties[0]); + + /// see [Note.text] + static final text = QueryStringProperty(_entities[0].properties[1]); + + /// see [Note.comment] + static final comment = QueryStringProperty(_entities[0].properties[2]); + + /// see [Note.date] + static final date = QueryIntegerProperty(_entities[0].properties[3]); +} diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index e71a16d..c58ebc9 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) objectbox_flutter_libs_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "ObjectboxFlutterLibsPlugin"); + objectbox_flutter_libs_plugin_register_with_registrar(objectbox_flutter_libs_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 2e1de87..94262e7 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + objectbox_flutter_libs ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 63c4df1..8bffdec 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,12 +5,14 @@ import FlutterMacOS import Foundation +import objectbox_flutter_libs import package_info_plus import path_provider_foundation import shared_preferences_foundation import sqflite func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + ObjectboxFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "ObjectboxFlutterLibsPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) diff --git a/pubspec.lock b/pubspec.lock index 3657ea4..7e2d371 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,30 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: e440ac42679dfc04bbbefb58ed225c994bc7e07fccc8a68ec7d3631a127e5da9 + url: "https://pub.dev" + source: hosted + version: "54.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "2c2e3721ee9fb36de92faa060f3480c81b23e904352b087e5c64224b1a044427" + url: "https://pub.dev" + source: hosted + version: "5.6.0" + args: + dependency: transitive + description: + name: args + sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440" + url: "https://pub.dev" + source: hosted + version: "2.4.0" async: dependency: transitive description: @@ -25,6 +49,70 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: db49b8609ef8c81cca2b310618c3017c00f03a92af44c04d310b907b2d692d95 + url: "https://pub.dev" + source: hosted + version: "2.2.0" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727 + url: "https://pub.dev" + source: hosted + version: "2.3.3" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" + url: "https://pub.dev" + source: hosted + version: "7.2.7" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "169565c8ad06adb760c3645bf71f00bff161b00002cace266cad42c5d22a7725" + url: "https://pub.dev" + source: hosted + version: "8.4.3" cached_network_image: dependency: "direct main" description: @@ -65,6 +153,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311" + url: "https://pub.dev" + source: hosted + version: "2.0.2" clock: dependency: transitive description: @@ -73,6 +169,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" + url: "https://pub.dev" + source: hosted + version: "4.4.0" collection: dependency: transitive description: @@ -81,6 +185,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" crypto: dependency: transitive description: @@ -89,6 +201,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + cryptography: + dependency: transitive + description: + name: cryptography + sha256: ffd770340e5a48f57e473c42d9036a773c43b396e80b41a2dd164ffaf53f57a4 + url: "https://pub.dev" + source: hosted + version: "2.1.1" csslib: dependency: transitive description: @@ -105,6 +225,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "7a03456c3490394c8e7665890333e91ae8a49be43542b616e414449ac358acd4" + url: "https://pub.dev" + source: hosted + version: "2.2.4" fake_async: dependency: transitive description: @@ -129,6 +257,22 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.4" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flat_buffers: + dependency: transitive + description: + name: flat_buffers + sha256: "23e2ced0d8e8ecdffbd9f267f49a668c74438393b9acaeac1c724123e3764263" + url: "https://pub.dev" + source: hosted + version: "2.0.5" flutter: dependency: "direct main" description: flutter @@ -189,6 +333,30 @@ packages: url: "https://pub.dev" source: hosted version: "8.1.3" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + graphs: + dependency: transitive + description: + name: graphs + sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 + url: "https://pub.dev" + source: hosted + version: "2.2.0" html: dependency: transitive description: @@ -205,6 +373,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.13.5" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" http_parser: dependency: transitive description: @@ -221,6 +397,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.17.0" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" js: dependency: transitive description: @@ -229,6 +413,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.5" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317 + url: "https://pub.dev" + source: hosted + version: "4.8.0" + logging: + dependency: transitive + description: + name: logging + sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" + url: "https://pub.dev" + source: hosted + version: "1.1.1" matcher: dependency: transitive description: @@ -253,6 +453,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.0" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" nested: dependency: transitive description: @@ -269,6 +477,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" + objectbox: + dependency: "direct main" + description: + name: objectbox + sha256: c18d41f4e81e5a30fc0e2200e9e8306f5ccc8a9b61fe3746426359690c33dc7b + url: "https://pub.dev" + source: hosted + version: "1.7.2" + objectbox_flutter_libs: + dependency: "direct main" + description: + name: objectbox_flutter_libs + sha256: "179a2edfca5eb80abee6e829ebff69872ad20c9f07c2527fe9d098f4bf5a5b83" + url: "https://pub.dev" + source: hosted + version: "1.7.2" + objectbox_generator: + dependency: "direct dev" + description: + name: objectbox_generator + sha256: "728a9ccf4d6a2ac44a016f6cb9798e4a31ee92b79828526181e0de97a3506c28" + url: "https://pub.dev" + source: hosted + version: "1.7.2" octo_image: dependency: transitive description: @@ -277,6 +509,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" package_info_plus: dependency: "direct main" description: @@ -373,6 +613,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" process: dependency: transitive description: @@ -389,6 +637,22 @@ packages: url: "https://pub.dev" source: hosted version: "6.0.5" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "75f6614d6dde2dc68948dffbaa4fe5dae32cd700eb9fb763fe11dfb45a3c4d0a" + url: "https://pub.dev" + source: hosted + version: "1.2.1" rxdart: dependency: transitive description: @@ -453,11 +717,35 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + shelf: + dependency: transitive + description: + name: shelf + sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c + url: "https://pub.dev" + source: hosted + version: "1.4.0" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 + url: "https://pub.dev" + source: hosted + version: "1.0.3" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: c2bea18c95cfa0276a366270afaa2850b09b4a76db95d546f3d003dcc7011298 + url: "https://pub.dev" + source: hosted + version: "1.2.7" source_span: dependency: transitive description: @@ -498,6 +786,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" string_scanner: dependency: transitive description: @@ -530,6 +826,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.16" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" typed_data: dependency: transitive description: @@ -562,6 +866,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + watcher: + dependency: transitive + description: + name: watcher + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b + url: "https://pub.dev" + source: hosted + version: "2.3.0" win32: dependency: transitive description: @@ -578,6 +898,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + url: "https://pub.dev" + source: hosted + version: "3.1.1" sdks: dart: ">=2.19.0 <4.0.0" flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index dc14eec..08b4796 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,6 +30,8 @@ environment: dependencies: flutter: sdk: flutter + objectbox: ^1.7.2 + objectbox_flutter_libs: any flutter_localizations: sdk: flutter @@ -53,7 +55,9 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - + build_runner: ^2.0.0 + objectbox_generator: any + # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is # activated in the `analysis_options.yaml` file located at the root of your diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..a84779d 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + ObjectboxFlutterLibsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ObjectboxFlutterLibsPlugin")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..9f0138e 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + objectbox_flutter_libs ) list(APPEND FLUTTER_FFI_PLUGIN_LIST