From 34706531adb7b2b7aecc01419ae6d47b57e1404c Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 23 Jun 2024 12:29:07 +0800 Subject: [PATCH] :sparkles: Local message history db --- analysis_options.yaml | 4 +- lib/main.dart | 1 + lib/providers/message/helper.dart | 50 ++++ lib/providers/message/history.dart | 51 +++++ lib/providers/message/history.g.dart | 165 ++++++++++++++ pubspec.lock | 330 ++++++++++++++++++++++++++- pubspec.yaml | 68 +----- 7 files changed, 605 insertions(+), 64 deletions(-) create mode 100644 lib/providers/message/helper.dart create mode 100644 lib/providers/message/history.dart create mode 100644 lib/providers/message/history.g.dart diff --git a/analysis_options.yaml b/analysis_options.yaml index 0d29021..f82bda6 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -21,8 +21,8 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + avoid_print: true # Uncomment to disable the `avoid_print` rule + prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/lib/main.dart b/lib/main.dart index b8ed3d4..e018e0d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -33,6 +33,7 @@ void main() async { await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); + if (PlatformInfo.isDesktop) { await Window.initialize(); await Window.setEffect( diff --git a/lib/providers/message/helper.dart b/lib/providers/message/helper.dart new file mode 100644 index 0000000..b911425 --- /dev/null +++ b/lib/providers/message/helper.dart @@ -0,0 +1,50 @@ +import 'package:get/get.dart'; +import 'package:solian/models/channel.dart'; +import 'package:solian/models/message.dart'; +import 'package:solian/models/pagination.dart'; +import 'package:solian/providers/auth.dart'; +import 'package:solian/providers/message/history.dart'; + +Future createHistoryDb() async { + return await $FloorMessageHistoryDb + .databaseBuilder('messaging_data.dart') + .build(); +} + +extension MessageHistoryHelper on MessageHistoryDb { + receiveMessage(Message remote) async { + await localMessages.insert(LocalMessage( + remote.id, + remote, + remote.channelId, + )); + } + + syncMessages(Channel channel, {String? scope}) async { + final AuthProvider auth = Get.find(); + if (!await auth.isAuthorized) return; + + final client = auth.configureClient('messaging'); + + final resp = await client + .get('/api/channels/$scope/${channel.alias}/messages?take=10&offset=0'); + + if (resp.statusCode != 200) { + throw Exception(resp.bodyString); + } + + // TODO Continue sync until the last message / the message exists / sync limitation + + final PaginationResult result = PaginationResult.fromJson(resp.body); + final parsed = result.data?.map((e) => Message.fromJson(e)).toList(); + if (parsed != null) { + await localMessages.insertBulk( + parsed.map((x) => LocalMessage(x.id, x, x.channelId)).toList(), + ); + } + } + + Future> listMessages(Channel channel) async { + return await localMessages.findAllByChannel(channel.id); + } +} diff --git a/lib/providers/message/history.dart b/lib/providers/message/history.dart new file mode 100644 index 0000000..9618706 --- /dev/null +++ b/lib/providers/message/history.dart @@ -0,0 +1,51 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:floor/floor.dart'; +import 'package:solian/models/message.dart'; +import 'package:sqflite/sqflite.dart' as sqflite; + +part 'history.g.dart'; + +@entity +class LocalMessage { + @primaryKey + final int id; + + final Message data; + final int channelId; + + LocalMessage(this.id, this.data, this.channelId); +} + +class RemoteMessageConverter extends TypeConverter { + @override + Message decode(String databaseValue) { + return Message.fromJson(jsonDecode(databaseValue)); + } + + @override + String encode(Message value) { + return jsonEncode(value.toJson()); + } +} + +@dao +abstract class LocalMessageDao { + @Query('SELECT * FROM LocalMessage WHERE channelId = :channelId') + Future> findAllByChannel(int channelId); + + @Insert(onConflict: OnConflictStrategy.replace) + Future insert(LocalMessage m); + + @Insert(onConflict: OnConflictStrategy.replace) + Future insertBulk(List m); + + @Query('DELETE * FROM LocalMessage') + Future wipeLocalMessages(); +} + +@TypeConverters([RemoteMessageConverter]) +@Database(version: 1, entities: [LocalMessage]) +abstract class MessageHistoryDb extends FloorDatabase { + LocalMessageDao get localMessages; +} diff --git a/lib/providers/message/history.g.dart b/lib/providers/message/history.g.dart new file mode 100644 index 0000000..9edbf25 --- /dev/null +++ b/lib/providers/message/history.g.dart @@ -0,0 +1,165 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'history.dart'; + +// ************************************************************************** +// FloorGenerator +// ************************************************************************** + +abstract class $MessageHistoryDbBuilderContract { + /// Adds migrations to the builder. + $MessageHistoryDbBuilderContract addMigrations(List migrations); + + /// Adds a database [Callback] to the builder. + $MessageHistoryDbBuilderContract addCallback(Callback callback); + + /// Creates the database and initializes it. + Future build(); +} + +// ignore: avoid_classes_with_only_static_members +class $FloorMessageHistoryDb { + /// Creates a database builder for a persistent database. + /// Once a database is built, you should keep a reference to it and re-use it. + static $MessageHistoryDbBuilderContract databaseBuilder(String name) => + _$MessageHistoryDbBuilder(name); + + /// Creates a database builder for an in memory database. + /// Information stored in an in memory database disappears when the process is killed. + /// Once a database is built, you should keep a reference to it and re-use it. + static $MessageHistoryDbBuilderContract inMemoryDatabaseBuilder() => + _$MessageHistoryDbBuilder(null); +} + +class _$MessageHistoryDbBuilder implements $MessageHistoryDbBuilderContract { + _$MessageHistoryDbBuilder(this.name); + + final String? name; + + final List _migrations = []; + + Callback? _callback; + + @override + $MessageHistoryDbBuilderContract addMigrations(List migrations) { + _migrations.addAll(migrations); + return this; + } + + @override + $MessageHistoryDbBuilderContract addCallback(Callback callback) { + _callback = callback; + return this; + } + + @override + Future build() async { + final path = name != null + ? await sqfliteDatabaseFactory.getDatabasePath(name!) + : ':memory:'; + final database = _$MessageHistoryDb(); + database.database = await database.open( + path, + _migrations, + _callback, + ); + return database; + } +} + +class _$MessageHistoryDb extends MessageHistoryDb { + _$MessageHistoryDb([StreamController? listener]) { + changeListener = listener ?? StreamController.broadcast(); + } + + LocalMessageDao? _localMessagesInstance; + + Future open( + String path, + List migrations, [ + Callback? callback, + ]) async { + final databaseOptions = sqflite.OpenDatabaseOptions( + version: 1, + onConfigure: (database) async { + await database.execute('PRAGMA foreign_keys = ON'); + await callback?.onConfigure?.call(database); + }, + onOpen: (database) async { + await callback?.onOpen?.call(database); + }, + onUpgrade: (database, startVersion, endVersion) async { + await MigrationAdapter.runMigrations( + database, startVersion, endVersion, migrations); + + await callback?.onUpgrade?.call(database, startVersion, endVersion); + }, + onCreate: (database, version) async { + await database.execute( + 'CREATE TABLE IF NOT EXISTS `LocalMessage` (`id` INTEGER NOT NULL, `data` TEXT NOT NULL, `channelId` INTEGER NOT NULL, PRIMARY KEY (`id`))'); + + await callback?.onCreate?.call(database, version); + }, + ); + return sqfliteDatabaseFactory.openDatabase(path, options: databaseOptions); + } + + @override + LocalMessageDao get localMessages { + return _localMessagesInstance ??= + _$LocalMessageDao(database, changeListener); + } +} + +class _$LocalMessageDao extends LocalMessageDao { + _$LocalMessageDao( + this.database, + this.changeListener, + ) : _queryAdapter = QueryAdapter(database), + _localMessageInsertionAdapter = InsertionAdapter( + database, + 'LocalMessage', + (LocalMessage item) => { + 'id': item.id, + 'data': _remoteMessageConverter.encode(item.data), + 'channelId': item.channelId + }); + + final sqflite.DatabaseExecutor database; + + final StreamController changeListener; + + final QueryAdapter _queryAdapter; + + final InsertionAdapter _localMessageInsertionAdapter; + + @override + Future> findAllByChannel(int channelId) async { + return _queryAdapter.queryList( + 'SELECT * FROM LocalMessage WHERE channelId = ?1', + mapper: (Map row) => LocalMessage( + row['id'] as int, + _remoteMessageConverter.decode(row['data'] as String), + row['channelId'] as int), + arguments: [channelId]); + } + + @override + Future wipeLocalMessages() async { + await _queryAdapter.queryNoReturn('DELETE * FROM LocalMessage'); + } + + @override + Future insert(LocalMessage m) async { + await _localMessageInsertionAdapter.insert(m, OnConflictStrategy.replace); + } + + @override + Future insertBulk(List m) async { + await _localMessageInsertionAdapter.insertList( + m, OnConflictStrategy.replace); + } +} + +// ignore_for_file: unused_element +final _remoteMessageConverter = RemoteMessageConverter(); diff --git a/pubspec.lock b/pubspec.lock index 4ce3074..b7cedf9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + url: "https://pub.dev" + source: hosted + version: "67.0.0" _flutterfire_internals: dependency: transitive description: @@ -9,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.37" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + url: "https://pub.dev" + source: hosted + version: "6.4.1" archive: dependency: transitive description: @@ -41,6 +57,70 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.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: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7" + url: "https://pub.dev" + source: hosted + version: "2.4.11" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: e3c79f69a64bdfcd8a776a3c28db4eb6e3fb5356d013ae5eb2e52007706d5dbe + url: "https://pub.dev" + source: hosted + version: "7.3.1" + 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: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + url: "https://pub.dev" + source: hosted + version: "8.9.2" cached_network_image: dependency: "direct main" description: @@ -81,6 +161,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 + url: "https://pub.dev" + source: hosted + version: "1.3.1" checked_yaml: dependency: transitive description: @@ -113,6 +201,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + url: "https://pub.dev" + source: hosted + version: "4.10.0" collection: dependency: transitive description: @@ -137,6 +233,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" cross_file: dependency: transitive description: @@ -169,6 +273,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" + url: "https://pub.dev" + source: hosted + version: "2.3.6" dart_webrtc: dependency: transitive description: @@ -185,6 +297,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.10" + dev_build: + dependency: transitive + description: + name: dev_build + sha256: "4a4c8e3aaaaa9a7de4039dc711ee573de5612a35a4469d01ecf30e5ae74cbcfd" + url: "https://pub.dev" + source: hosted + version: "0.16.7+4" device_info_plus: dependency: "direct main" description: @@ -329,6 +449,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + floor: + dependency: "direct main" + description: + name: floor + sha256: c1b06023912b5b8e49deb6a9d867863c535ae1a232d991c3582bba3ee8687867 + url: "https://pub.dev" + source: hosted + version: "1.5.0" + floor_annotation: + dependency: transitive + description: + name: floor_annotation + sha256: a40949580a7ab0eee572686e2d3b1638fd6bd6a753e661d792ab4236b365b23b + url: "https://pub.dev" + source: hosted + version: "1.5.0" + floor_common: + dependency: transitive + description: + name: floor_common + sha256: "41c9914862f83a821815e1b1ffd47a1e1ae2130c35ff882ba2d000a67713ba64" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + floor_generator: + dependency: "direct dev" + description: + name: floor_generator + sha256: "1499b3ab878a807e6fbe6f140dc014124845cd1df3090a113aae5fa7577a1e77" + url: "https://pub.dev" + source: hosted + version: "1.5.0" flutter: dependency: "direct main" description: flutter @@ -504,6 +656,14 @@ packages: url: "https://pub.dev" source: hosted version: "10.7.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" get: dependency: "direct main" description: @@ -512,6 +672,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.6.6" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" go_router: dependency: "direct main" description: @@ -520,6 +688,14 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" html: dependency: transitive description: @@ -536,6 +712,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" + 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: @@ -632,6 +816,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.19.0" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" js: dependency: transitive description: @@ -680,6 +872,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + lists: + dependency: transitive + description: + name: lists + sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27" + url: "https://pub.dev" + source: hosted + version: "1.0.1" livekit_client: dependency: "direct main" description: @@ -776,6 +976,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" + 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: @@ -928,6 +1136,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + process_run: + dependency: transitive + description: + name: process_run + sha256: "8d9c6198b98fbbfb511edd42e7364e24d85c163e47398919871b952dc86a423e" + url: "https://pub.dev" + source: hosted + version: "0.14.2" protobuf: dependency: transitive description: @@ -952,6 +1176,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + url: "https://pub.dev" + source: hosted + version: "1.3.0" rxdart: dependency: transitive description: @@ -1040,6 +1272,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + url: "https://pub.dev" + source: hosted + version: "2.0.0" sky_engine: dependency: transitive description: flutter @@ -1053,6 +1301,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.12" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" source_span: dependency: transitive description: @@ -1070,7 +1326,7 @@ packages: source: hosted version: "7.0.0" sqflite: - dependency: transitive + dependency: "direct main" description: name: sqflite sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d @@ -1085,6 +1341,38 @@ packages: url: "https://pub.dev" source: hosted version: "2.5.4" + sqflite_common_ffi: + dependency: "direct dev" + description: + name: sqflite_common_ffi + sha256: "4d6137c29e930d6e4a8ff373989dd9de7bac12e3bc87bce950f6e844e8ad3bb5" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + sqflite_common_ffi_web: + dependency: "direct dev" + description: + name: sqflite_common_ffi_web + sha256: cfc9d1c61a3e06e5b2e96994a44b11125b4f451fee95b9fad8bd473b4613d592 + url: "https://pub.dev" + source: hosted + version: "0.4.3+1" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: b384f598b813b347c5a7e5ffad82cbaff1bec3d1561af267041e66f6f0899295 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + sqlparser: + dependency: transitive + description: + name: sqlparser + sha256: "7b20045d1ccfb7bc1df7e8f9fee5ae58673fce6ff62cefbb0e0fd7214e90e5a0" + url: "https://pub.dev" + source: hosted + version: "0.34.1" stack_trace: dependency: transitive description: @@ -1101,6 +1389,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + 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: @@ -1109,6 +1405,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + strings: + dependency: transitive + description: + name: strings + sha256: b33f40c4dd3e597bf6d9e7f4f4dc282dad0f19b07d9f320cb5c2183859cbccf5 + url: "https://pub.dev" + source: hosted + version: "3.1.1" synchronized: dependency: transitive description: @@ -1149,6 +1453,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.9.3" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" typed_data: dependency: transitive description: @@ -1157,6 +1469,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + unicode: + dependency: transitive + description: + name: unicode + sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1" + url: "https://pub.dev" + source: hosted + version: "0.3.1" url_launcher: dependency: "direct main" description: @@ -1309,6 +1629,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" web: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5e8ca1b..385e626 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,38 +1,16 @@ name: solian description: "The Solar Network App" -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: "none" # Remove this line if you wish to publish to pub.dev +publish_to: "none" -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# In Windows, build-name is used as the major, minor, and patch parts -# of the product and file versions while build-number is used as the build suffix. version: 1.1.0+1 environment: sdk: ">=3.3.4 <4.0.0" -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 go_router: ^14.1.1 get: ^4.6.6 @@ -70,59 +48,27 @@ dependencies: device_info_plus: ^10.1.0 shared_preferences: ^2.2.3 flutter_acrylic: ^1.1.4 + floor: ^1.5.0 + sqflite: ^2.3.3+1 dev_dependencies: flutter_test: sdk: flutter - # 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 - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. flutter_lints: ^4.0.0 flutter_launcher_icons: ^0.13.1 -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec + floor_generator: ^1.4.0 + build_runner: ^2.1.2 + sqflite_common_ffi: ^2.3.3 + sqflite_common_ffi_web: ^0.4.3+1 -# The following section is specific to Flutter packages. flutter: - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - # To add assets to your application, add an assets section, like this: assets: - assets/logo.png - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages - flutter_launcher_icons: android: "launcher_icon" ios: true