From b52806371f8fb399713a93c9e2241b1650723bc8 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Sun, 16 Jul 2023 20:30:59 +0200 Subject: [PATCH] refactor(neon): make stuff immutable --- packages/neon/neon/lib/src/utils/account_options.dart | 1 + packages/neon/neon/lib/src/utils/app_route.dart | 1 + packages/neon/neon/lib/src/utils/global_options.dart | 1 + packages/neon/neon/lib/src/utils/push_utils.dart | 1 + packages/neon/neon/lib/src/utils/request_manager.dart | 3 ++- 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/neon/neon/lib/src/utils/account_options.dart b/packages/neon/neon/lib/src/utils/account_options.dart index fc8c170f..6125009d 100644 --- a/packages/neon/neon/lib/src/utils/account_options.dart +++ b/packages/neon/neon/lib/src/utils/account_options.dart @@ -6,6 +6,7 @@ import 'package:neon/src/settings/models/select_option.dart'; import 'package:neon/src/settings/models/storage.dart'; @internal +@immutable class AccountSpecificOptions { AccountSpecificOptions( this._storage, diff --git a/packages/neon/neon/lib/src/utils/app_route.dart b/packages/neon/neon/lib/src/utils/app_route.dart index 459b5edd..544d6bfc 100644 --- a/packages/neon/neon/lib/src/utils/app_route.dart +++ b/packages/neon/neon/lib/src/utils/app_route.dart @@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart'; /// [RouteData] for the initial page of an app. /// /// Subclasses must override one of [build] or [redirect]. +@immutable abstract class NeonAppRoute extends GoRouteData { const NeonAppRoute(); diff --git a/packages/neon/neon/lib/src/utils/global_options.dart b/packages/neon/neon/lib/src/utils/global_options.dart index 0f056fbb..f0fccbe7 100644 --- a/packages/neon/neon/lib/src/utils/global_options.dart +++ b/packages/neon/neon/lib/src/utils/global_options.dart @@ -16,6 +16,7 @@ import 'package:shared_preferences/shared_preferences.dart'; const unifiedPushNextPushID = 'org.unifiedpush.distributor.nextpush'; @internal +@immutable class GlobalOptions { GlobalOptions( this._sharedPreferences, diff --git a/packages/neon/neon/lib/src/utils/push_utils.dart b/packages/neon/neon/lib/src/utils/push_utils.dart index b82f78b4..f96016e1 100644 --- a/packages/neon/neon/lib/src/utils/push_utils.dart +++ b/packages/neon/neon/lib/src/utils/push_utils.dart @@ -22,6 +22,7 @@ import 'package:nextcloud/nextcloud.dart'; import 'package:shared_preferences/shared_preferences.dart'; @internal +@immutable class PushUtils { static Future loadRSAKeypair(final AppStorage storage) async { const keyDevicePrivateKey = 'device-private-key'; diff --git a/packages/neon/neon/lib/src/utils/request_manager.dart b/packages/neon/neon/lib/src/utils/request_manager.dart index dbc845c9..59084143 100644 --- a/packages/neon/neon/lib/src/utils/request_manager.dart +++ b/packages/neon/neon/lib/src/utils/request_manager.dart @@ -9,8 +9,9 @@ import 'package:rxdart/rxdart.dart'; import 'package:sqflite/sqflite.dart'; import 'package:xml/xml.dart' as xml; +@immutable class RequestManager { - RequestManager([ + const RequestManager([ this.cache, ]);