From c84c5a84025e38b4ce6655a82b7356f5eaca9aad Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Fri, 5 May 2023 15:22:13 +0200 Subject: [PATCH] neon: migrate to built_value Signed-off-by: Nikolas Rimikis --- packages/app/pubspec.lock | 31 +++++++++++++++++++ packages/neon/neon/lib/src/blocs/apps.dart | 2 +- .../neon/lib/src/utils/request_manager.dart | 2 +- .../neon/neon_news/lib/blocs/articles.dart | 2 +- packages/neon/neon_news/lib/blocs/news.dart | 4 +-- packages/neon/neon_notes/lib/blocs/notes.dart | 4 +-- .../lib/blocs/notifications.dart | 2 +- 7 files changed, 39 insertions(+), 8 deletions(-) diff --git a/packages/app/pubspec.lock b/packages/app/pubspec.lock index baf0ebf0..f745b22a 100644 --- a/packages/app/pubspec.lock +++ b/packages/app/pubspec.lock @@ -41,6 +41,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.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: "2f17434bd5d52a26762043d6b43bb53b3acd029b4d9071a329f46d67ef297e6d" + url: "https://pub.dev" + source: hosted + version: "8.5.0" characters: dependency: transitive description: @@ -121,6 +137,13 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.8" + dynamite_runtime: + dependency: transitive + description: + path: "../dynamite/dynamite_runtime" + relative: true + source: path + version: "1.0.0" fake_async: dependency: transitive description: @@ -168,6 +191,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter diff --git a/packages/neon/neon/lib/src/blocs/apps.dart b/packages/neon/neon/lib/src/blocs/apps.dart index 129539f5..4e7a341a 100644 --- a/packages/neon/neon/lib/src/blocs/apps.dart +++ b/packages/neon/neon/lib/src/blocs/apps.dart @@ -120,7 +120,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates 'apps-apps', apps, () async => _account.client.core.getNavigationApps(), - (final response) => response.ocs.data, + (final response) => response.ocs.data.toList(), ); } diff --git a/packages/neon/neon/lib/src/utils/request_manager.dart b/packages/neon/neon/lib/src/utils/request_manager.dart index 7cc4d33b..343bb70d 100644 --- a/packages/neon/neon/lib/src/utils/request_manager.dart +++ b/packages/neon/neon/lib/src/utils/request_manager.dart @@ -23,7 +23,7 @@ class RequestManager { call, unwrap, (final data) => json.encode(serializeNextcloud(data)), - (final data) => deserializeNextcloud(json.decode(data)), + (final data) => deserializeNextcloud(json.decode(data) as Object), disableTimeout, emitEmptyCache, 0, diff --git a/packages/neon/neon_news/lib/blocs/articles.dart b/packages/neon/neon_news/lib/blocs/articles.dart index 4e9cac12..6e0b8386 100644 --- a/packages/neon/neon_news/lib/blocs/articles.dart +++ b/packages/neon/neon_news/lib/blocs/articles.dart @@ -134,7 +134,7 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents id: id ?? 0, getRead: getRead ?? true ? 1 : 0, ), - (final response) => response.items, + (final response) => response.items.toList(), ); } diff --git a/packages/neon/neon_news/lib/blocs/news.dart b/packages/neon/neon_news/lib/blocs/news.dart index d108a392..1ab52fb2 100644 --- a/packages/neon/neon_news/lib/blocs/news.dart +++ b/packages/neon/neon_news/lib/blocs/news.dart @@ -99,7 +99,7 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates 'news-folders', folders, () async => client.news.listFolders(), - (final response) => response.folders, + (final response) => response.folders.toList(), ), requestManager.wrapNextcloud, NextcloudNewsListFeeds>( client.id, @@ -111,7 +111,7 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates if (response.newestItemId != null) { _newestItemId = response.newestItemId!; } - return response.feeds; + return response.feeds.toList(); }, ), mainArticlesBloc.reload(), diff --git a/packages/neon/neon_notes/lib/blocs/notes.dart b/packages/neon/neon_notes/lib/blocs/notes.dart index c7b0c6da..a1cffee0 100644 --- a/packages/neon/neon_notes/lib/blocs/notes.dart +++ b/packages/neon/neon_notes/lib/blocs/notes.dart @@ -46,12 +46,12 @@ class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocSta @override Future refresh() async { - await requestManager.wrapNextcloud, List>( + await requestManager.wrapNextcloud, Iterable>( client.id, 'notes-notes', notes, () async => client.notes.getNotes(), - (final response) => response, + (final response) => response.toList(), ); } diff --git a/packages/neon/neon_notifications/lib/blocs/notifications.dart b/packages/neon/neon_notifications/lib/blocs/notifications.dart index e76b207d..460c5556 100644 --- a/packages/neon/neon_notifications/lib/blocs/notifications.dart +++ b/packages/neon/neon_notifications/lib/blocs/notifications.dart @@ -52,7 +52,7 @@ class NotificationsBloc extends NotificationsBlocInterface implements Notificati 'notifications-notifications', notifications, () async => _client.notifications.listNotifications(), - (final response) => response.ocs.data, + (final response) => response.ocs.data.toList(), ); }