From 9d03faf594a21803b6ece55f4475b5aceed7857e Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 6 Dec 2025 13:00:30 +0800 Subject: [PATCH] :recycle: Migrated to riverpod v3 --- lib/main.dart | 2 +- lib/pods/activity/activity_rpc.dart | 239 ++-- lib/pods/activity/activity_rpc.g.dart | 181 +-- lib/pods/chat/call.g.dart | 67 +- lib/pods/chat/chat_online_count.g.dart | 208 +-- lib/pods/chat/chat_room.dart | 27 +- lib/pods/chat/chat_room.g.dart | 521 ++++---- lib/pods/chat/chat_subscribe.dart | 24 +- lib/pods/chat/chat_subscribe.g.dart | 215 ++- lib/pods/chat/chat_summary.dart | 2 +- lib/pods/chat/chat_summary.g.dart | 127 +- lib/pods/chat/messages_notifier.dart | 18 +- lib/pods/chat/messages_notifier.g.dart | 223 ++-- lib/pods/config.dart | 13 +- lib/pods/config.g.dart | 70 +- lib/pods/event_calendar.dart | 1 - lib/pods/event_calendar.g.dart | 204 +-- lib/pods/file_list.dart | 4 +- lib/pods/file_list.g.dart | 116 +- lib/pods/file_pool.dart | 2 +- lib/pods/file_references.dart | 1 - lib/pods/file_references.g.dart | 174 +-- lib/pods/link_preview.g.dart | 204 +-- lib/pods/paging.dart | 84 +- lib/pods/site_files.dart | 22 +- lib/pods/site_files.g.dart | 569 +++----- lib/pods/site_pages.dart | 14 +- lib/pods/site_pages.g.dart | 360 ++---- lib/pods/sites.dart | 14 +- lib/pods/theme.dart | 3 +- lib/pods/theme.g.dart | 55 +- lib/pods/timeline.dart | 11 +- lib/pods/translate.dart | 1 - lib/pods/translate.g.dart | 347 ++--- lib/pods/upload_tasks.dart | 14 +- lib/pods/userinfo.dart | 94 +- lib/pods/web_auth/web_auth_providers.dart | 17 +- lib/pods/webfeed.dart | 12 +- lib/pods/websocket.dart | 25 +- lib/screens/account.dart | 4 +- lib/screens/account/credits.g.dart | 49 +- .../account/me/account_settings.g.dart | 171 ++- lib/screens/account/profile.g.dart | 1147 ++++++----------- lib/screens/account/relationship.g.dart | 59 +- lib/screens/auth/captcha.config.dart | 1 - lib/screens/auth/captcha.config.g.dart | 47 +- lib/screens/chat/call.dart | 4 +- lib/screens/chat/chat.dart | 17 +- lib/screens/chat/chat_form.dart | 2 +- lib/screens/chat/public_room_preview.dart | 6 +- lib/screens/chat/room.dart | 29 +- lib/screens/chat/room_detail.dart | 119 +- lib/screens/chat/room_detail.g.dart | 169 +-- lib/screens/chat/search_messages.dart | 6 +- .../chat/widgets/message_item_wrapper.dart | 24 +- lib/screens/creators/hub.dart | 88 +- lib/screens/creators/hub.g.dart | 712 ++++------ lib/screens/creators/poll/poll_list.dart | 8 +- lib/screens/creators/poll/poll_list.g.dart | 173 +-- lib/screens/creators/publishers_form.g.dart | 226 ++-- lib/screens/creators/sites/site_detail.g.dart | 202 +-- lib/screens/creators/sites/site_list.dart | 8 +- .../creators/stickers/pack_detail.dart | 2 +- .../creators/stickers/pack_detail.g.dart | 355 ++--- lib/screens/creators/stickers/stickers.dart | 16 +- lib/screens/creators/stickers/stickers.g.dart | 172 +-- lib/screens/developers/app_secrets.g.dart | 223 +--- lib/screens/developers/apps.g.dart | 383 ++---- lib/screens/developers/bot_keys.g.dart | 204 +-- lib/screens/developers/bots.g.dart | 174 +-- lib/screens/developers/edit_app.g.dart | 198 +-- lib/screens/developers/edit_bot.g.dart | 184 +-- lib/screens/developers/edit_project.g.dart | 182 +-- lib/screens/developers/hub.g.dart | 377 ++---- lib/screens/discovery/articles.dart | 8 +- lib/screens/discovery/articles.g.dart | 56 +- lib/screens/discovery/feeds/feed_detail.dart | 7 +- .../discovery/feeds/feed_detail.g.dart | 370 ++---- lib/screens/explore.dart | 30 +- lib/screens/files/file_list.dart | 2 +- lib/screens/lottery.g.dart | 397 ++---- lib/screens/notification.dart | 16 +- lib/screens/notification.g.dart | 66 +- lib/screens/posts/compose_article.dart | 2 +- lib/screens/posts/post_categories_list.dart | 21 +- lib/screens/posts/post_category_detail.g.dart | 509 +++----- lib/screens/posts/post_detail.dart | 33 +- lib/screens/posts/post_detail.g.dart | 158 +-- lib/screens/posts/post_search.dart | 23 +- lib/screens/posts/publisher_profile.g.dart | 833 ++++-------- lib/screens/realm/realm_detail.dart | 12 +- lib/screens/realm/realms.dart | 7 +- lib/screens/realm/realms.g.dart | 267 ++-- lib/screens/settings.dart | 74 +- lib/screens/stickers/pack_detail.g.dart | 367 ++---- lib/screens/tabs.dart | 27 +- lib/screens/thought/think.dart | 2 +- lib/screens/thought/think.g.dart | 285 ++-- lib/screens/wallet.dart | 18 +- lib/screens/wallet.g.dart | 277 ++-- lib/services/compose_storage_db.g.dart | 72 +- lib/services/tour.g.dart | 70 +- lib/widgets/account/account_devices.g.dart | 59 +- lib/widgets/account/account_picker.g.dart | 174 +-- lib/widgets/account/activity_presence.g.dart | 369 ++---- lib/widgets/account/friends_overview.g.dart | 59 +- lib/widgets/account/status.dart | 19 +- lib/widgets/account/status.g.dart | 174 +-- .../account/stellar_program_tab.g.dart | 617 ++++----- lib/widgets/app_scaffold.dart | 9 +- lib/widgets/chat/call_button.dart | 4 +- lib/widgets/chat/call_button.g.dart | 172 +-- lib/widgets/chat/call_content.dart | 4 +- lib/widgets/chat/call_overlay.dart | 12 +- lib/widgets/chat/call_participant_card.dart | 2 +- lib/widgets/chat/chat_input.dart | 4 +- lib/widgets/chat/chat_link_attachments.dart | 12 +- lib/widgets/chat/message_item.dart | 4 +- lib/widgets/chat/public_room_preview.dart | 6 +- lib/widgets/check_in.dart | 2 +- lib/widgets/check_in.g.dart | 112 +- .../content/cloud_file_collection.dart | 2 +- lib/widgets/content/cloud_files.dart | 2 +- lib/widgets/data_saving_gate.dart | 6 +- lib/widgets/file_list_view.dart | 46 +- lib/widgets/navigation/fab_menu.dart | 21 +- lib/widgets/paging/pagination_list.dart | 21 +- lib/widgets/poll/poll_feedback.dart | 15 +- lib/widgets/post/compose_card.dart | 4 +- lib/widgets/post/compose_dialog.dart | 6 +- lib/widgets/post/compose_fund.dart | 6 +- .../post/compose_link_attachments.dart | 4 +- .../post/compose_settings_sheet.g.dart | 58 +- lib/widgets/post/compose_shared.dart | 16 +- lib/widgets/post/compose_sheet.dart | 6 +- lib/widgets/post/compose_state_utils.dart | 4 +- lib/widgets/post/compose_toolbar.dart | 2 +- lib/widgets/post/draft_manager.dart | 6 +- .../post/post_award_history_sheet.dart | 14 +- lib/widgets/post/post_featured.g.dart | 55 +- lib/widgets/post/post_item.dart | 2 +- lib/widgets/post/post_list.dart | 12 +- lib/widgets/post/post_reaction_sheet.dart | 40 +- .../post/post_reaction_sheet.freezed.dart | 274 ++++ lib/widgets/post/post_replies.dart | 19 +- lib/widgets/post/post_replies_sheet.dart | 2 +- lib/widgets/post/post_shared.dart | 2 +- lib/widgets/post/post_shared.g.dart | 167 +-- lib/widgets/post/post_shuffle.dart | 4 +- lib/widgets/realm/realm_list.dart | 12 +- lib/widgets/share/share_sheet.dart | 2 +- lib/widgets/stickers/sticker_picker.dart | 1 - lib/widgets/stickers/sticker_picker.g.dart | 66 +- .../thought/thought_sequence_list.dart | 8 +- lib/widgets/tour/tour.dart | 2 +- lib/widgets/wallet/fund_envelope.g.dart | 172 +-- pubspec.lock | 236 ++-- pubspec.yaml | 27 +- 158 files changed, 6834 insertions(+), 10357 deletions(-) create mode 100644 lib/widgets/post/post_reaction_sheet.freezed.dart diff --git a/lib/main.dart b/lib/main.dart index 16ec7849..7d6bbab4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -211,7 +211,7 @@ class IslandApp extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final theme = ref.watch(themeProvider); - final settings = ref.watch(appSettingsNotifierProvider); + final settings = ref.watch(appSettingsProvider); // Convert string theme mode to ThemeMode enum ThemeMode getThemeMode() { diff --git a/lib/pods/activity/activity_rpc.dart b/lib/pods/activity/activity_rpc.dart index 7a389ee2..638de21b 100644 --- a/lib/pods/activity/activity_rpc.dart +++ b/lib/pods/activity/activity_rpc.dart @@ -330,13 +330,127 @@ class ServerState { } } -class ServerStateNotifier extends StateNotifier { - final ActivityRpcServer server; - final Dio apiClient; +class ServerStateNotifier extends Notifier { + late final ActivityRpcServer server; + late final Dio apiClient; Timer? _renewalTimer; - ServerStateNotifier(this.apiClient, this.server) - : super(ServerState(status: 'Server not started')); + @override + ServerState build() { + apiClient = ref.watch(apiClientProvider); + server = ActivityRpcServer({}); + _setupHandlers(); + ref.onDispose(() { + _stopRenewal(); + server.stop(); + }); + return ServerState(status: 'Server not started'); + } + + void _setupHandlers() { + server.updateHandlers({ + 'connection': (socket) { + final clientId = + socket is _WsSocketWrapper + ? socket.clientId + : (socket as IpcSocketWrapper).clientId; + updateStatus('Client connected (ID: $clientId)'); + socket.send({ + 'cmd': 'DISPATCH', + 'data': { + 'v': 1, + 'config': { + 'cdn_host': 'fake.cdn', + 'api_endpoint': '//fake.api', + 'environment': 'dev', + }, + 'user': { + 'id': 'fake_user_id', + 'username': 'FakeUser', + 'discriminator': '0001', + 'avatar': null, + 'bot': false, + }, + }, + 'evt': 'READY', + 'nonce': '12345', + }); + }, + 'message': (socket, dynamic data) async { + if (data['cmd'] == 'SET_ACTIVITY') { + final activity = data['args']['activity']; + final appId = 'rpc:${socket.clientId}'; + + final currentId = currentActivityManualId; + if (currentId != null && currentId != appId) { + talker.info( + 'Skipped the new SET_ACTIVITY command due to there is one existing...', + ); + return; + } + + addActivity('Activity: ${activity['details'] ?? 'Untitled'}'); + // https://discord.com/developers/docs/topics/rpc#setactivity-set-activity-argument-structure + final type = switch (activity['type']) { + 0 => 1, // Discord Playing -> Playing + 2 => 2, // Discord Music -> Listening + 3 => 2, // Discord Watching -> Listening + _ => 1, // Discord Competing (or null) -> Playing + }; + final title = activity['name'] ?? activity['assets']?['small_text']; + final subtitle = + activity['details'] ?? activity['assets']?['large_text']; + var imageSmall = activity['assets']?['small_image']; + var imageLarge = activity['assets']?['large_image']; + if (imageSmall != null && !imageSmall!.contains(':')) { + imageSmall = 'discord:$imageSmall'; + } + if (imageLarge != null && !imageLarge!.contains(':')) { + imageLarge = 'discord:$imageLarge'; + } + try { + final activityData = { + 'type': type, + 'manual_id': appId, + 'title': title, + 'subtitle': subtitle, + 'caption': activity['state'], + 'title_url': activity['assets']?['small_text_url'], + 'subtitle_url': activity['assets']?['large_text_url'], + 'small_image': imageSmall, + 'large_image': imageLarge, + 'meta': activity, + 'lease_minutes': kPresenceActivityLease, + }; + + await apiClient.post('/pass/activities', data: activityData); + setCurrentActivity(appId, activityData); + } catch (e) { + talker.log('Failed to set remote activity status: $e'); + } + socket.send({ + 'cmd': 'SET_ACTIVITY', + 'data': data['args']['activity'], + 'evt': null, + 'nonce': data['nonce'], + }); + } + }, + 'close': (socket) async { + updateStatus('Client disconnected'); + final currentId = currentActivityManualId; + try { + await apiClient.delete( + '/pass/activities', + queryParameters: {'manualId': currentId}, + ); + setCurrentActivity(null, null); + } catch (e) { + talker.log('Failed to unset remote activity status: $e'); + } + }, + }); + } String? get currentActivityManualId => state.currentActivityManualId; @@ -408,119 +522,8 @@ class ServerStateNotifier extends StateNotifier { const kPresenceActivityLease = 5; // Providers -final rpcServerStateProvider = StateNotifierProvider< - ServerStateNotifier, - ServerState ->((ref) { - final apiClient = ref.watch(apiClientProvider); - final server = ActivityRpcServer({}); - final notifier = ServerStateNotifier(apiClient, server); - server.updateHandlers({ - 'connection': (socket) { - final clientId = - socket is _WsSocketWrapper - ? socket.clientId - : (socket as IpcSocketWrapper).clientId; - notifier.updateStatus('Client connected (ID: $clientId)'); - socket.send({ - 'cmd': 'DISPATCH', - 'data': { - 'v': 1, - 'config': { - 'cdn_host': 'fake.cdn', - 'api_endpoint': '//fake.api', - 'environment': 'dev', - }, - 'user': { - 'id': 'fake_user_id', - 'username': 'FakeUser', - 'discriminator': '0001', - 'avatar': null, - 'bot': false, - }, - }, - 'evt': 'READY', - 'nonce': '12345', - }); - }, - 'message': (socket, dynamic data) async { - if (data['cmd'] == 'SET_ACTIVITY') { - final activity = data['args']['activity']; - final appId = 'rpc:${socket.clientId}'; - - final currentId = notifier.currentActivityManualId; - if (currentId != null && currentId != appId) { - talker.info( - 'Skipped the new SET_ACTIVITY command due to there is one existing...', - ); - return; - } - - notifier.addActivity('Activity: ${activity['details'] ?? 'Untitled'}'); - // https://discord.com/developers/docs/topics/rpc#setactivity-set-activity-argument-structure - final type = switch (activity['type']) { - 0 => 1, // Discord Playing -> Playing - 2 => 2, // Discord Music -> Listening - 3 => 2, // Discord Watching -> Listening - _ => 1, // Discord Competing (or null) -> Playing - }; - final title = activity['name'] ?? activity['assets']?['small_text']; - final subtitle = - activity['details'] ?? activity['assets']?['large_text']; - var imageSmall = activity['assets']?['small_image']; - var imageLarge = activity['assets']?['large_image']; - if (imageSmall != null && !imageSmall!.contains(':')) { - imageSmall = 'discord:$imageSmall'; - } - if (imageLarge != null && !imageLarge!.contains(':')) { - imageLarge = 'discord:$imageLarge'; - } - try { - final apiClient = ref.watch(apiClientProvider); - final activityData = { - 'type': type, - 'manual_id': appId, - 'title': title, - 'subtitle': subtitle, - 'caption': activity['state'], - 'title_url': activity['assets']?['small_text_url'], - 'subtitle_url': activity['assets']?['large_text_url'], - 'small_image': imageSmall, - 'large_image': imageLarge, - 'meta': activity, - 'lease_minutes': kPresenceActivityLease, - }; - - await apiClient.post('/pass/activities', data: activityData); - notifier.setCurrentActivity(appId, activityData); - } catch (e) { - talker.log('Failed to set remote activity status: $e'); - } - socket.send({ - 'cmd': 'SET_ACTIVITY', - 'data': data['args']['activity'], - 'evt': null, - 'nonce': data['nonce'], - }); - } - }, - 'close': (socket) async { - notifier.updateStatus('Client disconnected'); - final currentId = notifier.currentActivityManualId; - try { - final apiClient = ref.watch(apiClientProvider); - await apiClient.delete( - '/pass/activities', - queryParameters: {'manualId': currentId}, - ); - notifier.setCurrentActivity(null, null); - } catch (e) { - talker.log('Failed to unset remote activity status: $e'); - } - }, - }); - return notifier; -}); +final rpcServerStateProvider = + NotifierProvider(ServerStateNotifier.new); final rpcServerProvider = Provider((ref) { final notifier = ref.watch(rpcServerStateProvider.notifier); diff --git a/lib/pods/activity/activity_rpc.g.dart b/lib/pods/activity/activity_rpc.g.dart index 245fd682..e3155930 100644 --- a/lib/pods/activity/activity_rpc.g.dart +++ b/lib/pods/activity/activity_rpc.g.dart @@ -6,152 +6,83 @@ part of 'activity_rpc.dart'; // RiverpodGenerator // ************************************************************************** -String _$presenceActivitiesHash() => - r'3bfaa638eeb961ecd62a32d6a7760a6a7e7bf6f2'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [presenceActivities]. @ProviderFor(presenceActivities) -const presenceActivitiesProvider = PresenceActivitiesFamily(); +const presenceActivitiesProvider = PresenceActivitiesFamily._(); -/// See also [presenceActivities]. -class PresenceActivitiesFamily - extends Family>> { - /// See also [presenceActivities]. - const PresenceActivitiesFamily(); +final class PresenceActivitiesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const PresenceActivitiesProvider._({ + required PresenceActivitiesFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'presenceActivitiesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [presenceActivities]. - PresenceActivitiesProvider call(String uname) { - return PresenceActivitiesProvider(uname); + @override + String debugGetCreateSourceHash() => _$presenceActivitiesHash(); + + @override + String toString() { + return r'presenceActivitiesProvider' + '' + '($argument)'; } + @$internal @override - PresenceActivitiesProvider getProviderOverride( - covariant PresenceActivitiesProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'presenceActivitiesProvider'; -} - -/// See also [presenceActivities]. -class PresenceActivitiesProvider - extends AutoDisposeFutureProvider> { - /// See also [presenceActivities]. - PresenceActivitiesProvider(String uname) - : this._internal( - (ref) => presenceActivities(ref as PresenceActivitiesRef, uname), - from: presenceActivitiesProvider, - name: r'presenceActivitiesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$presenceActivitiesHash, - dependencies: PresenceActivitiesFamily._dependencies, - allTransitiveDependencies: - PresenceActivitiesFamily._allTransitiveDependencies, - uname: uname, - ); - - PresenceActivitiesProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; - - @override - Override overrideWith( - FutureOr> Function(PresenceActivitiesRef provider) - create, - ) { - return ProviderOverride( - origin: this, - override: PresenceActivitiesProvider._internal( - (ref) => create(ref as PresenceActivitiesRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _PresenceActivitiesProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return presenceActivities(ref, argument); } @override bool operator ==(Object other) { - return other is PresenceActivitiesProvider && other.uname == uname; + return other is PresenceActivitiesProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PresenceActivitiesRef - on AutoDisposeFutureProviderRef> { - /// The parameter `uname` of this provider. - String get uname; -} +String _$presenceActivitiesHash() => + r'3bfaa638eeb961ecd62a32d6a7760a6a7e7bf6f2'; -class _PresenceActivitiesProviderElement - extends AutoDisposeFutureProviderElement> - with PresenceActivitiesRef { - _PresenceActivitiesProviderElement(super.provider); +final class PresenceActivitiesFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const PresenceActivitiesFamily._() + : super( + retry: null, + name: r'presenceActivitiesProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + PresenceActivitiesProvider call(String uname) => + PresenceActivitiesProvider._(argument: uname, from: this); @override - String get uname => (origin as PresenceActivitiesProvider).uname; + String toString() => r'presenceActivitiesProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/pods/chat/call.g.dart b/lib/pods/chat/call.g.dart index be1ee608..65e2b0b1 100644 --- a/lib/pods/chat/call.g.dart +++ b/lib/pods/chat/call.g.dart @@ -6,19 +6,58 @@ part of 'call.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(CallNotifier) +const callProvider = CallNotifierProvider._(); + +final class CallNotifierProvider + extends $NotifierProvider { + const CallNotifierProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'callProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$callNotifierHash(); + + @$internal + @override + CallNotifier create() => CallNotifier(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(CallState value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + String _$callNotifierHash() => r'ef4e3e9c9d411cf9dce1ceb456a3b866b2c87db3'; -/// See also [CallNotifier]. -@ProviderFor(CallNotifier) -final callNotifierProvider = NotifierProvider.internal( - CallNotifier.new, - name: r'callNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$callNotifierHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$CallNotifier = Notifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$CallNotifier extends $Notifier { + CallState build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + CallState, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/pods/chat/chat_online_count.g.dart b/lib/pods/chat/chat_online_count.g.dart index 8ce93457..effa8a41 100644 --- a/lib/pods/chat/chat_online_count.g.dart +++ b/lib/pods/chat/chat_online_count.g.dart @@ -6,163 +6,97 @@ part of 'chat_online_count.dart'; // RiverpodGenerator // ************************************************************************** -String _$chatOnlineCountNotifierHash() => - r'19af8fd0e9f62c65e12a68215406776085235fa3'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -abstract class _$ChatOnlineCountNotifier - extends BuildlessAutoDisposeAsyncNotifier { - late final String chatroomId; - - FutureOr build(String chatroomId); -} - -/// See also [ChatOnlineCountNotifier]. @ProviderFor(ChatOnlineCountNotifier) -const chatOnlineCountNotifierProvider = ChatOnlineCountNotifierFamily(); +const chatOnlineCountProvider = ChatOnlineCountNotifierFamily._(); -/// See also [ChatOnlineCountNotifier]. -class ChatOnlineCountNotifierFamily extends Family> { - /// See also [ChatOnlineCountNotifier]. - const ChatOnlineCountNotifierFamily(); +final class ChatOnlineCountNotifierProvider + extends $AsyncNotifierProvider { + const ChatOnlineCountNotifierProvider._({ + required ChatOnlineCountNotifierFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'chatOnlineCountProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [ChatOnlineCountNotifier]. - ChatOnlineCountNotifierProvider call(String chatroomId) { - return ChatOnlineCountNotifierProvider(chatroomId); + @override + String debugGetCreateSourceHash() => _$chatOnlineCountNotifierHash(); + + @override + String toString() { + return r'chatOnlineCountProvider' + '' + '($argument)'; } + @$internal @override - ChatOnlineCountNotifierProvider getProviderOverride( - covariant ChatOnlineCountNotifierProvider provider, - ) { - return call(provider.chatroomId); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'chatOnlineCountNotifierProvider'; -} - -/// See also [ChatOnlineCountNotifier]. -class ChatOnlineCountNotifierProvider - extends AutoDisposeAsyncNotifierProviderImpl { - /// See also [ChatOnlineCountNotifier]. - ChatOnlineCountNotifierProvider(String chatroomId) - : this._internal( - () => ChatOnlineCountNotifier()..chatroomId = chatroomId, - from: chatOnlineCountNotifierProvider, - name: r'chatOnlineCountNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$chatOnlineCountNotifierHash, - dependencies: ChatOnlineCountNotifierFamily._dependencies, - allTransitiveDependencies: - ChatOnlineCountNotifierFamily._allTransitiveDependencies, - chatroomId: chatroomId, - ); - - ChatOnlineCountNotifierProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.chatroomId, - }) : super.internal(); - - final String chatroomId; - - @override - FutureOr runNotifierBuild(covariant ChatOnlineCountNotifier notifier) { - return notifier.build(chatroomId); - } - - @override - Override overrideWith(ChatOnlineCountNotifier Function() create) { - return ProviderOverride( - origin: this, - override: ChatOnlineCountNotifierProvider._internal( - () => create()..chatroomId = chatroomId, - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - chatroomId: chatroomId, - ), - ); - } - - @override - AutoDisposeAsyncNotifierProviderElement - createElement() { - return _ChatOnlineCountNotifierProviderElement(this); - } + ChatOnlineCountNotifier create() => ChatOnlineCountNotifier(); @override bool operator ==(Object other) { return other is ChatOnlineCountNotifierProvider && - other.chatroomId == chatroomId; + other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, chatroomId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin ChatOnlineCountNotifierRef on AutoDisposeAsyncNotifierProviderRef { - /// The parameter `chatroomId` of this provider. - String get chatroomId; -} +String _$chatOnlineCountNotifierHash() => + r'19af8fd0e9f62c65e12a68215406776085235fa3'; -class _ChatOnlineCountNotifierProviderElement - extends - AutoDisposeAsyncNotifierProviderElement - with ChatOnlineCountNotifierRef { - _ChatOnlineCountNotifierProviderElement(super.provider); +final class ChatOnlineCountNotifierFamily extends $Family + with + $ClassFamilyOverride< + ChatOnlineCountNotifier, + AsyncValue, + int, + FutureOr, + String + > { + const ChatOnlineCountNotifierFamily._() + : super( + retry: null, + name: r'chatOnlineCountProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + ChatOnlineCountNotifierProvider call(String chatroomId) => + ChatOnlineCountNotifierProvider._(argument: chatroomId, from: this); @override - String get chatroomId => - (origin as ChatOnlineCountNotifierProvider).chatroomId; + String toString() => r'chatOnlineCountProvider'; } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$ChatOnlineCountNotifier extends $AsyncNotifier { + late final _$args = ref.$arg as String; + String get chatroomId => _$args; + + FutureOr build(String chatroomId); + @$mustCallSuper + @override + void runBuild() { + final created = build(_$args); + final ref = this.ref as $Ref, int>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, int>, + AsyncValue, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/pods/chat/chat_room.dart b/lib/pods/chat/chat_room.dart index 4c762a82..0ab4397f 100644 --- a/lib/pods/chat/chat_room.dart +++ b/lib/pods/chat/chat_room.dart @@ -11,9 +11,32 @@ import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'chat_room.g.dart'; -final isSyncingProvider = StateProvider.autoDispose((ref) => false); +final chatSyncingProvider = NotifierProvider( + ChatSyncingNotifier.new, +); -final flashingMessagesProvider = StateProvider>((ref) => {}); +class ChatSyncingNotifier extends Notifier { + @override + bool build() => false; + + void set(bool value) => state = value; +} + +final flashingMessagesProvider = + NotifierProvider>( + FlashingMessagesNotifier.new, + ); + +class FlashingMessagesNotifier extends Notifier> { + @override + Set build() => {}; + + void update(Set Function(Set) cb) { + state = cb(state); + } + + void clear() => state = {}; +} @riverpod class ChatRoomJoinedNotifier extends _$ChatRoomJoinedNotifier { diff --git a/lib/pods/chat/chat_room.g.dart b/lib/pods/chat/chat_room.g.dart index 500adda7..85ee0d41 100644 --- a/lib/pods/chat/chat_room.g.dart +++ b/lib/pods/chat/chat_room.g.dart @@ -6,350 +6,277 @@ part of 'chat_room.dart'; // RiverpodGenerator // ************************************************************************** -String _$chatroomInvitesHash() => r'5cd6391b09c5517ede19bacce43b45c8d71dd087'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [chatroomInvites]. -@ProviderFor(chatroomInvites) -final chatroomInvitesProvider = - AutoDisposeFutureProvider>.internal( - chatroomInvites, - name: r'chatroomInvitesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$chatroomInvitesHash, - dependencies: null, - allTransitiveDependencies: null, - ); +@ProviderFor(ChatRoomJoinedNotifier) +const chatRoomJoinedProvider = ChatRoomJoinedNotifierProvider._(); + +final class ChatRoomJoinedNotifierProvider + extends $AsyncNotifierProvider> { + const ChatRoomJoinedNotifierProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'chatRoomJoinedProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$chatRoomJoinedNotifierHash(); + + @$internal + @override + ChatRoomJoinedNotifier create() => ChatRoomJoinedNotifier(); +} -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef ChatroomInvitesRef = AutoDisposeFutureProviderRef>; String _$chatRoomJoinedNotifierHash() => r'c8092225ba0d9c08b2b5bca6f800f1877303b4ff'; -/// See also [ChatRoomJoinedNotifier]. -@ProviderFor(ChatRoomJoinedNotifier) -final chatRoomJoinedNotifierProvider = AutoDisposeAsyncNotifierProvider< - ChatRoomJoinedNotifier, - List ->.internal( - ChatRoomJoinedNotifier.new, - name: r'chatRoomJoinedNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$chatRoomJoinedNotifierHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$ChatRoomJoinedNotifier = AutoDisposeAsyncNotifier>; -String _$chatRoomNotifierHash() => r'1e6391e2ab4eeb114fa001aaa6b06ab2bd646f38'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); +abstract class _$ChatRoomJoinedNotifier + extends $AsyncNotifier> { + FutureOr> build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = + this.ref as $Ref>, List>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier>, List>, + AsyncValue>, + Object?, + Object? + >; + element.handleValue(ref, created); } } -abstract class _$ChatRoomNotifier - extends BuildlessAutoDisposeAsyncNotifier { - late final String? identifier; - - FutureOr build(String? identifier); -} - -/// See also [ChatRoomNotifier]. @ProviderFor(ChatRoomNotifier) -const chatRoomNotifierProvider = ChatRoomNotifierFamily(); +const chatRoomProvider = ChatRoomNotifierFamily._(); -/// See also [ChatRoomNotifier]. -class ChatRoomNotifierFamily extends Family> { - /// See also [ChatRoomNotifier]. - const ChatRoomNotifierFamily(); +final class ChatRoomNotifierProvider + extends $AsyncNotifierProvider { + const ChatRoomNotifierProvider._({ + required ChatRoomNotifierFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'chatRoomProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [ChatRoomNotifier]. - ChatRoomNotifierProvider call(String? identifier) { - return ChatRoomNotifierProvider(identifier); + @override + String debugGetCreateSourceHash() => _$chatRoomNotifierHash(); + + @override + String toString() { + return r'chatRoomProvider' + '' + '($argument)'; } + @$internal @override - ChatRoomNotifierProvider getProviderOverride( - covariant ChatRoomNotifierProvider provider, - ) { - return call(provider.identifier); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'chatRoomNotifierProvider'; -} - -/// See also [ChatRoomNotifier]. -class ChatRoomNotifierProvider - extends - AutoDisposeAsyncNotifierProviderImpl { - /// See also [ChatRoomNotifier]. - ChatRoomNotifierProvider(String? identifier) - : this._internal( - () => ChatRoomNotifier()..identifier = identifier, - from: chatRoomNotifierProvider, - name: r'chatRoomNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$chatRoomNotifierHash, - dependencies: ChatRoomNotifierFamily._dependencies, - allTransitiveDependencies: - ChatRoomNotifierFamily._allTransitiveDependencies, - identifier: identifier, - ); - - ChatRoomNotifierProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.identifier, - }) : super.internal(); - - final String? identifier; - - @override - FutureOr runNotifierBuild(covariant ChatRoomNotifier notifier) { - return notifier.build(identifier); - } - - @override - Override overrideWith(ChatRoomNotifier Function() create) { - return ProviderOverride( - origin: this, - override: ChatRoomNotifierProvider._internal( - () => create()..identifier = identifier, - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - identifier: identifier, - ), - ); - } - - @override - AutoDisposeAsyncNotifierProviderElement - createElement() { - return _ChatRoomNotifierProviderElement(this); - } + ChatRoomNotifier create() => ChatRoomNotifier(); @override bool operator ==(Object other) { - return other is ChatRoomNotifierProvider && other.identifier == identifier; + return other is ChatRoomNotifierProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, identifier.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin ChatRoomNotifierRef on AutoDisposeAsyncNotifierProviderRef { - /// The parameter `identifier` of this provider. - String? get identifier; -} +String _$chatRoomNotifierHash() => r'1e6391e2ab4eeb114fa001aaa6b06ab2bd646f38'; -class _ChatRoomNotifierProviderElement - extends - AutoDisposeAsyncNotifierProviderElement - with ChatRoomNotifierRef { - _ChatRoomNotifierProviderElement(super.provider); +final class ChatRoomNotifierFamily extends $Family + with + $ClassFamilyOverride< + ChatRoomNotifier, + AsyncValue, + SnChatRoom?, + FutureOr, + String? + > { + const ChatRoomNotifierFamily._() + : super( + retry: null, + name: r'chatRoomProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + ChatRoomNotifierProvider call(String? identifier) => + ChatRoomNotifierProvider._(argument: identifier, from: this); @override - String? get identifier => (origin as ChatRoomNotifierProvider).identifier; + String toString() => r'chatRoomProvider'; +} + +abstract class _$ChatRoomNotifier extends $AsyncNotifier { + late final _$args = ref.$arg as String?; + String? get identifier => _$args; + + FutureOr build(String? identifier); + @$mustCallSuper + @override + void runBuild() { + final created = build(_$args); + final ref = this.ref as $Ref, SnChatRoom?>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, SnChatRoom?>, + AsyncValue, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} + +@ProviderFor(ChatRoomIdentityNotifier) +const chatRoomIdentityProvider = ChatRoomIdentityNotifierFamily._(); + +final class ChatRoomIdentityNotifierProvider + extends $AsyncNotifierProvider { + const ChatRoomIdentityNotifierProvider._({ + required ChatRoomIdentityNotifierFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'chatRoomIdentityProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$chatRoomIdentityNotifierHash(); + + @override + String toString() { + return r'chatRoomIdentityProvider' + '' + '($argument)'; + } + + @$internal + @override + ChatRoomIdentityNotifier create() => ChatRoomIdentityNotifier(); + + @override + bool operator ==(Object other) { + return other is ChatRoomIdentityNotifierProvider && + other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$chatRoomIdentityNotifierHash() => r'27c17d55366d39be81d7209837e5c01f80a68a24'; -abstract class _$ChatRoomIdentityNotifier - extends BuildlessAutoDisposeAsyncNotifier { - late final String? identifier; - - FutureOr build(String? identifier); -} - -/// See also [ChatRoomIdentityNotifier]. -@ProviderFor(ChatRoomIdentityNotifier) -const chatRoomIdentityNotifierProvider = ChatRoomIdentityNotifierFamily(); - -/// See also [ChatRoomIdentityNotifier]. -class ChatRoomIdentityNotifierFamily extends Family> { - /// See also [ChatRoomIdentityNotifier]. - const ChatRoomIdentityNotifierFamily(); - - /// See also [ChatRoomIdentityNotifier]. - ChatRoomIdentityNotifierProvider call(String? identifier) { - return ChatRoomIdentityNotifierProvider(identifier); - } - - @override - ChatRoomIdentityNotifierProvider getProviderOverride( - covariant ChatRoomIdentityNotifierProvider provider, - ) { - return call(provider.identifier); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'chatRoomIdentityNotifierProvider'; -} - -/// See also [ChatRoomIdentityNotifier]. -class ChatRoomIdentityNotifierProvider - extends - AutoDisposeAsyncNotifierProviderImpl< +final class ChatRoomIdentityNotifierFamily extends $Family + with + $ClassFamilyOverride< ChatRoomIdentityNotifier, - SnChatMember? + AsyncValue, + SnChatMember?, + FutureOr, + String? > { - /// See also [ChatRoomIdentityNotifier]. - ChatRoomIdentityNotifierProvider(String? identifier) - : this._internal( - () => ChatRoomIdentityNotifier()..identifier = identifier, - from: chatRoomIdentityNotifierProvider, - name: r'chatRoomIdentityNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$chatRoomIdentityNotifierHash, - dependencies: ChatRoomIdentityNotifierFamily._dependencies, - allTransitiveDependencies: - ChatRoomIdentityNotifierFamily._allTransitiveDependencies, - identifier: identifier, + const ChatRoomIdentityNotifierFamily._() + : super( + retry: null, + name: r'chatRoomIdentityProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - ChatRoomIdentityNotifierProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.identifier, - }) : super.internal(); - - final String? identifier; + ChatRoomIdentityNotifierProvider call(String? identifier) => + ChatRoomIdentityNotifierProvider._(argument: identifier, from: this); @override - FutureOr runNotifierBuild( - covariant ChatRoomIdentityNotifier notifier, - ) { - return notifier.build(identifier); - } + String toString() => r'chatRoomIdentityProvider'; +} +abstract class _$ChatRoomIdentityNotifier + extends $AsyncNotifier { + late final _$args = ref.$arg as String?; + String? get identifier => _$args; + + FutureOr build(String? identifier); + @$mustCallSuper @override - Override overrideWith(ChatRoomIdentityNotifier Function() create) { - return ProviderOverride( - origin: this, - override: ChatRoomIdentityNotifierProvider._internal( - () => create()..identifier = identifier, - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - identifier: identifier, - ), - ); - } - - @override - AutoDisposeAsyncNotifierProviderElement< - ChatRoomIdentityNotifier, - SnChatMember? - > - createElement() { - return _ChatRoomIdentityNotifierProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is ChatRoomIdentityNotifierProvider && - other.identifier == identifier; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, identifier.hashCode); - - return _SystemHash.finish(hash); + void runBuild() { + final created = build(_$args); + final ref = this.ref as $Ref, SnChatMember?>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, SnChatMember?>, + AsyncValue, + Object?, + Object? + >; + element.handleValue(ref, created); } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin ChatRoomIdentityNotifierRef - on AutoDisposeAsyncNotifierProviderRef { - /// The parameter `identifier` of this provider. - String? get identifier; -} +@ProviderFor(chatroomInvites) +const chatroomInvitesProvider = ChatroomInvitesProvider._(); -class _ChatRoomIdentityNotifierProviderElement +final class ChatroomInvitesProvider extends - AutoDisposeAsyncNotifierProviderElement< - ChatRoomIdentityNotifier, - SnChatMember? + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> > - with ChatRoomIdentityNotifierRef { - _ChatRoomIdentityNotifierProviderElement(super.provider); + with + $FutureModifier>, + $FutureProvider> { + const ChatroomInvitesProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'chatroomInvitesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); @override - String? get identifier => - (origin as ChatRoomIdentityNotifierProvider).identifier; + String debugGetCreateSourceHash() => _$chatroomInvitesHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return chatroomInvites(ref); + } } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +String _$chatroomInvitesHash() => r'5cd6391b09c5517ede19bacce43b45c8d71dd087'; diff --git a/lib/pods/chat/chat_subscribe.dart b/lib/pods/chat/chat_subscribe.dart index 2e515bcf..4af7cbf4 100644 --- a/lib/pods/chat/chat_subscribe.dart +++ b/lib/pods/chat/chat_subscribe.dart @@ -12,7 +12,17 @@ import "package:riverpod_annotation/riverpod_annotation.dart"; part 'chat_subscribe.g.dart'; -final currentSubscribedChatIdProvider = StateProvider((ref) => null); +final currentSubscribedChatIdProvider = + NotifierProvider( + CurrentSubscribedChatIdNotifier.new, + ); + +class CurrentSubscribedChatIdNotifier extends Notifier { + @override + String? build() => null; + + void set(String? value) => state = value; +} @riverpod class ChatSubscribeNotifier extends _$ChatSubscribeNotifier { @@ -29,11 +39,9 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier { @override List build(String roomId) { final ws = ref.watch(websocketProvider); - final chatRoomAsync = ref.watch(ChatRoomNotifierProvider(roomId)); - final chatIdentityAsync = ref.watch( - ChatRoomIdentityNotifierProvider(roomId), - ); - _messagesNotifier = ref.watch(messagesNotifierProvider(roomId).notifier); + final chatRoomAsync = ref.watch(chatRoomProvider(roomId)); + final chatIdentityAsync = ref.watch(chatRoomIdentityProvider(roomId)); + _messagesNotifier = ref.watch(messagesProvider(roomId).notifier); if (chatRoomAsync.isLoading || chatIdentityAsync.isLoading) { return []; @@ -59,7 +67,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier { ); Future.microtask( - () => ref.read(currentSubscribedChatIdProvider.notifier).state = roomId, + () => ref.read(currentSubscribedChatIdProvider.notifier).set(roomId), ); // Send initial read receipt @@ -130,7 +138,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier { // Cleanup on dispose ref.onDispose(() { - ref.read(currentSubscribedChatIdProvider.notifier).state = null; + ref.read(currentSubscribedChatIdProvider.notifier).set(null); wsState.sendMessage( jsonEncode( WebSocketPacket( diff --git a/lib/pods/chat/chat_subscribe.g.dart b/lib/pods/chat/chat_subscribe.g.dart index 9df2595e..0f704c2d 100644 --- a/lib/pods/chat/chat_subscribe.g.dart +++ b/lib/pods/chat/chat_subscribe.g.dart @@ -6,171 +6,104 @@ part of 'chat_subscribe.dart'; // RiverpodGenerator // ************************************************************************** -String _$chatSubscribeNotifierHash() => - r'beec1ddf2e13f6d5af8a08c2c81eff740ae9b986'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -abstract class _$ChatSubscribeNotifier - extends BuildlessAutoDisposeNotifier> { - late final String roomId; - - List build(String roomId); -} - -/// See also [ChatSubscribeNotifier]. @ProviderFor(ChatSubscribeNotifier) -const chatSubscribeNotifierProvider = ChatSubscribeNotifierFamily(); +const chatSubscribeProvider = ChatSubscribeNotifierFamily._(); -/// See also [ChatSubscribeNotifier]. -class ChatSubscribeNotifierFamily extends Family> { - /// See also [ChatSubscribeNotifier]. - const ChatSubscribeNotifierFamily(); +final class ChatSubscribeNotifierProvider + extends $NotifierProvider> { + const ChatSubscribeNotifierProvider._({ + required ChatSubscribeNotifierFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'chatSubscribeProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [ChatSubscribeNotifier]. - ChatSubscribeNotifierProvider call(String roomId) { - return ChatSubscribeNotifierProvider(roomId); + @override + String debugGetCreateSourceHash() => _$chatSubscribeNotifierHash(); + + @override + String toString() { + return r'chatSubscribeProvider' + '' + '($argument)'; } + @$internal @override - ChatSubscribeNotifierProvider getProviderOverride( - covariant ChatSubscribeNotifierProvider provider, - ) { - return call(provider.roomId); - } + ChatSubscribeNotifier create() => ChatSubscribeNotifier(); - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'chatSubscribeNotifierProvider'; -} - -/// See also [ChatSubscribeNotifier]. -class ChatSubscribeNotifierProvider - extends - AutoDisposeNotifierProviderImpl< - ChatSubscribeNotifier, - List - > { - /// See also [ChatSubscribeNotifier]. - ChatSubscribeNotifierProvider(String roomId) - : this._internal( - () => ChatSubscribeNotifier()..roomId = roomId, - from: chatSubscribeNotifierProvider, - name: r'chatSubscribeNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$chatSubscribeNotifierHash, - dependencies: ChatSubscribeNotifierFamily._dependencies, - allTransitiveDependencies: - ChatSubscribeNotifierFamily._allTransitiveDependencies, - roomId: roomId, - ); - - ChatSubscribeNotifierProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.roomId, - }) : super.internal(); - - final String roomId; - - @override - List runNotifierBuild( - covariant ChatSubscribeNotifier notifier, - ) { - return notifier.build(roomId); - } - - @override - Override overrideWith(ChatSubscribeNotifier Function() create) { - return ProviderOverride( + /// {@macro riverpod.override_with_value} + Override overrideWithValue(List value) { + return $ProviderOverride( origin: this, - override: ChatSubscribeNotifierProvider._internal( - () => create()..roomId = roomId, - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - roomId: roomId, - ), + providerOverride: $SyncValueProvider>(value), ); } - @override - AutoDisposeNotifierProviderElement> - createElement() { - return _ChatSubscribeNotifierProviderElement(this); - } - @override bool operator ==(Object other) { - return other is ChatSubscribeNotifierProvider && other.roomId == roomId; + return other is ChatSubscribeNotifierProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, roomId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin ChatSubscribeNotifierRef - on AutoDisposeNotifierProviderRef> { - /// The parameter `roomId` of this provider. - String get roomId; -} +String _$chatSubscribeNotifierHash() => + r'2b9fae96eb1f96a514a074985e5efa1c13d10aa4'; -class _ChatSubscribeNotifierProviderElement - extends - AutoDisposeNotifierProviderElement< +final class ChatSubscribeNotifierFamily extends $Family + with + $ClassFamilyOverride< ChatSubscribeNotifier, - List - > - with ChatSubscribeNotifierRef { - _ChatSubscribeNotifierProviderElement(super.provider); + List, + List, + List, + String + > { + const ChatSubscribeNotifierFamily._() + : super( + retry: null, + name: r'chatSubscribeProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + ChatSubscribeNotifierProvider call(String roomId) => + ChatSubscribeNotifierProvider._(argument: roomId, from: this); @override - String get roomId => (origin as ChatSubscribeNotifierProvider).roomId; + String toString() => r'chatSubscribeProvider'; } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$ChatSubscribeNotifier extends $Notifier> { + late final _$args = ref.$arg as String; + String get roomId => _$args; + + List build(String roomId); + @$mustCallSuper + @override + void runBuild() { + final created = build(_$args); + final ref = this.ref as $Ref, List>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, List>, + List, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/pods/chat/chat_summary.dart b/lib/pods/chat/chat_summary.dart index 53d6cbe7..b70c0031 100644 --- a/lib/pods/chat/chat_summary.dart +++ b/lib/pods/chat/chat_summary.dart @@ -99,7 +99,7 @@ class ChatSummary extends _$ChatSummary { final unreadToDecrement = summary.unreadCount; if (unreadToDecrement > 0) { ref - .read(chatUnreadCountNotifierProvider.notifier) + .read(chatUnreadCountProvider.notifier) .decrement(unreadToDecrement); } diff --git a/lib/pods/chat/chat_summary.g.dart b/lib/pods/chat/chat_summary.g.dart index 0dce026c..4e44284f 100644 --- a/lib/pods/chat/chat_summary.g.dart +++ b/lib/pods/chat/chat_summary.g.dart @@ -6,40 +6,105 @@ part of 'chat_summary.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(ChatUnreadCountNotifier) +const chatUnreadCountProvider = ChatUnreadCountNotifierProvider._(); + +final class ChatUnreadCountNotifierProvider + extends $AsyncNotifierProvider { + const ChatUnreadCountNotifierProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'chatUnreadCountProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$chatUnreadCountNotifierHash(); + + @$internal + @override + ChatUnreadCountNotifier create() => ChatUnreadCountNotifier(); +} + String _$chatUnreadCountNotifierHash() => r'b8d93589dc37f772d4c3a07d9afd81c37026e57d'; -/// See also [ChatUnreadCountNotifier]. -@ProviderFor(ChatUnreadCountNotifier) -final chatUnreadCountNotifierProvider = - AutoDisposeAsyncNotifierProvider.internal( - ChatUnreadCountNotifier.new, - name: r'chatUnreadCountNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$chatUnreadCountNotifierHash, - dependencies: null, - allTransitiveDependencies: null, - ); +abstract class _$ChatUnreadCountNotifier extends $AsyncNotifier { + FutureOr build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = this.ref as $Ref, int>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, int>, + AsyncValue, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} -typedef _$ChatUnreadCountNotifier = AutoDisposeAsyncNotifier; -String _$chatSummaryHash() => r'78d927d40cded9d7adbc20bd6f457fdf3c852632'; - -/// See also [ChatSummary]. @ProviderFor(ChatSummary) -final chatSummaryProvider = - AsyncNotifierProvider>.internal( - ChatSummary.new, - name: r'chatSummaryProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$chatSummaryHash, - dependencies: null, - allTransitiveDependencies: null, - ); +const chatSummaryProvider = ChatSummaryProvider._(); -typedef _$ChatSummary = AsyncNotifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class ChatSummaryProvider + extends $AsyncNotifierProvider> { + const ChatSummaryProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'chatSummaryProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$chatSummaryHash(); + + @$internal + @override + ChatSummary create() => ChatSummary(); +} + +String _$chatSummaryHash() => r'dfa5e487586482ebdafef8d711f74db68ee86f84'; + +abstract class _$ChatSummary + extends $AsyncNotifier> { + FutureOr> build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = + this.ref + as $Ref< + AsyncValue>, + Map + >; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier< + AsyncValue>, + Map + >, + AsyncValue>, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/pods/chat/messages_notifier.dart b/lib/pods/chat/messages_notifier.dart index 8b70ee3a..595bf620 100644 --- a/lib/pods/chat/messages_notifier.dart +++ b/lib/pods/chat/messages_notifier.dart @@ -52,10 +52,8 @@ class MessagesNotifier extends _$MessagesNotifier { FutureOr> build(String roomId) async { _apiClient = ref.watch(apiClientProvider); _database = ref.watch(databaseProvider); - final room = await ref.watch(ChatRoomNotifierProvider(roomId).future); - final identity = await ref.watch( - ChatRoomIdentityNotifierProvider(roomId).future, - ); + final room = await ref.watch(chatRoomProvider(roomId).future); + final identity = await ref.watch(chatRoomIdentityProvider(roomId).future); // Initialize fetch account method for corrupted data recovery _fetchAccount = (String accountId) async { @@ -321,7 +319,7 @@ class MessagesNotifier extends _$MessagesNotifier { _allRemoteMessagesFetched = false; talker.log('Starting message sync'); - Future.microtask(() => ref.read(isSyncingProvider.notifier).state = true); + Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true)); try { final dbMessages = await _database.getMessagesForRoom( _room.id, @@ -397,9 +395,7 @@ class MessagesNotifier extends _$MessagesNotifier { showErrorAlert(err); } finally { talker.log('Finished message sync'); - Future.microtask( - () => ref.read(isSyncingProvider.notifier).state = false, - ); + Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false)); _isSyncing = false; } } @@ -496,7 +492,7 @@ class MessagesNotifier extends _$MessagesNotifier { if (!_hasMore || state is AsyncLoading) return; talker.log('Loading more messages'); - Future.microtask(() => ref.read(isSyncingProvider.notifier).state = true); + Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true)); try { final currentMessages = state.value ?? []; final offset = currentMessages.length; @@ -519,9 +515,7 @@ class MessagesNotifier extends _$MessagesNotifier { ); showErrorAlert(err); } finally { - Future.microtask( - () => ref.read(isSyncingProvider.notifier).state = false, - ); + Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false)); } } diff --git a/lib/pods/chat/messages_notifier.g.dart b/lib/pods/chat/messages_notifier.g.dart index ce546970..6ba0d760 100644 --- a/lib/pods/chat/messages_notifier.g.dart +++ b/lib/pods/chat/messages_notifier.g.dart @@ -6,174 +6,101 @@ part of 'messages_notifier.dart'; // RiverpodGenerator // ************************************************************************** -String _$messagesNotifierHash() => r'd76d799494b06fac2adc42d94b7ecd7b8d68c352'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -abstract class _$MessagesNotifier - extends BuildlessAutoDisposeAsyncNotifier> { - late final String roomId; - - FutureOr> build(String roomId); -} - -/// See also [MessagesNotifier]. @ProviderFor(MessagesNotifier) -const messagesNotifierProvider = MessagesNotifierFamily(); +const messagesProvider = MessagesNotifierFamily._(); -/// See also [MessagesNotifier]. -class MessagesNotifierFamily - extends Family>> { - /// See also [MessagesNotifier]. - const MessagesNotifierFamily(); +final class MessagesNotifierProvider + extends $AsyncNotifierProvider> { + const MessagesNotifierProvider._({ + required MessagesNotifierFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'messagesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [MessagesNotifier]. - MessagesNotifierProvider call(String roomId) { - return MessagesNotifierProvider(roomId); + @override + String debugGetCreateSourceHash() => _$messagesNotifierHash(); + + @override + String toString() { + return r'messagesProvider' + '' + '($argument)'; } + @$internal @override - MessagesNotifierProvider getProviderOverride( - covariant MessagesNotifierProvider provider, - ) { - return call(provider.roomId); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'messagesNotifierProvider'; -} - -/// See also [MessagesNotifier]. -class MessagesNotifierProvider - extends - AutoDisposeAsyncNotifierProviderImpl< - MessagesNotifier, - List - > { - /// See also [MessagesNotifier]. - MessagesNotifierProvider(String roomId) - : this._internal( - () => MessagesNotifier()..roomId = roomId, - from: messagesNotifierProvider, - name: r'messagesNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$messagesNotifierHash, - dependencies: MessagesNotifierFamily._dependencies, - allTransitiveDependencies: - MessagesNotifierFamily._allTransitiveDependencies, - roomId: roomId, - ); - - MessagesNotifierProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.roomId, - }) : super.internal(); - - final String roomId; - - @override - FutureOr> runNotifierBuild( - covariant MessagesNotifier notifier, - ) { - return notifier.build(roomId); - } - - @override - Override overrideWith(MessagesNotifier Function() create) { - return ProviderOverride( - origin: this, - override: MessagesNotifierProvider._internal( - () => create()..roomId = roomId, - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - roomId: roomId, - ), - ); - } - - @override - AutoDisposeAsyncNotifierProviderElement< - MessagesNotifier, - List - > - createElement() { - return _MessagesNotifierProviderElement(this); - } + MessagesNotifier create() => MessagesNotifier(); @override bool operator ==(Object other) { - return other is MessagesNotifierProvider && other.roomId == roomId; + return other is MessagesNotifierProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, roomId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin MessagesNotifierRef - on AutoDisposeAsyncNotifierProviderRef> { - /// The parameter `roomId` of this provider. - String get roomId; -} +String _$messagesNotifierHash() => r'2f3f19cb99357184e82d66e74a31863fcfc48856'; -class _MessagesNotifierProviderElement - extends - AutoDisposeAsyncNotifierProviderElement< +final class MessagesNotifierFamily extends $Family + with + $ClassFamilyOverride< MessagesNotifier, - List - > - with MessagesNotifierRef { - _MessagesNotifierProviderElement(super.provider); + AsyncValue>, + List, + FutureOr>, + String + > { + const MessagesNotifierFamily._() + : super( + retry: null, + name: r'messagesProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + MessagesNotifierProvider call(String roomId) => + MessagesNotifierProvider._(argument: roomId, from: this); @override - String get roomId => (origin as MessagesNotifierProvider).roomId; + String toString() => r'messagesProvider'; } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$MessagesNotifier + extends $AsyncNotifier> { + late final _$args = ref.$arg as String; + String get roomId => _$args; + + FutureOr> build(String roomId); + @$mustCallSuper + @override + void runBuild() { + final created = build(_$args); + final ref = + this.ref + as $Ref>, List>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier< + AsyncValue>, + List + >, + AsyncValue>, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/pods/config.dart b/lib/pods/config.dart index dd0c9297..1348d0dc 100644 --- a/lib/pods/config.dart +++ b/lib/pods/config.dart @@ -294,12 +294,15 @@ class AppSettingsNotifier extends _$AppSettingsNotifier { } final updateInfoProvider = - StateNotifierProvider((ref) { - return UpdateInfoNotifier(); - }); + NotifierProvider( + UpdateInfoNotifier.new, + ); -class UpdateInfoNotifier extends StateNotifier<(String?, String?)> { - UpdateInfoNotifier() : super((null, null)); +class UpdateInfoNotifier extends Notifier<(String?, String?)> { + @override + (String?, String?) build() { + return (null, null); + } void setUpdate(String newVersion, String newChangelog) { state = (newVersion, newChangelog); diff --git a/lib/pods/config.g.dart b/lib/pods/config.g.dart index b0447904..3fb10d15 100644 --- a/lib/pods/config.g.dart +++ b/lib/pods/config.g.dart @@ -29,23 +29,59 @@ Map _$ThemeColorsToJson(_ThemeColors instance) => // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(AppSettingsNotifier) +const appSettingsProvider = AppSettingsNotifierProvider._(); + +final class AppSettingsNotifierProvider + extends $NotifierProvider { + const AppSettingsNotifierProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'appSettingsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$appSettingsNotifierHash(); + + @$internal + @override + AppSettingsNotifier create() => AppSettingsNotifier(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(AppSettings value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + String _$appSettingsNotifierHash() => r'22b695f2023e3251db3296858acd701f7211d757'; -/// See also [AppSettingsNotifier]. -@ProviderFor(AppSettingsNotifier) -final appSettingsNotifierProvider = - AutoDisposeNotifierProvider.internal( - AppSettingsNotifier.new, - name: r'appSettingsNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$appSettingsNotifierHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -typedef _$AppSettingsNotifier = AutoDisposeNotifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$AppSettingsNotifier extends $Notifier { + AppSettings build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = this.ref as $Ref; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, + AppSettings, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/pods/event_calendar.dart b/lib/pods/event_calendar.dart index dba89aa5..1006ad5f 100644 --- a/lib/pods/event_calendar.dart +++ b/lib/pods/event_calendar.dart @@ -1,4 +1,3 @@ -import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:island/models/activity.dart'; import 'package:island/pods/network.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; diff --git a/lib/pods/event_calendar.g.dart b/lib/pods/event_calendar.g.dart index d48c1f13..d40b8b6b 100644 --- a/lib/pods/event_calendar.g.dart +++ b/lib/pods/event_calendar.g.dart @@ -6,169 +6,99 @@ part of 'event_calendar.dart'; // RiverpodGenerator // ************************************************************************** -String _$eventCalendarHash() => r'3a33581c28bcd44bc5eb3abdb770171b4d275a5d'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning /// Provider for fetching event calendar data /// This can be used anywhere in the app where calendar data is needed -/// -/// Copied from [eventCalendar]. + @ProviderFor(eventCalendar) -const eventCalendarProvider = EventCalendarFamily(); +const eventCalendarProvider = EventCalendarFamily._(); /// Provider for fetching event calendar data /// This can be used anywhere in the app where calendar data is needed -/// -/// Copied from [eventCalendar]. -class EventCalendarFamily - extends Family>> { + +final class EventCalendarProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { /// Provider for fetching event calendar data /// This can be used anywhere in the app where calendar data is needed - /// - /// Copied from [eventCalendar]. - const EventCalendarFamily(); + const EventCalendarProvider._({ + required EventCalendarFamily super.from, + required EventCalendarQuery super.argument, + }) : super( + retry: null, + name: r'eventCalendarProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// Provider for fetching event calendar data - /// This can be used anywhere in the app where calendar data is needed - /// - /// Copied from [eventCalendar]. - EventCalendarProvider call(EventCalendarQuery query) { - return EventCalendarProvider(query); + @override + String debugGetCreateSourceHash() => _$eventCalendarHash(); + + @override + String toString() { + return r'eventCalendarProvider' + '' + '($argument)'; } + @$internal @override - EventCalendarProvider getProviderOverride( - covariant EventCalendarProvider provider, - ) { - return call(provider.query); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'eventCalendarProvider'; -} - -/// Provider for fetching event calendar data -/// This can be used anywhere in the app where calendar data is needed -/// -/// Copied from [eventCalendar]. -class EventCalendarProvider - extends AutoDisposeFutureProvider> { - /// Provider for fetching event calendar data - /// This can be used anywhere in the app where calendar data is needed - /// - /// Copied from [eventCalendar]. - EventCalendarProvider(EventCalendarQuery query) - : this._internal( - (ref) => eventCalendar(ref as EventCalendarRef, query), - from: eventCalendarProvider, - name: r'eventCalendarProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$eventCalendarHash, - dependencies: EventCalendarFamily._dependencies, - allTransitiveDependencies: - EventCalendarFamily._allTransitiveDependencies, - query: query, - ); - - EventCalendarProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.query, - }) : super.internal(); - - final EventCalendarQuery query; - - @override - Override overrideWith( - FutureOr> Function(EventCalendarRef provider) - create, - ) { - return ProviderOverride( - origin: this, - override: EventCalendarProvider._internal( - (ref) => create(ref as EventCalendarRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - query: query, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _EventCalendarProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as EventCalendarQuery; + return eventCalendar(ref, argument); } @override bool operator ==(Object other) { - return other is EventCalendarProvider && other.query == query; + return other is EventCalendarProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, query.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin EventCalendarRef - on AutoDisposeFutureProviderRef> { - /// The parameter `query` of this provider. - EventCalendarQuery get query; -} +String _$eventCalendarHash() => r'3a33581c28bcd44bc5eb3abdb770171b4d275a5d'; -class _EventCalendarProviderElement - extends AutoDisposeFutureProviderElement> - with EventCalendarRef { - _EventCalendarProviderElement(super.provider); +/// Provider for fetching event calendar data +/// This can be used anywhere in the app where calendar data is needed + +final class EventCalendarFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + EventCalendarQuery + > { + const EventCalendarFamily._() + : super( + retry: null, + name: r'eventCalendarProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + /// Provider for fetching event calendar data + /// This can be used anywhere in the app where calendar data is needed + + EventCalendarProvider call(EventCalendarQuery query) => + EventCalendarProvider._(argument: query, from: this); @override - EventCalendarQuery get query => (origin as EventCalendarProvider).query; + String toString() => r'eventCalendarProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/pods/file_list.dart b/lib/pods/file_list.dart index b2d4fce6..5348c8ea 100644 --- a/lib/pods/file_list.dart +++ b/lib/pods/file_list.dart @@ -14,7 +14,7 @@ Future?> billingUsage(Ref ref) async { return response.data; } -final indexedCloudFileListNotifierProvider = AsyncNotifierProvider( +final indexedCloudFileListProvider = AsyncNotifierProvider( IndexedCloudFileListNotifier.new, ); @@ -92,7 +92,7 @@ class IndexedCloudFileListNotifier extends AsyncNotifier> } } -final unindexedFileListNotifierProvider = AsyncNotifierProvider( +final unindexedFileListProvider = AsyncNotifierProvider( UnindexedFileListNotifier.new, ); diff --git a/lib/pods/file_list.g.dart b/lib/pods/file_list.g.dart index 5285d3c8..7bcf9e10 100644 --- a/lib/pods/file_list.g.dart +++ b/lib/pods/file_list.g.dart @@ -6,43 +6,87 @@ part of 'file_list.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(billingUsage) +const billingUsageProvider = BillingUsageProvider._(); + +final class BillingUsageProvider + extends + $FunctionalProvider< + AsyncValue?>, + Map?, + FutureOr?> + > + with + $FutureModifier?>, + $FutureProvider?> { + const BillingUsageProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'billingUsageProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$billingUsageHash(); + + @$internal + @override + $FutureProviderElement?> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr?> create(Ref ref) { + return billingUsage(ref); + } +} + String _$billingUsageHash() => r'58d8bc774868d60781574c85d6b25869a79c57aa'; -/// See also [billingUsage]. -@ProviderFor(billingUsage) -final billingUsageProvider = - AutoDisposeFutureProvider?>.internal( - billingUsage, - name: r'billingUsageProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$billingUsageHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef BillingUsageRef = AutoDisposeFutureProviderRef?>; -String _$billingQuotaHash() => r'4ec5d728e439015800abb2d0d673b5a7329cc654'; - -/// See also [billingQuota]. @ProviderFor(billingQuota) -final billingQuotaProvider = - AutoDisposeFutureProvider?>.internal( - billingQuota, - name: r'billingQuotaProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$billingQuotaHash, - dependencies: null, - allTransitiveDependencies: null, - ); +const billingQuotaProvider = BillingQuotaProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef BillingQuotaRef = AutoDisposeFutureProviderRef?>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class BillingQuotaProvider + extends + $FunctionalProvider< + AsyncValue?>, + Map?, + FutureOr?> + > + with + $FutureModifier?>, + $FutureProvider?> { + const BillingQuotaProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'billingQuotaProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$billingQuotaHash(); + + @$internal + @override + $FutureProviderElement?> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr?> create(Ref ref) { + return billingQuota(ref); + } +} + +String _$billingQuotaHash() => r'4ec5d728e439015800abb2d0d673b5a7329cc654'; diff --git a/lib/pods/file_pool.dart b/lib/pods/file_pool.dart index 84cb111e..d1beeea6 100644 --- a/lib/pods/file_pool.dart +++ b/lib/pods/file_pool.dart @@ -13,7 +13,7 @@ final poolsProvider = FutureProvider>((ref) async { }); String? resolveDefaultPoolId(WidgetRef ref, List pools) { - final settings = ref.watch(appSettingsNotifierProvider); + final settings = ref.watch(appSettingsProvider); final configuredId = settings.defaultPoolId; if (configuredId != null && pools.any((p) => p.id == configuredId)) { diff --git a/lib/pods/file_references.dart b/lib/pods/file_references.dart index 480dbc0a..f1bc5830 100644 --- a/lib/pods/file_references.dart +++ b/lib/pods/file_references.dart @@ -1,4 +1,3 @@ -import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:island/models/reference.dart'; import 'package:island/pods/network.dart'; diff --git a/lib/pods/file_references.g.dart b/lib/pods/file_references.g.dart index 03a4d059..b6cd8cf6 100644 --- a/lib/pods/file_references.g.dart +++ b/lib/pods/file_references.g.dart @@ -6,148 +6,80 @@ part of 'file_references.dart'; // RiverpodGenerator // ************************************************************************** -String _$fileReferencesHash() => r'd66c678c221f61978bdb242b98e6dbe31d0c204b'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [fileReferences]. @ProviderFor(fileReferences) -const fileReferencesProvider = FileReferencesFamily(); +const fileReferencesProvider = FileReferencesFamily._(); -/// See also [fileReferences]. -class FileReferencesFamily extends Family>> { - /// See also [fileReferences]. - const FileReferencesFamily(); +final class FileReferencesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + const FileReferencesProvider._({ + required FileReferencesFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'fileReferencesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [fileReferences]. - FileReferencesProvider call(String fileId) { - return FileReferencesProvider(fileId); + @override + String debugGetCreateSourceHash() => _$fileReferencesHash(); + + @override + String toString() { + return r'fileReferencesProvider' + '' + '($argument)'; } + @$internal @override - FileReferencesProvider getProviderOverride( - covariant FileReferencesProvider provider, - ) { - return call(provider.fileId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'fileReferencesProvider'; -} - -/// See also [fileReferences]. -class FileReferencesProvider - extends AutoDisposeFutureProvider> { - /// See also [fileReferences]. - FileReferencesProvider(String fileId) - : this._internal( - (ref) => fileReferences(ref as FileReferencesRef, fileId), - from: fileReferencesProvider, - name: r'fileReferencesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$fileReferencesHash, - dependencies: FileReferencesFamily._dependencies, - allTransitiveDependencies: - FileReferencesFamily._allTransitiveDependencies, - fileId: fileId, - ); - - FileReferencesProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.fileId, - }) : super.internal(); - - final String fileId; - - @override - Override overrideWith( - FutureOr> Function(FileReferencesRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: FileReferencesProvider._internal( - (ref) => create(ref as FileReferencesRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - fileId: fileId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _FileReferencesProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return fileReferences(ref, argument); } @override bool operator ==(Object other) { - return other is FileReferencesProvider && other.fileId == fileId; + return other is FileReferencesProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, fileId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin FileReferencesRef on AutoDisposeFutureProviderRef> { - /// The parameter `fileId` of this provider. - String get fileId; -} +String _$fileReferencesHash() => r'd66c678c221f61978bdb242b98e6dbe31d0c204b'; -class _FileReferencesProviderElement - extends AutoDisposeFutureProviderElement> - with FileReferencesRef { - _FileReferencesProviderElement(super.provider); +final class FileReferencesFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const FileReferencesFamily._() + : super( + retry: null, + name: r'fileReferencesProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + FileReferencesProvider call(String fileId) => + FileReferencesProvider._(argument: fileId, from: this); @override - String get fileId => (origin as FileReferencesProvider).fileId; + String toString() => r'fileReferencesProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/pods/link_preview.g.dart b/lib/pods/link_preview.g.dart index fcee6334..074db0c0 100644 --- a/lib/pods/link_preview.g.dart +++ b/lib/pods/link_preview.g.dart @@ -6,159 +6,95 @@ part of 'link_preview.dart'; // RiverpodGenerator // ************************************************************************** -String _$linkPreviewHash() => r'5130593d3066155cb958d20714ee577df1f940d7'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -abstract class _$LinkPreview - extends BuildlessAutoDisposeAsyncNotifier { - late final String url; - - FutureOr build(String url); -} - -/// See also [LinkPreview]. @ProviderFor(LinkPreview) -const linkPreviewProvider = LinkPreviewFamily(); +const linkPreviewProvider = LinkPreviewFamily._(); -/// See also [LinkPreview]. -class LinkPreviewFamily extends Family> { - /// See also [LinkPreview]. - const LinkPreviewFamily(); +final class LinkPreviewProvider + extends $AsyncNotifierProvider { + const LinkPreviewProvider._({ + required LinkPreviewFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'linkPreviewProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [LinkPreview]. - LinkPreviewProvider call(String url) { - return LinkPreviewProvider(url); + @override + String debugGetCreateSourceHash() => _$linkPreviewHash(); + + @override + String toString() { + return r'linkPreviewProvider' + '' + '($argument)'; } + @$internal @override - LinkPreviewProvider getProviderOverride( - covariant LinkPreviewProvider provider, - ) { - return call(provider.url); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'linkPreviewProvider'; -} - -/// See also [LinkPreview]. -class LinkPreviewProvider - extends AutoDisposeAsyncNotifierProviderImpl { - /// See also [LinkPreview]. - LinkPreviewProvider(String url) - : this._internal( - () => LinkPreview()..url = url, - from: linkPreviewProvider, - name: r'linkPreviewProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$linkPreviewHash, - dependencies: LinkPreviewFamily._dependencies, - allTransitiveDependencies: LinkPreviewFamily._allTransitiveDependencies, - url: url, - ); - - LinkPreviewProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.url, - }) : super.internal(); - - final String url; - - @override - FutureOr runNotifierBuild(covariant LinkPreview notifier) { - return notifier.build(url); - } - - @override - Override overrideWith(LinkPreview Function() create) { - return ProviderOverride( - origin: this, - override: LinkPreviewProvider._internal( - () => create()..url = url, - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - url: url, - ), - ); - } - - @override - AutoDisposeAsyncNotifierProviderElement - createElement() { - return _LinkPreviewProviderElement(this); - } + LinkPreview create() => LinkPreview(); @override bool operator ==(Object other) { - return other is LinkPreviewProvider && other.url == url; + return other is LinkPreviewProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, url.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin LinkPreviewRef on AutoDisposeAsyncNotifierProviderRef { - /// The parameter `url` of this provider. - String get url; -} +String _$linkPreviewHash() => r'5130593d3066155cb958d20714ee577df1f940d7'; -class _LinkPreviewProviderElement - extends - AutoDisposeAsyncNotifierProviderElement - with LinkPreviewRef { - _LinkPreviewProviderElement(super.provider); +final class LinkPreviewFamily extends $Family + with + $ClassFamilyOverride< + LinkPreview, + AsyncValue, + SnScrappedLink?, + FutureOr, + String + > { + const LinkPreviewFamily._() + : super( + retry: null, + name: r'linkPreviewProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + LinkPreviewProvider call(String url) => + LinkPreviewProvider._(argument: url, from: this); @override - String get url => (origin as LinkPreviewProvider).url; + String toString() => r'linkPreviewProvider'; } -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$LinkPreview extends $AsyncNotifier { + late final _$args = ref.$arg as String; + String get url => _$args; + + FutureOr build(String url); + @$mustCallSuper + @override + void runBuild() { + final created = build(_$args); + final ref = this.ref as $Ref, SnScrappedLink?>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, SnScrappedLink?>, + AsyncValue, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/pods/paging.dart b/lib/pods/paging.dart index 4c779332..eb6ea371 100644 --- a/lib/pods/paging.dart +++ b/lib/pods/paging.dart @@ -54,89 +54,7 @@ mixin AsyncPaginationController on AsyncNotifier> final newState = await AsyncValue.guard>(() async { final elements = await fetch(); - return [...?state.valueOrNull, ...elements]; - }); - - state = newState; - } -} - -mixin AutoDisposeAsyncPaginationController - on AutoDisposeAsyncNotifier> - implements PaginationController { - @override - int? totalCount; - - @override - int get fetchedCount => state.value?.length ?? 0; - - @override - bool get fetchedAll => totalCount != null && fetchedCount >= totalCount!; - - @override - FutureOr> build() async => fetch(); - - @override - Future refresh() async { - totalCount = null; - state = AsyncData>([]); - - final newState = await AsyncValue.guard>(() async { - return await fetch(); - }); - state = newState; - } - - @override - Future fetchFurther() async { - if (fetchedAll) return; - - state = AsyncLoading>(); - - final newState = await AsyncValue.guard>(() async { - final elements = await fetch(); - return [...?state.valueOrNull, ...elements]; - }); - - state = newState; - } -} - -mixin FamilyAsyncPaginationController - on AutoDisposeFamilyAsyncNotifier, Arg> - implements PaginationController { - @override - int? totalCount; - - @override - int get fetchedCount => state.value?.length ?? 0; - - @override - bool get fetchedAll => totalCount != null && fetchedCount >= totalCount!; - - @override - FutureOr> build(Arg arg) async => fetch(); - - @override - Future refresh() async { - totalCount = null; - state = AsyncData>([]); - - final newState = await AsyncValue.guard>(() async { - return await fetch(); - }); - state = newState; - } - - @override - Future fetchFurther() async { - if (fetchedAll) return; - - state = AsyncLoading>(); - - final newState = await AsyncValue.guard>(() async { - final elements = await fetch(); - return [...?state.valueOrNull, ...elements]; + return [...?state.value, ...elements]; }); state = newState; diff --git a/lib/pods/site_files.dart b/lib/pods/site_files.dart index 41bcbba0..bf389cb7 100644 --- a/lib/pods/site_files.dart +++ b/lib/pods/site_files.dart @@ -55,16 +55,12 @@ Future siteFileContentRaw( return resp.data is String ? resp.data : resp.data['content'] as String; } -class SiteFilesNotifier - extends - AutoDisposeFamilyAsyncNotifier< - List, - ({String siteId, String? path}) - > { +class SiteFilesNotifier extends AsyncNotifier> { + final ({String siteId, String? path}) arg; + SiteFilesNotifier(this.arg); + @override - Future> build( - ({String siteId, String? path}) arg, - ) async { + Future> build() async { return fetchFiles(); } @@ -152,8 +148,6 @@ class SiteFilesNotifier } } -final siteFilesNotifierProvider = AsyncNotifierProvider.autoDispose.family< - SiteFilesNotifier, - List, - ({String siteId, String? path}) ->(SiteFilesNotifier.new); +final siteFilesNotifierProvider = AsyncNotifierProvider.autoDispose.family( + SiteFilesNotifier.new, +); diff --git a/lib/pods/site_files.g.dart b/lib/pods/site_files.g.dart index dc1cff83..08245a15 100644 --- a/lib/pods/site_files.g.dart +++ b/lib/pods/site_files.g.dart @@ -6,446 +6,257 @@ part of 'site_files.dart'; // RiverpodGenerator // ************************************************************************** -String _$siteFilesHash() => r'd4029e6c160edcd454eb39ef1c19427b7f95a8d8'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [siteFiles]. @ProviderFor(siteFiles) -const siteFilesProvider = SiteFilesFamily(); +const siteFilesProvider = SiteFilesFamily._(); -/// See also [siteFiles]. -class SiteFilesFamily extends Family>> { - /// See also [siteFiles]. - const SiteFilesFamily(); +final class SiteFilesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const SiteFilesProvider._({ + required SiteFilesFamily super.from, + required ({String siteId, String? path}) super.argument, + }) : super( + retry: null, + name: r'siteFilesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [siteFiles]. - SiteFilesProvider call({required String siteId, String? path}) { - return SiteFilesProvider(siteId: siteId, path: path); + @override + String debugGetCreateSourceHash() => _$siteFilesHash(); + + @override + String toString() { + return r'siteFilesProvider' + '' + '$argument'; } + @$internal @override - SiteFilesProvider getProviderOverride(covariant SiteFilesProvider provider) { - return call(siteId: provider.siteId, path: provider.path); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'siteFilesProvider'; -} - -/// See also [siteFiles]. -class SiteFilesProvider - extends AutoDisposeFutureProvider> { - /// See also [siteFiles]. - SiteFilesProvider({required String siteId, String? path}) - : this._internal( - (ref) => siteFiles(ref as SiteFilesRef, siteId: siteId, path: path), - from: siteFilesProvider, - name: r'siteFilesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$siteFilesHash, - dependencies: SiteFilesFamily._dependencies, - allTransitiveDependencies: SiteFilesFamily._allTransitiveDependencies, - siteId: siteId, - path: path, - ); - - SiteFilesProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.siteId, - required this.path, - }) : super.internal(); - - final String siteId; - final String? path; - - @override - Override overrideWith( - FutureOr> Function(SiteFilesRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: SiteFilesProvider._internal( - (ref) => create(ref as SiteFilesRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - siteId: siteId, - path: path, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _SiteFilesProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as ({String siteId, String? path}); + return siteFiles(ref, siteId: argument.siteId, path: argument.path); } @override bool operator ==(Object other) { - return other is SiteFilesProvider && - other.siteId == siteId && - other.path == path; + return other is SiteFilesProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, siteId.hashCode); - hash = _SystemHash.combine(hash, path.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin SiteFilesRef on AutoDisposeFutureProviderRef> { - /// The parameter `siteId` of this provider. - String get siteId; +String _$siteFilesHash() => r'd4029e6c160edcd454eb39ef1c19427b7f95a8d8'; - /// The parameter `path` of this provider. - String? get path; +final class SiteFilesFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + ({String siteId, String? path}) + > { + const SiteFilesFamily._() + : super( + retry: null, + name: r'siteFilesProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + SiteFilesProvider call({required String siteId, String? path}) => + SiteFilesProvider._(argument: (siteId: siteId, path: path), from: this); + + @override + String toString() => r'siteFilesProvider'; } -class _SiteFilesProviderElement - extends AutoDisposeFutureProviderElement> - with SiteFilesRef { - _SiteFilesProviderElement(super.provider); +@ProviderFor(siteFileContent) +const siteFileContentProvider = SiteFileContentFamily._(); + +final class SiteFileContentProvider + extends + $FunctionalProvider< + AsyncValue, + SnFileContent, + FutureOr + > + with $FutureModifier, $FutureProvider { + const SiteFileContentProvider._({ + required SiteFileContentFamily super.from, + required ({String siteId, String relativePath}) super.argument, + }) : super( + retry: null, + name: r'siteFileContentProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); @override - String get siteId => (origin as SiteFilesProvider).siteId; + String debugGetCreateSourceHash() => _$siteFileContentHash(); + @override - String? get path => (origin as SiteFilesProvider).path; + String toString() { + return r'siteFileContentProvider' + '' + '$argument'; + } + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as ({String siteId, String relativePath}); + return siteFileContent( + ref, + siteId: argument.siteId, + relativePath: argument.relativePath, + ); + } + + @override + bool operator ==(Object other) { + return other is SiteFileContentProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$siteFileContentHash() => r'b594ad4f8c54555e742ece94ee001092cb2f83d1'; -/// See also [siteFileContent]. -@ProviderFor(siteFileContent) -const siteFileContentProvider = SiteFileContentFamily(); +final class SiteFileContentFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + ({String siteId, String relativePath}) + > { + const SiteFileContentFamily._() + : super( + retry: null, + name: r'siteFileContentProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); -/// See also [siteFileContent]. -class SiteFileContentFamily extends Family> { - /// See also [siteFileContent]. - const SiteFileContentFamily(); - - /// See also [siteFileContent]. SiteFileContentProvider call({ required String siteId, required String relativePath, - }) { - return SiteFileContentProvider(siteId: siteId, relativePath: relativePath); - } + }) => SiteFileContentProvider._( + argument: (siteId: siteId, relativePath: relativePath), + from: this, + ); @override - SiteFileContentProvider getProviderOverride( - covariant SiteFileContentProvider provider, - ) { - return call(siteId: provider.siteId, relativePath: provider.relativePath); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'siteFileContentProvider'; + String toString() => r'siteFileContentProvider'; } -/// See also [siteFileContent]. -class SiteFileContentProvider extends AutoDisposeFutureProvider { - /// See also [siteFileContent]. - SiteFileContentProvider({ - required String siteId, - required String relativePath, - }) : this._internal( - (ref) => siteFileContent( - ref as SiteFileContentRef, - siteId: siteId, - relativePath: relativePath, - ), - from: siteFileContentProvider, - name: r'siteFileContentProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$siteFileContentHash, - dependencies: SiteFileContentFamily._dependencies, - allTransitiveDependencies: - SiteFileContentFamily._allTransitiveDependencies, - siteId: siteId, - relativePath: relativePath, +@ProviderFor(siteFileContentRaw) +const siteFileContentRawProvider = SiteFileContentRawFamily._(); + +final class SiteFileContentRawProvider + extends $FunctionalProvider, String, FutureOr> + with $FutureModifier, $FutureProvider { + const SiteFileContentRawProvider._({ + required SiteFileContentRawFamily super.from, + required ({String siteId, String relativePath}) super.argument, + }) : super( + retry: null, + name: r'siteFileContentRawProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, ); - SiteFileContentProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.siteId, - required this.relativePath, - }) : super.internal(); - - final String siteId; - final String relativePath; + @override + String debugGetCreateSourceHash() => _$siteFileContentRawHash(); @override - Override overrideWith( - FutureOr Function(SiteFileContentRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: SiteFileContentProvider._internal( - (ref) => create(ref as SiteFileContentRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - siteId: siteId, - relativePath: relativePath, - ), + String toString() { + return r'siteFileContentRawProvider' + '' + '$argument'; + } + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as ({String siteId, String relativePath}); + return siteFileContentRaw( + ref, + siteId: argument.siteId, + relativePath: argument.relativePath, ); } - @override - AutoDisposeFutureProviderElement createElement() { - return _SiteFileContentProviderElement(this); - } - @override bool operator ==(Object other) { - return other is SiteFileContentProvider && - other.siteId == siteId && - other.relativePath == relativePath; + return other is SiteFileContentRawProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, siteId.hashCode); - hash = _SystemHash.combine(hash, relativePath.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin SiteFileContentRef on AutoDisposeFutureProviderRef { - /// The parameter `siteId` of this provider. - String get siteId; - - /// The parameter `relativePath` of this provider. - String get relativePath; -} - -class _SiteFileContentProviderElement - extends AutoDisposeFutureProviderElement - with SiteFileContentRef { - _SiteFileContentProviderElement(super.provider); - - @override - String get siteId => (origin as SiteFileContentProvider).siteId; - @override - String get relativePath => (origin as SiteFileContentProvider).relativePath; -} - String _$siteFileContentRawHash() => r'd0331c30698a9f4b90fe9b79273ff5914fa46616'; -/// See also [siteFileContentRaw]. -@ProviderFor(siteFileContentRaw) -const siteFileContentRawProvider = SiteFileContentRawFamily(); +final class SiteFileContentRawFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + ({String siteId, String relativePath}) + > { + const SiteFileContentRawFamily._() + : super( + retry: null, + name: r'siteFileContentRawProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); -/// See also [siteFileContentRaw]. -class SiteFileContentRawFamily extends Family> { - /// See also [siteFileContentRaw]. - const SiteFileContentRawFamily(); - - /// See also [siteFileContentRaw]. SiteFileContentRawProvider call({ required String siteId, required String relativePath, - }) { - return SiteFileContentRawProvider( - siteId: siteId, - relativePath: relativePath, - ); - } + }) => SiteFileContentRawProvider._( + argument: (siteId: siteId, relativePath: relativePath), + from: this, + ); @override - SiteFileContentRawProvider getProviderOverride( - covariant SiteFileContentRawProvider provider, - ) { - return call(siteId: provider.siteId, relativePath: provider.relativePath); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'siteFileContentRawProvider'; + String toString() => r'siteFileContentRawProvider'; } - -/// See also [siteFileContentRaw]. -class SiteFileContentRawProvider extends AutoDisposeFutureProvider { - /// See also [siteFileContentRaw]. - SiteFileContentRawProvider({ - required String siteId, - required String relativePath, - }) : this._internal( - (ref) => siteFileContentRaw( - ref as SiteFileContentRawRef, - siteId: siteId, - relativePath: relativePath, - ), - from: siteFileContentRawProvider, - name: r'siteFileContentRawProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$siteFileContentRawHash, - dependencies: SiteFileContentRawFamily._dependencies, - allTransitiveDependencies: - SiteFileContentRawFamily._allTransitiveDependencies, - siteId: siteId, - relativePath: relativePath, - ); - - SiteFileContentRawProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.siteId, - required this.relativePath, - }) : super.internal(); - - final String siteId; - final String relativePath; - - @override - Override overrideWith( - FutureOr Function(SiteFileContentRawRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: SiteFileContentRawProvider._internal( - (ref) => create(ref as SiteFileContentRawRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - siteId: siteId, - relativePath: relativePath, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _SiteFileContentRawProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is SiteFileContentRawProvider && - other.siteId == siteId && - other.relativePath == relativePath; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, siteId.hashCode); - hash = _SystemHash.combine(hash, relativePath.hashCode); - - return _SystemHash.finish(hash); - } -} - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin SiteFileContentRawRef on AutoDisposeFutureProviderRef { - /// The parameter `siteId` of this provider. - String get siteId; - - /// The parameter `relativePath` of this provider. - String get relativePath; -} - -class _SiteFileContentRawProviderElement - extends AutoDisposeFutureProviderElement - with SiteFileContentRawRef { - _SiteFileContentRawProviderElement(super.provider); - - @override - String get siteId => (origin as SiteFileContentRawProvider).siteId; - @override - String get relativePath => - (origin as SiteFileContentRawProvider).relativePath; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/pods/site_pages.dart b/lib/pods/site_pages.dart index 87486f3a..129d141d 100644 --- a/lib/pods/site_pages.dart +++ b/lib/pods/site_pages.dart @@ -25,16 +25,12 @@ Future sitePage(Ref ref, String pageId) async { return SnPublicationPage.fromJson(resp.data); } -class SitePagesNotifier - extends - AutoDisposeFamilyAsyncNotifier< - List, - ({String pubName, String siteSlug}) - > { +class SitePagesNotifier extends AsyncNotifier> { + final ({String pubName, String siteSlug}) arg; + SitePagesNotifier(this.arg); + @override - Future> build( - ({String pubName, String siteSlug}) arg, - ) async { + Future> build() async { return fetchPages(); } diff --git a/lib/pods/site_pages.g.dart b/lib/pods/site_pages.g.dart index 3d681f6b..ba1b83a8 100644 --- a/lib/pods/site_pages.g.dart +++ b/lib/pods/site_pages.g.dart @@ -6,275 +6,163 @@ part of 'site_pages.dart'; // RiverpodGenerator // ************************************************************************** -String _$sitePagesHash() => r'5e084e9694ad665e9b238c6a747c6c6e99c5eb03'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [sitePages]. @ProviderFor(sitePages) -const sitePagesProvider = SitePagesFamily(); +const sitePagesProvider = SitePagesFamily._(); -/// See also [sitePages]. -class SitePagesFamily extends Family>> { - /// See also [sitePages]. - const SitePagesFamily(); +final class SitePagesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const SitePagesProvider._({ + required SitePagesFamily super.from, + required (String, String) super.argument, + }) : super( + retry: null, + name: r'sitePagesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [sitePages]. - SitePagesProvider call(String pubName, String siteSlug) { - return SitePagesProvider(pubName, siteSlug); + @override + String debugGetCreateSourceHash() => _$sitePagesHash(); + + @override + String toString() { + return r'sitePagesProvider' + '' + '$argument'; } + @$internal @override - SitePagesProvider getProviderOverride(covariant SitePagesProvider provider) { - return call(provider.pubName, provider.siteSlug); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'sitePagesProvider'; -} - -/// See also [sitePages]. -class SitePagesProvider - extends AutoDisposeFutureProvider> { - /// See also [sitePages]. - SitePagesProvider(String pubName, String siteSlug) - : this._internal( - (ref) => sitePages(ref as SitePagesRef, pubName, siteSlug), - from: sitePagesProvider, - name: r'sitePagesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$sitePagesHash, - dependencies: SitePagesFamily._dependencies, - allTransitiveDependencies: SitePagesFamily._allTransitiveDependencies, - pubName: pubName, - siteSlug: siteSlug, - ); - - SitePagesProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.pubName, - required this.siteSlug, - }) : super.internal(); - - final String pubName; - final String siteSlug; - - @override - Override overrideWith( - FutureOr> Function(SitePagesRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: SitePagesProvider._internal( - (ref) => create(ref as SitePagesRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - pubName: pubName, - siteSlug: siteSlug, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _SitePagesProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as (String, String); + return sitePages(ref, argument.$1, argument.$2); } @override bool operator ==(Object other) { - return other is SitePagesProvider && - other.pubName == pubName && - other.siteSlug == siteSlug; + return other is SitePagesProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, pubName.hashCode); - hash = _SystemHash.combine(hash, siteSlug.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin SitePagesRef on AutoDisposeFutureProviderRef> { - /// The parameter `pubName` of this provider. - String get pubName; +String _$sitePagesHash() => r'5e084e9694ad665e9b238c6a747c6c6e99c5eb03'; - /// The parameter `siteSlug` of this provider. - String get siteSlug; +final class SitePagesFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + (String, String) + > { + const SitePagesFamily._() + : super( + retry: null, + name: r'sitePagesProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + SitePagesProvider call(String pubName, String siteSlug) => + SitePagesProvider._(argument: (pubName, siteSlug), from: this); + + @override + String toString() => r'sitePagesProvider'; } -class _SitePagesProviderElement - extends AutoDisposeFutureProviderElement> - with SitePagesRef { - _SitePagesProviderElement(super.provider); +@ProviderFor(sitePage) +const sitePageProvider = SitePageFamily._(); + +final class SitePageProvider + extends + $FunctionalProvider< + AsyncValue, + SnPublicationPage, + FutureOr + > + with + $FutureModifier, + $FutureProvider { + const SitePageProvider._({ + required SitePageFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'sitePageProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); @override - String get pubName => (origin as SitePagesProvider).pubName; + String debugGetCreateSourceHash() => _$sitePageHash(); + @override - String get siteSlug => (origin as SitePagesProvider).siteSlug; + String toString() { + return r'sitePageProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return sitePage(ref, argument); + } + + @override + bool operator ==(Object other) { + return other is SitePageProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$sitePageHash() => r'542f70c5b103fe34d7cf7eb0821d52f017022efc'; -/// See also [sitePage]. -@ProviderFor(sitePage) -const sitePageProvider = SitePageFamily(); - -/// See also [sitePage]. -class SitePageFamily extends Family> { - /// See also [sitePage]. - const SitePageFamily(); - - /// See also [sitePage]. - SitePageProvider call(String pageId) { - return SitePageProvider(pageId); - } - - @override - SitePageProvider getProviderOverride(covariant SitePageProvider provider) { - return call(provider.pageId); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'sitePageProvider'; -} - -/// See also [sitePage]. -class SitePageProvider extends AutoDisposeFutureProvider { - /// See also [sitePage]. - SitePageProvider(String pageId) - : this._internal( - (ref) => sitePage(ref as SitePageRef, pageId), - from: sitePageProvider, +final class SitePageFamily extends $Family + with $FunctionalFamilyOverride, String> { + const SitePageFamily._() + : super( + retry: null, name: r'sitePageProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$sitePageHash, - dependencies: SitePageFamily._dependencies, - allTransitiveDependencies: SitePageFamily._allTransitiveDependencies, - pageId: pageId, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - SitePageProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.pageId, - }) : super.internal(); - - final String pageId; + SitePageProvider call(String pageId) => + SitePageProvider._(argument: pageId, from: this); @override - Override overrideWith( - FutureOr Function(SitePageRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: SitePageProvider._internal( - (ref) => create(ref as SitePageRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - pageId: pageId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _SitePageProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is SitePageProvider && other.pageId == pageId; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, pageId.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'sitePageProvider'; } - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin SitePageRef on AutoDisposeFutureProviderRef { - /// The parameter `pageId` of this provider. - String get pageId; -} - -class _SitePageProviderElement - extends AutoDisposeFutureProviderElement - with SitePageRef { - _SitePageProviderElement(super.provider); - - @override - String get pageId => (origin as SitePageProvider).pageId; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/pods/sites.dart b/lib/pods/sites.dart index c430c84f..1705d807 100644 --- a/lib/pods/sites.dart +++ b/lib/pods/sites.dart @@ -4,16 +4,12 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:island/models/publication_site.dart'; import 'package:island/pods/network.dart'; -class SiteNotifier - extends - AutoDisposeFamilyAsyncNotifier< - SnPublicationSite, - ({String pubName, String? siteId}) - > { +class SiteNotifier extends AsyncNotifier { + final ({String pubName, String? siteId}) arg; + SiteNotifier(this.arg); + @override - FutureOr build( - ({String pubName, String? siteId}) arg, - ) async { + FutureOr build() async { if (arg.siteId == null || arg.siteId!.isEmpty) { return SnPublicationSite( id: '', diff --git a/lib/pods/theme.dart b/lib/pods/theme.dart index 26fa372b..636e0c5d 100644 --- a/lib/pods/theme.dart +++ b/lib/pods/theme.dart @@ -1,13 +1,12 @@ import 'package:flutter/material.dart'; import 'package:island/pods/config.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'theme.g.dart'; @riverpod ThemeSet theme(Ref ref) { - final settings = ref.watch(appSettingsNotifierProvider); + final settings = ref.watch(appSettingsProvider); return createAppThemeSet(settings); } diff --git a/lib/pods/theme.g.dart b/lib/pods/theme.g.dart index f8b3ac85..4b8458cb 100644 --- a/lib/pods/theme.g.dart +++ b/lib/pods/theme.g.dart @@ -6,21 +6,46 @@ part of 'theme.dart'; // RiverpodGenerator // ************************************************************************** -String _$themeHash() => r'a12dbf8b83d75713b7ae4c68e9cdd1a1cc3a35f0'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [theme]. @ProviderFor(theme) -final themeProvider = AutoDisposeProvider.internal( - theme, - name: r'themeProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$themeHash, - dependencies: null, - allTransitiveDependencies: null, -); +const themeProvider = ThemeProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef ThemeRef = AutoDisposeProviderRef; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class ThemeProvider + extends $FunctionalProvider + with $Provider { + const ThemeProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'themeProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$themeHash(); + + @$internal + @override + $ProviderElement $createElement($ProviderPointer pointer) => + $ProviderElement(pointer); + + @override + ThemeSet create(Ref ref) { + return theme(ref); + } + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(ThemeSet value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } +} + +String _$themeHash() => r'5b41b68e2fc59431bb195ff75f63383982f7730f'; diff --git a/lib/pods/timeline.dart b/lib/pods/timeline.dart index d1abd4eb..82e9e078 100644 --- a/lib/pods/timeline.dart +++ b/lib/pods/timeline.dart @@ -4,7 +4,7 @@ import 'package:island/models/activity.dart'; import 'package:island/pods/network.dart'; import 'package:island/pods/paging.dart'; -final activityListNotifierProvider = +final activityListProvider = AsyncNotifierProvider>( ActivityListNotifier.new, ); @@ -22,8 +22,7 @@ class ActivityListNotifier extends AsyncNotifier> Future> fetch() async { final client = ref.read(apiClientProvider); - final cursor = - state.valueOrNull?.lastOrNull?.createdAt.toUtc().toIso8601String(); + final cursor = state.value?.lastOrNull?.createdAt.toUtc().toIso8601String(); final queryParameters = { if (cursor != null) 'cursor': cursor, @@ -46,15 +45,13 @@ class ActivityListNotifier extends AsyncNotifier> final hasMore = (items.firstOrNull?.type ?? 'empty') != 'empty'; totalCount = - (state.valueOrNull?.length ?? 0) + - items.length + - (hasMore ? pageSize : 0); + (state.value?.length ?? 0) + items.length + (hasMore ? pageSize : 0); return items; } void updateOne(int index, SnTimelineEvent activity) { - final currentState = state.valueOrNull; + final currentState = state.value; if (currentState == null) return; final updatedItems = [...currentState]; diff --git a/lib/pods/translate.dart b/lib/pods/translate.dart index 6ffa807a..7b1529b9 100644 --- a/lib/pods/translate.dart +++ b/lib/pods/translate.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:island/pods/network.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; diff --git a/lib/pods/translate.g.dart b/lib/pods/translate.g.dart index 5b9ee4fa..4a37c360 100644 --- a/lib/pods/translate.g.dart +++ b/lib/pods/translate.g.dart @@ -6,269 +6,152 @@ part of 'translate.dart'; // RiverpodGenerator // ************************************************************************** -String _$translateStringHash() => r'51d638cf07cbf3ffa9469298f5bd9c667bc0ccb7'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [translateString]. @ProviderFor(translateString) -const translateStringProvider = TranslateStringFamily(); +const translateStringProvider = TranslateStringFamily._(); -/// See also [translateString]. -class TranslateStringFamily extends Family> { - /// See also [translateString]. - const TranslateStringFamily(); +final class TranslateStringProvider + extends $FunctionalProvider, String, FutureOr> + with $FutureModifier, $FutureProvider { + const TranslateStringProvider._({ + required TranslateStringFamily super.from, + required TranslateQuery super.argument, + }) : super( + retry: null, + name: r'translateStringProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [translateString]. - TranslateStringProvider call(TranslateQuery query) { - return TranslateStringProvider(query); + @override + String debugGetCreateSourceHash() => _$translateStringHash(); + + @override + String toString() { + return r'translateStringProvider' + '' + '($argument)'; } + @$internal @override - TranslateStringProvider getProviderOverride( - covariant TranslateStringProvider provider, - ) { - return call(provider.query); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'translateStringProvider'; -} - -/// See also [translateString]. -class TranslateStringProvider extends AutoDisposeFutureProvider { - /// See also [translateString]. - TranslateStringProvider(TranslateQuery query) - : this._internal( - (ref) => translateString(ref as TranslateStringRef, query), - from: translateStringProvider, - name: r'translateStringProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$translateStringHash, - dependencies: TranslateStringFamily._dependencies, - allTransitiveDependencies: - TranslateStringFamily._allTransitiveDependencies, - query: query, - ); - - TranslateStringProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.query, - }) : super.internal(); - - final TranslateQuery query; - - @override - Override overrideWith( - FutureOr Function(TranslateStringRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: TranslateStringProvider._internal( - (ref) => create(ref as TranslateStringRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - query: query, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _TranslateStringProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as TranslateQuery; + return translateString(ref, argument); } @override bool operator ==(Object other) { - return other is TranslateStringProvider && other.query == query; + return other is TranslateStringProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, query.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin TranslateStringRef on AutoDisposeFutureProviderRef { - /// The parameter `query` of this provider. - TranslateQuery get query; -} +String _$translateStringHash() => r'51d638cf07cbf3ffa9469298f5bd9c667bc0ccb7'; -class _TranslateStringProviderElement - extends AutoDisposeFutureProviderElement - with TranslateStringRef { - _TranslateStringProviderElement(super.provider); +final class TranslateStringFamily extends $Family + with $FunctionalFamilyOverride, TranslateQuery> { + const TranslateStringFamily._() + : super( + retry: null, + name: r'translateStringProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + TranslateStringProvider call(TranslateQuery query) => + TranslateStringProvider._(argument: query, from: this); @override - TranslateQuery get query => (origin as TranslateStringProvider).query; + String toString() => r'translateStringProvider'; +} + +@ProviderFor(detectStringLanguage) +const detectStringLanguageProvider = DetectStringLanguageFamily._(); + +final class DetectStringLanguageProvider + extends $FunctionalProvider + with $Provider { + const DetectStringLanguageProvider._({ + required DetectStringLanguageFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'detectStringLanguageProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$detectStringLanguageHash(); + + @override + String toString() { + return r'detectStringLanguageProvider' + '' + '($argument)'; + } + + @$internal + @override + $ProviderElement $createElement($ProviderPointer pointer) => + $ProviderElement(pointer); + + @override + String? create(Ref ref) { + final argument = this.argument as String; + return detectStringLanguage(ref, argument); + } + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(String? value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } + + @override + bool operator ==(Object other) { + return other is DetectStringLanguageProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$detectStringLanguageHash() => r'24fbf52edbbffcc8dc4f09f7206f82d69728e703'; -/// See also [detectStringLanguage]. -@ProviderFor(detectStringLanguage) -const detectStringLanguageProvider = DetectStringLanguageFamily(); - -/// See also [detectStringLanguage]. -class DetectStringLanguageFamily extends Family { - /// See also [detectStringLanguage]. - const DetectStringLanguageFamily(); - - /// See also [detectStringLanguage]. - DetectStringLanguageProvider call(String text) { - return DetectStringLanguageProvider(text); - } - - @override - DetectStringLanguageProvider getProviderOverride( - covariant DetectStringLanguageProvider provider, - ) { - return call(provider.text); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'detectStringLanguageProvider'; -} - -/// See also [detectStringLanguage]. -class DetectStringLanguageProvider extends AutoDisposeProvider { - /// See also [detectStringLanguage]. - DetectStringLanguageProvider(String text) - : this._internal( - (ref) => detectStringLanguage(ref as DetectStringLanguageRef, text), - from: detectStringLanguageProvider, +final class DetectStringLanguageFamily extends $Family + with $FunctionalFamilyOverride { + const DetectStringLanguageFamily._() + : super( + retry: null, name: r'detectStringLanguageProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$detectStringLanguageHash, - dependencies: DetectStringLanguageFamily._dependencies, - allTransitiveDependencies: - DetectStringLanguageFamily._allTransitiveDependencies, - text: text, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - DetectStringLanguageProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.text, - }) : super.internal(); - - final String text; + DetectStringLanguageProvider call(String text) => + DetectStringLanguageProvider._(argument: text, from: this); @override - Override overrideWith( - String? Function(DetectStringLanguageRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: DetectStringLanguageProvider._internal( - (ref) => create(ref as DetectStringLanguageRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - text: text, - ), - ); - } - - @override - AutoDisposeProviderElement createElement() { - return _DetectStringLanguageProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is DetectStringLanguageProvider && other.text == text; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, text.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'detectStringLanguageProvider'; } - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin DetectStringLanguageRef on AutoDisposeProviderRef { - /// The parameter `text` of this provider. - String get text; -} - -class _DetectStringLanguageProviderElement - extends AutoDisposeProviderElement - with DetectStringLanguageRef { - _DetectStringLanguageProviderElement(super.provider); - - @override - String get text => (origin as DetectStringLanguageProvider).text; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/pods/upload_tasks.dart b/lib/pods/upload_tasks.dart index 2483af57..da76a1cd 100644 --- a/lib/pods/upload_tasks.dart +++ b/lib/pods/upload_tasks.dart @@ -9,18 +9,16 @@ import 'package:island/pods/websocket.dart'; import 'package:island/services/file_uploader.dart'; import 'package:island/talker.dart'; -final uploadTasksProvider = - StateNotifierProvider>( - (ref) => UploadTasksNotifier(ref), - ); +final uploadTasksProvider = NotifierProvider(UploadTasksNotifier.new); -class UploadTasksNotifier extends StateNotifier> { - final Ref ref; +class UploadTasksNotifier extends Notifier> { StreamSubscription? _websocketSubscription; final Map> _pendingUploads = {}; - UploadTasksNotifier(this.ref) : super([]) { + @override + List build() { _listenToWebSocket(); + return []; } void _listenToWebSocket() { @@ -334,10 +332,8 @@ class UploadTasksNotifier extends StateNotifier> { return taskId; } - @override void dispose() { _websocketSubscription?.cancel(); - super.dispose(); } } diff --git a/lib/pods/userinfo.dart b/lib/pods/userinfo.dart index beb4e7d5..878b0509 100644 --- a/lib/pods/userinfo.dart +++ b/lib/pods/userinfo.dart @@ -14,26 +14,27 @@ import 'package:island/pods/config.dart'; import 'package:island/pods/network.dart'; import 'package:island/talker.dart'; -class UserInfoNotifier extends StateNotifier> { - final Ref _ref; - - UserInfoNotifier(this._ref) : super(const AsyncValue.data(null)); - - Future fetchUser() async { - final token = _ref.watch(tokenProvider); +class UserInfoNotifier extends AsyncNotifier { + @override + Future build() async { + final token = ref.watch(tokenProvider); if (token == null) { talker.info('[UserInfo] No token found, not going to fetch...'); - return; + return null; } + return _fetchUser(); + } + + Future _fetchUser() async { try { - final client = _ref.read(apiClientProvider); + final client = ref.read(apiClientProvider); final response = await client.get('/pass/accounts/me'); final user = SnAccount.fromJson(response.data); - state = AsyncValue.data(user); if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) { FirebaseAnalytics.instance.setUserId(id: user.id); } + return user; } catch (error, stackTrace) { if (!kIsWeb) { if (error is DioException) { @@ -69,58 +70,63 @@ class UserInfoNotifier extends StateNotifier> { ), ).then((value) { if (value == true) { - fetchUser(); + ref.invalidateSelf(); + } + }); + } else { + showOverlayDialog( + builder: + (context, close) => AlertDialog( + title: Text('failedToLoadUserInfo'.tr()), + content: Text( + [ + 'failedToLoadUserInfoNetwork'.tr(), + error.toString(), + ].join('\n\n').trim(), + ), + actions: [ + TextButton( + onPressed: () => close(false), + child: Text('okay'.tr()), + ), + TextButton( + onPressed: () => close(true), + child: Text('retry'.tr()), + ), + ], + ), + ).then((value) { + if (value == true) { + ref.invalidateSelf(); } }); } - showOverlayDialog( - builder: - (context, close) => AlertDialog( - title: Text('failedToLoadUserInfo'.tr()), - content: Text( - [ - 'failedToLoadUserInfoNetwork'.tr(), - error.toString(), - ].join('\n\n').trim(), - ), - actions: [ - TextButton( - onPressed: () => close(false), - child: Text('okay'.tr()), - ), - TextButton( - onPressed: () => close(true), - child: Text('retry'.tr()), - ), - ], - ), - ).then((value) { - if (value == true) { - fetchUser(); - } - }); } talker.error( "[UserInfo] Failed to fetch user info...", error, stackTrace, ); - state = AsyncValue.data(null); + return null; } } + Future fetchUser() async { + ref.invalidateSelf(); + await future; + } + Future logOut() async { state = const AsyncValue.data(null); - final prefs = _ref.read(sharedPreferencesProvider); + final prefs = ref.read(sharedPreferencesProvider); await prefs.remove(kTokenPairStoreKey); - _ref.invalidate(tokenProvider); + ref.invalidate(tokenProvider); if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) { FirebaseAnalytics.instance.setUserId(id: null); } } } -final userInfoProvider = - StateNotifierProvider>( - (ref) => UserInfoNotifier(ref), - ); +final userInfoProvider = AsyncNotifierProvider( + UserInfoNotifier.new, +); diff --git a/lib/pods/web_auth/web_auth_providers.dart b/lib/pods/web_auth/web_auth_providers.dart index c7e79283..51374bcc 100644 --- a/lib/pods/web_auth/web_auth_providers.dart +++ b/lib/pods/web_auth/web_auth_providers.dart @@ -22,10 +22,14 @@ class WebAuthServerState { } } -class WebAuthServerNotifier extends StateNotifier { - final WebAuthServer _server; +class WebAuthServerNotifier extends Notifier { + late final WebAuthServer _server; - WebAuthServerNotifier(this._server) : super(WebAuthServerState()); + @override + WebAuthServerState build() { + _server = ref.watch(webAuthServerProvider); + return WebAuthServerState(); + } Future start() async { try { @@ -47,7 +51,6 @@ final webAuthServerProvider = Provider((ref) { }); final webAuthServerStateProvider = - StateNotifierProvider((ref) { - final server = ref.watch(webAuthServerProvider); - return WebAuthServerNotifier(server); -}); + NotifierProvider( + WebAuthServerNotifier.new, + ); diff --git a/lib/pods/webfeed.dart b/lib/pods/webfeed.dart index 42f474cf..d0e440b7 100644 --- a/lib/pods/webfeed.dart +++ b/lib/pods/webfeed.dart @@ -16,14 +16,12 @@ final webFeedListProvider = FutureProvider.family, String>(( .toList(); }); -class WebFeedNotifier - extends - AutoDisposeFamilyAsyncNotifier< - SnWebFeed, - ({String pubName, String? feedId}) - > { +class WebFeedNotifier extends AsyncNotifier { + final ({String pubName, String? feedId}) arg; + WebFeedNotifier(this.arg); + @override - FutureOr build(({String pubName, String? feedId}) arg) async { + FutureOr build() async { if (arg.feedId == null || arg.feedId!.isEmpty) { return SnWebFeed( id: '', diff --git a/lib/pods/websocket.dart b/lib/pods/websocket.dart index 0f57792e..285709dd 100644 --- a/lib/pods/websocket.dart +++ b/lib/pods/websocket.dart @@ -100,12 +100,16 @@ class WebSocketService { } }, onDone: () { - talker.info('[WebSocket] Connection closed, attempting to reconnect...'); + talker.info( + '[WebSocket] Connection closed, attempting to reconnect...', + ); _scheduleReconnect(); _statusStreamController.sink.add(WebSocketState.disconnected()); }, onError: (error) { - talker.error('[WebSocket] Error occurred: $error, attempting to reconnect...'); + talker.error( + '[WebSocket] Error occurred: $error, attempting to reconnect...', + ); _scheduleReconnect(); _statusStreamController.sink.add( WebSocketState.error(error.toString()), @@ -152,15 +156,20 @@ class WebSocketService { } final websocketStateProvider = - StateNotifierProvider( - (ref) => WebSocketStateNotifier(ref), + NotifierProvider( + WebSocketStateNotifier.new, ); -class WebSocketStateNotifier extends StateNotifier { - final Ref ref; +class WebSocketStateNotifier extends Notifier { Timer? _reconnectTimer; - WebSocketStateNotifier(this.ref) : super(const WebSocketState.disconnected()); + @override + WebSocketState build() { + ref.onDispose(() { + _reconnectTimer?.cancel(); + }); + return const WebSocketState.disconnected(); + } Future connect() async { state = const WebSocketState.connecting(); @@ -169,7 +178,7 @@ class WebSocketStateNotifier extends StateNotifier { await service.connect(ref); state = const WebSocketState.connected(); service.statusStream.listen((event) { - if (mounted) state = event; + state = event; }); } catch (err) { state = WebSocketState.error('Failed to connect: $err'); diff --git a/lib/screens/account.dart b/lib/screens/account.dart index 06bb5a84..7cf67326 100644 --- a/lib/screens/account.dart +++ b/lib/screens/account.dart @@ -57,9 +57,7 @@ class AccountScreen extends HookConsumerWidget { } final user = ref.watch(userInfoProvider); - final notificationUnreadCount = ref.watch( - notificationUnreadCountNotifierProvider, - ); + final notificationUnreadCount = ref.watch(notificationUnreadCountProvider); if (user.value == null || user.value == null) { return _UnauthorizedAccountScreen(); diff --git a/lib/screens/account/credits.g.dart b/lib/screens/account/credits.g.dart index 0fd1c911..e1d9322d 100644 --- a/lib/screens/account/credits.g.dart +++ b/lib/screens/account/credits.g.dart @@ -6,23 +6,38 @@ part of 'credits.dart'; // RiverpodGenerator // ************************************************************************** -String _$socialCreditsHash() => r'a0284583e94bc97285c689ac2bc018536932da69'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [socialCredits]. @ProviderFor(socialCredits) -final socialCreditsProvider = AutoDisposeFutureProvider.internal( - socialCredits, - name: r'socialCreditsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$socialCreditsHash, - dependencies: null, - allTransitiveDependencies: null, -); +const socialCreditsProvider = SocialCreditsProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef SocialCreditsRef = AutoDisposeFutureProviderRef; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class SocialCreditsProvider + extends $FunctionalProvider, double, FutureOr> + with $FutureModifier, $FutureProvider { + const SocialCreditsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'socialCreditsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$socialCreditsHash(); + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return socialCredits(ref); + } +} + +String _$socialCreditsHash() => r'a0284583e94bc97285c689ac2bc018536932da69'; diff --git a/lib/screens/account/me/account_settings.g.dart b/lib/screens/account/me/account_settings.g.dart index cff6b17f..ec197818 100644 --- a/lib/screens/account/me/account_settings.g.dart +++ b/lib/screens/account/me/account_settings.g.dart @@ -6,64 +6,129 @@ part of 'account_settings.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(authFactors) +const authFactorsProvider = AuthFactorsProvider._(); + +final class AuthFactorsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const AuthFactorsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'authFactorsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$authFactorsHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return authFactors(ref); + } +} + String _$authFactorsHash() => r'ed87d7dbd421fef0a5620416727c3dc598c97ef5'; -/// See also [authFactors]. -@ProviderFor(authFactors) -final authFactorsProvider = - AutoDisposeFutureProvider>.internal( - authFactors, - name: r'authFactorsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$authFactorsHash, - dependencies: null, - allTransitiveDependencies: null, - ); +@ProviderFor(contactMethods) +const contactMethodsProvider = ContactMethodsProvider._(); + +final class ContactMethodsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const ContactMethodsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'contactMethodsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$contactMethodsHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return contactMethods(ref); + } +} -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef AuthFactorsRef = AutoDisposeFutureProviderRef>; String _$contactMethodsHash() => r'1d3d03e9ffbf36126236558ead22cb7d88bb9cb2'; -/// See also [contactMethods]. -@ProviderFor(contactMethods) -final contactMethodsProvider = - AutoDisposeFutureProvider>.internal( - contactMethods, - name: r'contactMethodsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$contactMethodsHash, - dependencies: null, - allTransitiveDependencies: null, - ); +@ProviderFor(accountConnections) +const accountConnectionsProvider = AccountConnectionsProvider._(); + +final class AccountConnectionsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const AccountConnectionsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'accountConnectionsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$accountConnectionsHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return accountConnections(ref); + } +} -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef ContactMethodsRef = AutoDisposeFutureProviderRef>; String _$accountConnectionsHash() => r'33c10b98962ede6c428d4028c0d5f2f12ff0eb22'; - -/// See also [accountConnections]. -@ProviderFor(accountConnections) -final accountConnectionsProvider = - AutoDisposeFutureProvider>.internal( - accountConnections, - name: r'accountConnectionsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountConnectionsHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef AccountConnectionsRef = - AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/account/profile.g.dart b/lib/screens/account/profile.g.dart index 183b187d..e4c432a9 100644 --- a/lib/screens/account/profile.g.dart +++ b/lib/screens/account/profile.g.dart @@ -6,883 +6,532 @@ part of 'profile.dart'; // RiverpodGenerator // ************************************************************************** -String _$accountHash() => r'5e2b7bd59151b4638a5561f495537c259f767123'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [account]. @ProviderFor(account) -const accountProvider = AccountFamily(); +const accountProvider = AccountFamily._(); -/// See also [account]. -class AccountFamily extends Family> { - /// See also [account]. - const AccountFamily(); +final class AccountProvider + extends + $FunctionalProvider< + AsyncValue, + SnAccount, + FutureOr + > + with $FutureModifier, $FutureProvider { + const AccountProvider._({ + required AccountFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'accountProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [account]. - AccountProvider call(String uname) { - return AccountProvider(uname); + @override + String debugGetCreateSourceHash() => _$accountHash(); + + @override + String toString() { + return r'accountProvider' + '' + '($argument)'; } + @$internal @override - AccountProvider getProviderOverride(covariant AccountProvider provider) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountProvider'; -} - -/// See also [account]. -class AccountProvider extends AutoDisposeFutureProvider { - /// See also [account]. - AccountProvider(String uname) - : this._internal( - (ref) => account(ref as AccountRef, uname), - from: accountProvider, - name: r'accountProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountHash, - dependencies: AccountFamily._dependencies, - allTransitiveDependencies: AccountFamily._allTransitiveDependencies, - uname: uname, - ); - - AccountProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; - - @override - Override overrideWith( - FutureOr Function(AccountRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountProvider._internal( - (ref) => create(ref as AccountRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _AccountProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return account(ref, argument); } @override bool operator ==(Object other) { - return other is AccountProvider && other.uname == uname; + return other is AccountProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String get uname; -} +String _$accountHash() => r'5e2b7bd59151b4638a5561f495537c259f767123'; -class _AccountProviderElement - extends AutoDisposeFutureProviderElement - with AccountRef { - _AccountProviderElement(super.provider); +final class AccountFamily extends $Family + with $FunctionalFamilyOverride, String> { + const AccountFamily._() + : super( + retry: null, + name: r'accountProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + AccountProvider call(String uname) => + AccountProvider._(argument: uname, from: this); @override - String get uname => (origin as AccountProvider).uname; + String toString() => r'accountProvider'; +} + +@ProviderFor(accountBadges) +const accountBadgesProvider = AccountBadgesFamily._(); + +final class AccountBadgesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const AccountBadgesProvider._({ + required AccountBadgesFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'accountBadgesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$accountBadgesHash(); + + @override + String toString() { + return r'accountBadgesProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return accountBadges(ref, argument); + } + + @override + bool operator ==(Object other) { + return other is AccountBadgesProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$accountBadgesHash() => r'68db63f49827020beecbdbf20529520d0cd14a7d'; -/// See also [accountBadges]. -@ProviderFor(accountBadges) -const accountBadgesProvider = AccountBadgesFamily(); - -/// See also [accountBadges]. -class AccountBadgesFamily extends Family>> { - /// See also [accountBadges]. - const AccountBadgesFamily(); - - /// See also [accountBadges]. - AccountBadgesProvider call(String uname) { - return AccountBadgesProvider(uname); - } - - @override - AccountBadgesProvider getProviderOverride( - covariant AccountBadgesProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountBadgesProvider'; -} - -/// See also [accountBadges]. -class AccountBadgesProvider - extends AutoDisposeFutureProvider> { - /// See also [accountBadges]. - AccountBadgesProvider(String uname) - : this._internal( - (ref) => accountBadges(ref as AccountBadgesRef, uname), - from: accountBadgesProvider, +final class AccountBadgesFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const AccountBadgesFamily._() + : super( + retry: null, name: r'accountBadgesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountBadgesHash, - dependencies: AccountBadgesFamily._dependencies, - allTransitiveDependencies: - AccountBadgesFamily._allTransitiveDependencies, - uname: uname, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - AccountBadgesProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; + AccountBadgesProvider call(String uname) => + AccountBadgesProvider._(argument: uname, from: this); @override - Override overrideWith( - FutureOr> Function(AccountBadgesRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountBadgesProvider._internal( - (ref) => create(ref as AccountBadgesRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _AccountBadgesProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is AccountBadgesProvider && other.uname == uname; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'accountBadgesProvider'; } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountBadgesRef on AutoDisposeFutureProviderRef> { - /// The parameter `uname` of this provider. - String get uname; -} - -class _AccountBadgesProviderElement - extends AutoDisposeFutureProviderElement> - with AccountBadgesRef { - _AccountBadgesProviderElement(super.provider); - - @override - String get uname => (origin as AccountBadgesProvider).uname; -} - -String _$accountAppbarForcegroundColorHash() => - r'127fcc7fd6ec6a41ac4a6975276b5271aa4fa7d0'; - -/// See also [accountAppbarForcegroundColor]. @ProviderFor(accountAppbarForcegroundColor) const accountAppbarForcegroundColorProvider = - AccountAppbarForcegroundColorFamily(); + AccountAppbarForcegroundColorFamily._(); -/// See also [accountAppbarForcegroundColor]. -class AccountAppbarForcegroundColorFamily extends Family> { - /// See also [accountAppbarForcegroundColor]. - const AccountAppbarForcegroundColorFamily(); +final class AccountAppbarForcegroundColorProvider + extends $FunctionalProvider, Color?, FutureOr> + with $FutureModifier, $FutureProvider { + const AccountAppbarForcegroundColorProvider._({ + required AccountAppbarForcegroundColorFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'accountAppbarForcegroundColorProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [accountAppbarForcegroundColor]. - AccountAppbarForcegroundColorProvider call(String uname) { - return AccountAppbarForcegroundColorProvider(uname); + @override + String debugGetCreateSourceHash() => _$accountAppbarForcegroundColorHash(); + + @override + String toString() { + return r'accountAppbarForcegroundColorProvider' + '' + '($argument)'; } + @$internal @override - AccountAppbarForcegroundColorProvider getProviderOverride( - covariant AccountAppbarForcegroundColorProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountAppbarForcegroundColorProvider'; -} - -/// See also [accountAppbarForcegroundColor]. -class AccountAppbarForcegroundColorProvider - extends AutoDisposeFutureProvider { - /// See also [accountAppbarForcegroundColor]. - AccountAppbarForcegroundColorProvider(String uname) - : this._internal( - (ref) => accountAppbarForcegroundColor( - ref as AccountAppbarForcegroundColorRef, - uname, - ), - from: accountAppbarForcegroundColorProvider, - name: r'accountAppbarForcegroundColorProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountAppbarForcegroundColorHash, - dependencies: AccountAppbarForcegroundColorFamily._dependencies, - allTransitiveDependencies: - AccountAppbarForcegroundColorFamily._allTransitiveDependencies, - uname: uname, - ); - - AccountAppbarForcegroundColorProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; - - @override - Override overrideWith( - FutureOr Function(AccountAppbarForcegroundColorRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountAppbarForcegroundColorProvider._internal( - (ref) => create(ref as AccountAppbarForcegroundColorRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _AccountAppbarForcegroundColorProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return accountAppbarForcegroundColor(ref, argument); } @override bool operator ==(Object other) { return other is AccountAppbarForcegroundColorProvider && - other.uname == uname; + other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountAppbarForcegroundColorRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String get uname; -} +String _$accountAppbarForcegroundColorHash() => + r'127fcc7fd6ec6a41ac4a6975276b5271aa4fa7d0'; -class _AccountAppbarForcegroundColorProviderElement - extends AutoDisposeFutureProviderElement - with AccountAppbarForcegroundColorRef { - _AccountAppbarForcegroundColorProviderElement(super.provider); - - @override - String get uname => (origin as AccountAppbarForcegroundColorProvider).uname; -} - -String _$accountDirectChatHash() => r'149ea3a3730672cfbbb8c16fe1f2caa0bb9f0e17'; - -/// See also [accountDirectChat]. -@ProviderFor(accountDirectChat) -const accountDirectChatProvider = AccountDirectChatFamily(); - -/// See also [accountDirectChat]. -class AccountDirectChatFamily extends Family> { - /// See also [accountDirectChat]. - const AccountDirectChatFamily(); - - /// See also [accountDirectChat]. - AccountDirectChatProvider call(String uname) { - return AccountDirectChatProvider(uname); - } - - @override - AccountDirectChatProvider getProviderOverride( - covariant AccountDirectChatProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountDirectChatProvider'; -} - -/// See also [accountDirectChat]. -class AccountDirectChatProvider extends AutoDisposeFutureProvider { - /// See also [accountDirectChat]. - AccountDirectChatProvider(String uname) - : this._internal( - (ref) => accountDirectChat(ref as AccountDirectChatRef, uname), - from: accountDirectChatProvider, - name: r'accountDirectChatProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountDirectChatHash, - dependencies: AccountDirectChatFamily._dependencies, - allTransitiveDependencies: - AccountDirectChatFamily._allTransitiveDependencies, - uname: uname, +final class AccountAppbarForcegroundColorFamily extends $Family + with $FunctionalFamilyOverride, String> { + const AccountAppbarForcegroundColorFamily._() + : super( + retry: null, + name: r'accountAppbarForcegroundColorProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - AccountDirectChatProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; + AccountAppbarForcegroundColorProvider call(String uname) => + AccountAppbarForcegroundColorProvider._(argument: uname, from: this); @override - Override overrideWith( - FutureOr Function(AccountDirectChatRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountDirectChatProvider._internal( - (ref) => create(ref as AccountDirectChatRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); + String toString() => r'accountAppbarForcegroundColorProvider'; +} + +@ProviderFor(accountDirectChat) +const accountDirectChatProvider = AccountDirectChatFamily._(); + +final class AccountDirectChatProvider + extends + $FunctionalProvider< + AsyncValue, + SnChatRoom?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const AccountDirectChatProvider._({ + required AccountDirectChatFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'accountDirectChatProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$accountDirectChatHash(); + + @override + String toString() { + return r'accountDirectChatProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _AccountDirectChatProviderElement(this); + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return accountDirectChat(ref, argument); } @override bool operator ==(Object other) { - return other is AccountDirectChatProvider && other.uname == uname; + return other is AccountDirectChatProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountDirectChatRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String get uname; -} +String _$accountDirectChatHash() => r'149ea3a3730672cfbbb8c16fe1f2caa0bb9f0e17'; -class _AccountDirectChatProviderElement - extends AutoDisposeFutureProviderElement - with AccountDirectChatRef { - _AccountDirectChatProviderElement(super.provider); +final class AccountDirectChatFamily extends $Family + with $FunctionalFamilyOverride, String> { + const AccountDirectChatFamily._() + : super( + retry: null, + name: r'accountDirectChatProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + AccountDirectChatProvider call(String uname) => + AccountDirectChatProvider._(argument: uname, from: this); @override - String get uname => (origin as AccountDirectChatProvider).uname; + String toString() => r'accountDirectChatProvider'; +} + +@ProviderFor(accountRelationship) +const accountRelationshipProvider = AccountRelationshipFamily._(); + +final class AccountRelationshipProvider + extends + $FunctionalProvider< + AsyncValue, + SnRelationship?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const AccountRelationshipProvider._({ + required AccountRelationshipFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'accountRelationshipProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$accountRelationshipHash(); + + @override + String toString() { + return r'accountRelationshipProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return accountRelationship(ref, argument); + } + + @override + bool operator ==(Object other) { + return other is AccountRelationshipProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$accountRelationshipHash() => r'319f743261b113a1d3c6a397d48d13c858312669'; -/// See also [accountRelationship]. -@ProviderFor(accountRelationship) -const accountRelationshipProvider = AccountRelationshipFamily(); - -/// See also [accountRelationship]. -class AccountRelationshipFamily extends Family> { - /// See also [accountRelationship]. - const AccountRelationshipFamily(); - - /// See also [accountRelationship]. - AccountRelationshipProvider call(String uname) { - return AccountRelationshipProvider(uname); - } - - @override - AccountRelationshipProvider getProviderOverride( - covariant AccountRelationshipProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountRelationshipProvider'; -} - -/// See also [accountRelationship]. -class AccountRelationshipProvider - extends AutoDisposeFutureProvider { - /// See also [accountRelationship]. - AccountRelationshipProvider(String uname) - : this._internal( - (ref) => accountRelationship(ref as AccountRelationshipRef, uname), - from: accountRelationshipProvider, +final class AccountRelationshipFamily extends $Family + with $FunctionalFamilyOverride, String> { + const AccountRelationshipFamily._() + : super( + retry: null, name: r'accountRelationshipProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountRelationshipHash, - dependencies: AccountRelationshipFamily._dependencies, - allTransitiveDependencies: - AccountRelationshipFamily._allTransitiveDependencies, - uname: uname, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - AccountRelationshipProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; + AccountRelationshipProvider call(String uname) => + AccountRelationshipProvider._(argument: uname, from: this); @override - Override overrideWith( - FutureOr Function(AccountRelationshipRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountRelationshipProvider._internal( - (ref) => create(ref as AccountRelationshipRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); + String toString() => r'accountRelationshipProvider'; +} + +@ProviderFor(accountBotDeveloper) +const accountBotDeveloperProvider = AccountBotDeveloperFamily._(); + +final class AccountBotDeveloperProvider + extends + $FunctionalProvider< + AsyncValue, + SnDeveloper?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const AccountBotDeveloperProvider._({ + required AccountBotDeveloperFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'accountBotDeveloperProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$accountBotDeveloperHash(); + + @override + String toString() { + return r'accountBotDeveloperProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _AccountRelationshipProviderElement(this); + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return accountBotDeveloper(ref, argument); } @override bool operator ==(Object other) { - return other is AccountRelationshipProvider && other.uname == uname; + return other is AccountBotDeveloperProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountRelationshipRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String get uname; -} - -class _AccountRelationshipProviderElement - extends AutoDisposeFutureProviderElement - with AccountRelationshipRef { - _AccountRelationshipProviderElement(super.provider); - - @override - String get uname => (origin as AccountRelationshipProvider).uname; -} - String _$accountBotDeveloperHash() => r'673534770640a8cf1484ea0af0f4d0ef283ef157'; -/// See also [accountBotDeveloper]. -@ProviderFor(accountBotDeveloper) -const accountBotDeveloperProvider = AccountBotDeveloperFamily(); - -/// See also [accountBotDeveloper]. -class AccountBotDeveloperFamily extends Family> { - /// See also [accountBotDeveloper]. - const AccountBotDeveloperFamily(); - - /// See also [accountBotDeveloper]. - AccountBotDeveloperProvider call(String uname) { - return AccountBotDeveloperProvider(uname); - } - - @override - AccountBotDeveloperProvider getProviderOverride( - covariant AccountBotDeveloperProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountBotDeveloperProvider'; -} - -/// See also [accountBotDeveloper]. -class AccountBotDeveloperProvider - extends AutoDisposeFutureProvider { - /// See also [accountBotDeveloper]. - AccountBotDeveloperProvider(String uname) - : this._internal( - (ref) => accountBotDeveloper(ref as AccountBotDeveloperRef, uname), - from: accountBotDeveloperProvider, +final class AccountBotDeveloperFamily extends $Family + with $FunctionalFamilyOverride, String> { + const AccountBotDeveloperFamily._() + : super( + retry: null, name: r'accountBotDeveloperProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountBotDeveloperHash, - dependencies: AccountBotDeveloperFamily._dependencies, - allTransitiveDependencies: - AccountBotDeveloperFamily._allTransitiveDependencies, - uname: uname, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - AccountBotDeveloperProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; + AccountBotDeveloperProvider call(String uname) => + AccountBotDeveloperProvider._(argument: uname, from: this); @override - Override overrideWith( - FutureOr Function(AccountBotDeveloperRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountBotDeveloperProvider._internal( - (ref) => create(ref as AccountBotDeveloperRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); + String toString() => r'accountBotDeveloperProvider'; +} + +@ProviderFor(accountPublishers) +const accountPublishersProvider = AccountPublishersFamily._(); + +final class AccountPublishersProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const AccountPublishersProvider._({ + required AccountPublishersFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'accountPublishersProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$accountPublishersHash(); + + @override + String toString() { + return r'accountPublishersProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _AccountBotDeveloperProviderElement(this); + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return accountPublishers(ref, argument); } @override bool operator ==(Object other) { - return other is AccountBotDeveloperProvider && other.uname == uname; + return other is AccountPublishersProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountBotDeveloperRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String get uname; -} - -class _AccountBotDeveloperProviderElement - extends AutoDisposeFutureProviderElement - with AccountBotDeveloperRef { - _AccountBotDeveloperProviderElement(super.provider); - - @override - String get uname => (origin as AccountBotDeveloperProvider).uname; -} - String _$accountPublishersHash() => r'25f5695b4a5154163d77f1769876d826bf736609'; -/// See also [accountPublishers]. -@ProviderFor(accountPublishers) -const accountPublishersProvider = AccountPublishersFamily(); - -/// See also [accountPublishers]. -class AccountPublishersFamily extends Family>> { - /// See also [accountPublishers]. - const AccountPublishersFamily(); - - /// See also [accountPublishers]. - AccountPublishersProvider call(String id) { - return AccountPublishersProvider(id); - } - - @override - AccountPublishersProvider getProviderOverride( - covariant AccountPublishersProvider provider, - ) { - return call(provider.id); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountPublishersProvider'; -} - -/// See also [accountPublishers]. -class AccountPublishersProvider - extends AutoDisposeFutureProvider> { - /// See also [accountPublishers]. - AccountPublishersProvider(String id) - : this._internal( - (ref) => accountPublishers(ref as AccountPublishersRef, id), - from: accountPublishersProvider, +final class AccountPublishersFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const AccountPublishersFamily._() + : super( + retry: null, name: r'accountPublishersProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountPublishersHash, - dependencies: AccountPublishersFamily._dependencies, - allTransitiveDependencies: - AccountPublishersFamily._allTransitiveDependencies, - id: id, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - AccountPublishersProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.id, - }) : super.internal(); - - final String id; + AccountPublishersProvider call(String id) => + AccountPublishersProvider._(argument: id, from: this); @override - Override overrideWith( - FutureOr> Function(AccountPublishersRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountPublishersProvider._internal( - (ref) => create(ref as AccountPublishersRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - id: id, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _AccountPublishersProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is AccountPublishersProvider && other.id == id; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'accountPublishersProvider'; } - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountPublishersRef on AutoDisposeFutureProviderRef> { - /// The parameter `id` of this provider. - String get id; -} - -class _AccountPublishersProviderElement - extends AutoDisposeFutureProviderElement> - with AccountPublishersRef { - _AccountPublishersProviderElement(super.provider); - - @override - String get id => (origin as AccountPublishersProvider).id; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/account/relationship.g.dart b/lib/screens/account/relationship.g.dart index 825ca804..ece06c7b 100644 --- a/lib/screens/account/relationship.g.dart +++ b/lib/screens/account/relationship.g.dart @@ -6,25 +6,46 @@ part of 'relationship.dart'; // RiverpodGenerator // ************************************************************************** -String _$sentFriendRequestHash() => r'0c52813eb6f86c05f6e0b1e4e840d0d9c350aa9e'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [sentFriendRequest]. @ProviderFor(sentFriendRequest) -final sentFriendRequestProvider = - AutoDisposeFutureProvider>.internal( - sentFriendRequest, - name: r'sentFriendRequestProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$sentFriendRequestHash, - dependencies: null, - allTransitiveDependencies: null, - ); +const sentFriendRequestProvider = SentFriendRequestProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef SentFriendRequestRef = - AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class SentFriendRequestProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const SentFriendRequestProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'sentFriendRequestProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$sentFriendRequestHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return sentFriendRequest(ref); + } +} + +String _$sentFriendRequestHash() => r'0c52813eb6f86c05f6e0b1e4e840d0d9c350aa9e'; diff --git a/lib/screens/auth/captcha.config.dart b/lib/screens/auth/captcha.config.dart index cb2f79b3..c522e189 100644 --- a/lib/screens/auth/captcha.config.dart +++ b/lib/screens/auth/captcha.config.dart @@ -1,4 +1,3 @@ -import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:island/pods/network.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; diff --git a/lib/screens/auth/captcha.config.g.dart b/lib/screens/auth/captcha.config.g.dart index fe3912df..bd98030e 100644 --- a/lib/screens/auth/captcha.config.g.dart +++ b/lib/screens/auth/captcha.config.g.dart @@ -6,21 +6,38 @@ part of 'captcha.config.dart'; // RiverpodGenerator // ************************************************************************** -String _$captchaUrlHash() => r'5d59de4f26a0544bf4fbd5209943f0b111959ce6'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [captchaUrl]. @ProviderFor(captchaUrl) -final captchaUrlProvider = AutoDisposeFutureProvider.internal( - captchaUrl, - name: r'captchaUrlProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$captchaUrlHash, - dependencies: null, - allTransitiveDependencies: null, -); +const captchaUrlProvider = CaptchaUrlProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef CaptchaUrlRef = AutoDisposeFutureProviderRef; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class CaptchaUrlProvider + extends $FunctionalProvider, String, FutureOr> + with $FutureModifier, $FutureProvider { + const CaptchaUrlProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'captchaUrlProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$captchaUrlHash(); + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return captchaUrl(ref); + } +} + +String _$captchaUrlHash() => r'5d59de4f26a0544bf4fbd5209943f0b111959ce6'; diff --git a/lib/screens/chat/call.dart b/lib/screens/chat/call.dart index 27398ae2..53b69ce1 100644 --- a/lib/screens/chat/call.dart +++ b/lib/screens/chat/call.dart @@ -22,8 +22,8 @@ class CallScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final ongoingCall = ref.watch(ongoingCallProvider(room.id)); - final callState = ref.watch(callNotifierProvider); - final callNotifier = ref.watch(callNotifierProvider.notifier); + final callState = ref.watch(callProvider); + final callNotifier = ref.watch(callProvider.notifier); useEffect(() { talker.info('[Call] Joining the call...'); diff --git a/lib/screens/chat/chat.dart b/lib/screens/chat/chat.dart index 302f405d..e3dca118 100644 --- a/lib/screens/chat/chat.dart +++ b/lib/screens/chat/chat.dart @@ -191,7 +191,7 @@ class ChatListBodyWidget extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final chats = ref.watch(chatRoomJoinedNotifierProvider); + final chats = ref.watch(chatRoomJoinedProvider); Widget bodyWidget = Column( children: [ @@ -214,7 +214,7 @@ class ChatListBodyWidget extends HookConsumerWidget { (items) => RefreshIndicator( onRefresh: () => Future.sync(() { - ref.invalidate(chatRoomJoinedNotifierProvider); + ref.invalidate(chatRoomJoinedProvider); }), child: SuperListView.builder( padding: EdgeInsets.only(bottom: 96), @@ -264,7 +264,7 @@ class ChatListBodyWidget extends HookConsumerWidget { (error, stack) => ResponseErrorWidget( error: error, onRetry: () { - ref.invalidate(chatRoomJoinedNotifierProvider); + ref.invalidate(chatRoomJoinedProvider); }, ), ), @@ -341,7 +341,7 @@ class ChatListScreen extends HookConsumerWidget { // Listen for chat rooms refresh events final subscription = eventBus.on().listen((event) { - ref.invalidate(chatRoomJoinedNotifierProvider); + ref.invalidate(chatRoomJoinedProvider); }); return () { @@ -353,13 +353,14 @@ class ChatListScreen extends HookConsumerWidget { // Set FAB type to chat final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier); Future(() { - fabMenuNotifier.state = FabMenuType.chat; + fabMenuNotifier.setMenuType(FabMenuType.chat); }); return () { // Clean up: reset FAB type to main + final fabMenu = ref.read(fabMenuTypeProvider); WidgetsBinding.instance.addPostFrameCallback((_) { - if (fabMenuNotifier.state == FabMenuType.chat) { - fabMenuNotifier.state = FabMenuType.main; + if (fabMenu == FabMenuType.chat) { + fabMenuNotifier.setMenuType(FabMenuType.main); } }); }; @@ -521,7 +522,7 @@ class _ChatInvitesSheet extends HookConsumerWidget { final client = ref.read(apiClientProvider); await client.post('/sphere/chat/invites/${invite.chatRoom!.id}/accept'); ref.invalidate(chatroomInvitesProvider); - ref.invalidate(chatRoomJoinedNotifierProvider); + ref.invalidate(chatRoomJoinedProvider); } catch (err) { showErrorAlert(err); } diff --git a/lib/screens/chat/chat_form.dart b/lib/screens/chat/chat_form.dart index 39cb6b1b..7de5604a 100644 --- a/lib/screens/chat/chat_form.dart +++ b/lib/screens/chat/chat_form.dart @@ -47,7 +47,7 @@ class EditChatScreen extends HookConsumerWidget { final isPublic = useState(true); final isCommunity = useState(false); - final chat = ref.watch(ChatRoomNotifierProvider(id)); + final chat = ref.watch(chatRoomProvider(id)); final joinedRealms = ref.watch(realmsJoinedProvider); final currentRealm = useState(null); diff --git a/lib/screens/chat/public_room_preview.dart b/lib/screens/chat/public_room_preview.dart index 25fac06e..7dbd8a2c 100644 --- a/lib/screens/chat/public_room_preview.dart +++ b/lib/screens/chat/public_room_preview.dart @@ -27,8 +27,8 @@ class PublicRoomPreview extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final messages = ref.watch(messagesNotifierProvider(id)); - final messagesNotifier = ref.read(messagesNotifierProvider(id).notifier); + final messages = ref.watch(messagesProvider(id)); + final messagesNotifier = ref.read(messagesProvider(id).notifier); final scrollController = useScrollController(); final listController = useMemoized(() => ListController(), []); @@ -203,7 +203,7 @@ class PublicRoomPreview extends HookConsumerWidget { showLoadingModal(context); final apiClient = ref.read(apiClientProvider); await apiClient.post('/sphere/chat/${room.id}/members/me'); - ref.invalidate(ChatRoomIdentityNotifierProvider(id)); + ref.invalidate(chatRoomIdentityProvider(id)); } catch (err) { showErrorAlert(err); } finally { diff --git a/lib/screens/chat/room.dart b/lib/screens/chat/room.dart index 1304949a..6d6a332f 100644 --- a/lib/screens/chat/room.dart +++ b/lib/screens/chat/room.dart @@ -48,11 +48,11 @@ class ChatRoomScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final chatRoom = ref.watch(ChatRoomNotifierProvider(id)); - final chatIdentity = ref.watch(ChatRoomIdentityNotifierProvider(id)); - final isSyncing = ref.watch(isSyncingProvider); - final onlineCount = ref.watch(chatOnlineCountNotifierProvider(id)); - final settings = ref.watch(appSettingsNotifierProvider); + final chatRoom = ref.watch(chatRoomProvider(id)); + final chatIdentity = ref.watch(chatRoomIdentityProvider(id)); + final isSyncing = ref.watch(chatSyncingProvider); + final onlineCount = ref.watch(chatOnlineCountProvider(id)); + final settings = ref.watch(appSettingsProvider); if (chatIdentity.isLoading || chatRoom.isLoading) { return AppScaffold( @@ -100,9 +100,7 @@ class ChatRoomScreen extends HookConsumerWidget { await apiClient.post( '/sphere/chat/${room.id}/members/me', ); - ref.invalidate( - ChatRoomIdentityNotifierProvider(id), - ); + ref.invalidate(chatRoomIdentityProvider(id)); } catch (err) { showErrorAlert(err); } finally { @@ -131,17 +129,15 @@ class ChatRoomScreen extends HookConsumerWidget { appBar: AppBar(leading: const PageBackButton()), body: ResponseErrorWidget( error: error, - onRetry: () => ref.refresh(ChatRoomNotifierProvider(id)), + onRetry: () => ref.refresh(chatRoomProvider(id)), ), ), ); } - final messages = ref.watch(messagesNotifierProvider(id)); - final messagesNotifier = ref.read(messagesNotifierProvider(id).notifier); - final chatSubscribeNotifier = ref.read( - chatSubscribeNotifierProvider(id).notifier, - ); + final messages = ref.watch(messagesProvider(id)); + final messagesNotifier = ref.read(messagesProvider(id).notifier); + final chatSubscribeNotifier = ref.read(chatSubscribeProvider(id).notifier); final messageController = useTextEditingController(); final scrollController = useScrollController(); @@ -384,7 +380,7 @@ class ChatRoomScreen extends HookConsumerWidget { // Convert selected message IDs to message data final selectedMessageData = - messages.valueOrNull + messages.value ?.where((msg) => selectedMessages.value.contains(msg.id)) .map( (msg) => { @@ -773,8 +769,7 @@ class ChatRoomScreen extends HookConsumerWidget { 'chatDetail', pathParameters: {'id': id}, ); - if (result is SearchMessagesResult && - messages.valueOrNull != null) { + if (result is SearchMessagesResult && messages.value != null) { final messageId = result.messageId; // Jump to the message and trigger flash effect diff --git a/lib/screens/chat/room_detail.dart b/lib/screens/chat/room_detail.dart index a93308e8..f7e924bc 100644 --- a/lib/screens/chat/room_detail.dart +++ b/lib/screens/chat/room_detail.dart @@ -1,8 +1,6 @@ -import 'package:dio/dio.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:gap/gap.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; @@ -40,8 +38,8 @@ class ChatDetailScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final roomState = ref.watch(ChatRoomNotifierProvider(id)); - final roomIdentity = ref.watch(ChatRoomIdentityNotifierProvider(id)); + final roomState = ref.watch(chatRoomProvider(id)); + final roomIdentity = ref.watch(chatRoomIdentityProvider(id)); final totalMessages = ref.watch(totalMessagesCountProvider(id)); const kNotifyLevelText = [ @@ -57,7 +55,7 @@ class ChatDetailScreen extends HookConsumerWidget { '/sphere/chat/$id/members/me/notify', data: {'notify_level': level}, ); - ref.invalidate(ChatRoomIdentityNotifierProvider(id)); + ref.invalidate(chatRoomIdentityProvider(id)); if (context.mounted) { showSnackBar( 'chatNotifyLevelUpdated'.tr(args: [kNotifyLevelText[level].tr()]), @@ -75,7 +73,7 @@ class ChatDetailScreen extends HookConsumerWidget { '/sphere/chat/$id/members/me/notify', data: {'break_until': until.toUtc().toIso8601String()}, ); - ref.invalidate(ChatRoomNotifierProvider(id)); + ref.invalidate(chatRoomIdentityProvider(id)); } catch (err) { showErrorAlert(err); } @@ -440,8 +438,8 @@ class _ChatRoomActionMenu extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final chatIdentity = ref.watch(ChatRoomIdentityNotifierProvider(id)); - final chatRoom = ref.watch(ChatRoomNotifierProvider(id)); + final chatIdentity = ref.watch(chatRoomIdentityProvider(id)); + final chatRoom = ref.watch(chatRoomProvider(id)); final isManagable = chatIdentity.value?.accountId == chatRoom.value?.accountId || @@ -462,7 +460,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget { ).then((value) { if (value != null) { // Invalidate to refresh room data after edit - ref.invalidate(ChatRoomNotifierProvider(id)); + ref.invalidate(chatMemberListProvider(id)); } }); }, @@ -498,7 +496,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget { if (confirm) { final client = ref.watch(apiClientProvider); await client.delete('/sphere/chat/$id'); - ref.invalidate(chatRoomJoinedNotifierProvider); + ref.invalidate(chatRoomJoinedProvider); if (context.mounted) { context.pop(); } @@ -531,7 +529,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget { if (confirm) { final client = ref.watch(apiClientProvider); await client.delete('/sphere/chat/$id/members/me'); - ref.invalidate(chatRoomJoinedNotifierProvider); + ref.invalidate(chatRoomJoinedProvider); if (context.mounted) { context.pop(); } @@ -554,63 +552,17 @@ sealed class ChatRoomMemberState with _$ChatRoomMemberState { }) = _ChatRoomMemberState; } -final chatMemberStateProvider = StateNotifierProvider.family< - ChatMemberNotifier, - ChatRoomMemberState, - String ->((ref, roomId) { - final apiClient = ref.watch(apiClientProvider); - return ChatMemberNotifier(apiClient, roomId); -}); +final chatMemberListProvider = AsyncNotifierProvider.autoDispose.family( + ChatMemberListNotifier.new, +); -class ChatMemberNotifier extends StateNotifier { - final String roomId; - final Dio _apiClient; - - ChatMemberNotifier(this._apiClient, this.roomId) - : super(const ChatRoomMemberState(members: [], isLoading: false, total: 0)); - - Future loadMore({int offset = 0, int take = 20}) async { - if (state.isLoading) return; - if (state.total > 0 && state.members.length >= state.total) return; - - state = state.copyWith(isLoading: true, error: null); - - try { - final response = await _apiClient.get( - '/sphere/chat/$roomId/members', - queryParameters: {'offset': offset, 'take': take}, - ); - - final total = int.parse(response.headers.value('X-Total') ?? '0'); - final List data = response.data; - final members = data.map((e) => SnChatMember.fromJson(e)).toList(); - - state = state.copyWith( - members: [...state.members, ...members], - total: total, - isLoading: false, - ); - } catch (e) { - state = state.copyWith(error: e.toString(), isLoading: false); - } - } - - void reset() { - state = const ChatRoomMemberState(members: [], isLoading: false, total: 0); - } -} - -final chatMemberListNotifierProvider = AsyncNotifierProvider.autoDispose - .family, String>( - ChatMemberListNotifier.new, - ); - -class ChatMemberListNotifier - extends AutoDisposeFamilyAsyncNotifier, String> - with FamilyAsyncPaginationController { +class ChatMemberListNotifier extends AsyncNotifier> + with AsyncPaginationController { static const pageSize = 20; + final String arg; + ChatMemberListNotifier(this.arg); + @override Future> fetch() async { final apiClient = ref.watch(apiClientProvider); @@ -640,26 +592,15 @@ class _ChatMemberListSheet extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final memberListProvider = chatMemberListNotifierProvider(roomId); + final memberNotifier = ref.read(chatMemberListProvider(roomId).notifier); - // For backward compatibility and to show total count in the header - final memberState = ref.watch(chatMemberStateProvider(roomId)); - final memberNotifier = ref.read(chatMemberStateProvider(roomId).notifier); - - final roomIdentity = ref.watch(ChatRoomIdentityNotifierProvider(roomId)); - final chatRoom = ref.watch(ChatRoomNotifierProvider(roomId)); + final roomIdentity = ref.watch(chatRoomIdentityProvider(roomId)); + final chatRoom = ref.watch(chatRoomProvider(roomId)); final isManagable = chatRoom.value?.accountId == roomIdentity.value?.accountId || chatRoom.value?.type == 1; - useEffect(() { - Future(() { - memberNotifier.loadMore(); - }); - return null; - }, []); - Future invitePerson() async { final result = await showModalBottomSheet( context: context, @@ -674,10 +615,7 @@ class _ChatMemberListSheet extends HookConsumerWidget { '/sphere/chat/invites/$roomId', data: {'related_user_id': result.id, 'role': 0}, ); - // Refresh both providers - memberNotifier.reset(); - await memberNotifier.loadMore(); - ref.invalidate(memberListProvider); + memberNotifier.refresh(); } catch (err) { showErrorAlert(err); } @@ -694,7 +632,7 @@ class _ChatMemberListSheet extends HookConsumerWidget { child: Row( children: [ Text( - 'members'.plural(memberState.total), + 'members'.plural(memberNotifier.totalCount ?? 0), style: Theme.of(context).textTheme.headlineSmall?.copyWith( fontWeight: FontWeight.w600, letterSpacing: -0.5, @@ -709,10 +647,7 @@ class _ChatMemberListSheet extends HookConsumerWidget { IconButton( icon: const Icon(Symbols.refresh), onPressed: () { - // Refresh both providers - memberNotifier.reset(); - memberNotifier.loadMore(); - ref.invalidate(memberListProvider); + memberNotifier.refresh(); }, ), IconButton( @@ -726,8 +661,8 @@ class _ChatMemberListSheet extends HookConsumerWidget { const Divider(height: 1), Expanded( child: PaginationList( - provider: memberListProvider, - notifier: memberListProvider.notifier, + provider: chatMemberListProvider(roomId), + notifier: chatMemberListProvider(roomId).notifier, itemBuilder: (context, idx, member) { return ListTile( contentPadding: EdgeInsets.only(left: 16, right: 12), @@ -770,9 +705,7 @@ class _ChatMemberListSheet extends HookConsumerWidget { '/sphere/chat/$roomId/members/${member.accountId}', ); // Refresh both providers - memberNotifier.reset(); - memberNotifier.loadMore(); - ref.invalidate(memberListProvider); + memberNotifier.refresh(); } catch (err) { showErrorAlert(err); } diff --git a/lib/screens/chat/room_detail.g.dart b/lib/screens/chat/room_detail.g.dart index 7f7d7406..04bbb3c8 100644 --- a/lib/screens/chat/room_detail.g.dart +++ b/lib/screens/chat/room_detail.g.dart @@ -6,148 +6,75 @@ part of 'room_detail.dart'; // RiverpodGenerator // ************************************************************************** -String _$totalMessagesCountHash() => - r'd55f1507aba2acdce5e468c1c2e15dba7640c571'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [totalMessagesCount]. @ProviderFor(totalMessagesCount) -const totalMessagesCountProvider = TotalMessagesCountFamily(); +const totalMessagesCountProvider = TotalMessagesCountFamily._(); -/// See also [totalMessagesCount]. -class TotalMessagesCountFamily extends Family> { - /// See also [totalMessagesCount]. - const TotalMessagesCountFamily(); +final class TotalMessagesCountProvider + extends $FunctionalProvider, int, FutureOr> + with $FutureModifier, $FutureProvider { + const TotalMessagesCountProvider._({ + required TotalMessagesCountFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'totalMessagesCountProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [totalMessagesCount]. - TotalMessagesCountProvider call(String roomId) { - return TotalMessagesCountProvider(roomId); + @override + String debugGetCreateSourceHash() => _$totalMessagesCountHash(); + + @override + String toString() { + return r'totalMessagesCountProvider' + '' + '($argument)'; } + @$internal @override - TotalMessagesCountProvider getProviderOverride( - covariant TotalMessagesCountProvider provider, - ) { - return call(provider.roomId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'totalMessagesCountProvider'; -} - -/// See also [totalMessagesCount]. -class TotalMessagesCountProvider extends AutoDisposeFutureProvider { - /// See also [totalMessagesCount]. - TotalMessagesCountProvider(String roomId) - : this._internal( - (ref) => totalMessagesCount(ref as TotalMessagesCountRef, roomId), - from: totalMessagesCountProvider, - name: r'totalMessagesCountProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$totalMessagesCountHash, - dependencies: TotalMessagesCountFamily._dependencies, - allTransitiveDependencies: - TotalMessagesCountFamily._allTransitiveDependencies, - roomId: roomId, - ); - - TotalMessagesCountProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.roomId, - }) : super.internal(); - - final String roomId; - - @override - Override overrideWith( - FutureOr Function(TotalMessagesCountRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: TotalMessagesCountProvider._internal( - (ref) => create(ref as TotalMessagesCountRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - roomId: roomId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _TotalMessagesCountProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return totalMessagesCount(ref, argument); } @override bool operator ==(Object other) { - return other is TotalMessagesCountProvider && other.roomId == roomId; + return other is TotalMessagesCountProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, roomId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin TotalMessagesCountRef on AutoDisposeFutureProviderRef { - /// The parameter `roomId` of this provider. - String get roomId; -} +String _$totalMessagesCountHash() => + r'd55f1507aba2acdce5e468c1c2e15dba7640c571'; -class _TotalMessagesCountProviderElement - extends AutoDisposeFutureProviderElement - with TotalMessagesCountRef { - _TotalMessagesCountProviderElement(super.provider); +final class TotalMessagesCountFamily extends $Family + with $FunctionalFamilyOverride, String> { + const TotalMessagesCountFamily._() + : super( + retry: null, + name: r'totalMessagesCountProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + TotalMessagesCountProvider call(String roomId) => + TotalMessagesCountProvider._(argument: roomId, from: this); @override - String get roomId => (origin as TotalMessagesCountProvider).roomId; + String toString() => r'totalMessagesCountProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/chat/search_messages.dart b/lib/screens/chat/search_messages.dart index 54d99839..e9b958c1 100644 --- a/lib/screens/chat/search_messages.dart +++ b/lib/screens/chat/search_messages.dart @@ -124,9 +124,7 @@ class SearchMessagesScreen extends HookConsumerWidget { // Debounce timer for search optimization final debounceTimer = useRef(null); - final messagesNotifier = ref.read( - messagesNotifierProvider(roomId).notifier, - ); + final messagesNotifier = ref.read(messagesProvider(roomId).notifier); // Optimized search function with debouncing void performSearch(String query) async { @@ -180,7 +178,7 @@ class SearchMessagesScreen extends HookConsumerWidget { useEffect(() { WidgetsBinding.instance.addPostFrameCallback((_) { // Clear flashing messages when entering search screen - ref.read(flashingMessagesProvider.notifier).state = {}; + ref.read(flashingMessagesProvider.notifier).clear(); }); return null; }, []); diff --git a/lib/screens/chat/widgets/message_item_wrapper.dart b/lib/screens/chat/widgets/message_item_wrapper.dart index aca91aea..11be9d9e 100644 --- a/lib/screens/chat/widgets/message_item_wrapper.dart +++ b/lib/screens/chat/widgets/message_item_wrapper.dart @@ -1,14 +1,28 @@ import 'package:flutter/material.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:island/database/message.dart'; import 'package:island/models/chat.dart'; import 'package:island/widgets/chat/message_item.dart'; // Provider to track animated messages to prevent replay -final animatedMessagesProvider = StateProvider>((ref) => {}); +final animatedMessagesProvider = + NotifierProvider>( + AnimatedMessagesNotifier.new, + ); -class MessageItemWrapper extends HookConsumerWidget { +class AnimatedMessagesNotifier extends Notifier> { + @override + Set build() { + return {}; + } + + void addMessage(String messageId) { + state = {...state, messageId}; + } +} + +class MessageItemWrapper extends ConsumerWidget { final LocalChatMessage message; final int index; final bool isLastInGroup; @@ -78,9 +92,7 @@ class MessageItemWrapper extends HookConsumerWidget { onEnd: () { // Mark as animated WidgetsBinding.instance.addPostFrameCallback((_) { - ref - .read(animatedMessagesProvider.notifier) - .update((state) => {...state, message.id}); + ref.read(animatedMessagesProvider.notifier).addMessage(message.id); }); }, child: child, diff --git a/lib/screens/creators/hub.dart b/lib/screens/creators/hub.dart index 258c4628..2f0bd65f 100644 --- a/lib/screens/creators/hub.dart +++ b/lib/screens/creators/hub.dart @@ -81,11 +81,13 @@ Future> publisherInvites(Ref ref) async { final publisherMemberListNotifierProvider = AsyncNotifierProvider.family .autoDispose(PublisherMemberListNotifier.new); -class PublisherMemberListNotifier - extends AutoDisposeFamilyAsyncNotifier, String> - with FamilyAsyncPaginationController { +class PublisherMemberListNotifier extends AsyncNotifier> + with AsyncPaginationController { static const int pageSize = 20; + final String arg; + PublisherMemberListNotifier(this.arg); + @override Future> fetch() async { final apiClient = ref.read(apiClientProvider); @@ -759,55 +761,6 @@ class PublisherMemberState { } } -final publisherMemberStateProvider = StateNotifierProvider.family< - PublisherMemberNotifier, - PublisherMemberState, - String ->((ref, publisherUname) { - final apiClient = ref.watch(apiClientProvider); - return PublisherMemberNotifier(apiClient, publisherUname); -}); - -class PublisherMemberNotifier extends StateNotifier { - final String publisherUname; - final Dio _apiClient; - - PublisherMemberNotifier(this._apiClient, this.publisherUname) - : super( - const PublisherMemberState(members: [], isLoading: false, total: 0), - ); - - Future loadMore({int offset = 0, int take = 20}) async { - if (state.isLoading) return; - if (state.total > 0 && state.members.length >= state.total) return; - - state = state.copyWith(isLoading: true, error: null); - - try { - final response = await _apiClient.get( - '/sphere/publishers/$publisherUname/members', - queryParameters: {'offset': offset, 'take': take}, - ); - - final total = int.parse(response.headers.value('X-Total') ?? '0'); - final List data = response.data; - final members = data.map((e) => SnPublisherMember.fromJson(e)).toList(); - - state = state.copyWith( - members: [...state.members, ...members], - total: total, - isLoading: false, - ); - } catch (e) { - state = state.copyWith(error: e.toString(), isLoading: false); - } - } - - void reset() { - state = const PublisherMemberState(members: [], isLoading: false, total: 0); - } -} - class _PublisherMemberListSheet extends HookConsumerWidget { final String publisherUname; const _PublisherMemberListSheet({required this.publisherUname}); @@ -820,18 +773,10 @@ class _PublisherMemberListSheet extends HookConsumerWidget { final memberListProvider = publisherMemberListNotifierProvider( publisherUname, ); - final memberState = ref.watch(publisherMemberStateProvider(publisherUname)); final memberNotifier = ref.read( - publisherMemberStateProvider(publisherUname).notifier, + publisherMemberListNotifierProvider(publisherUname).notifier, ); - useEffect(() { - Future(() { - memberNotifier.loadMore(); - }); - return null; - }, []); - Future invitePerson() async { final result = await showModalBottomSheet( useRootNavigator: true, @@ -846,10 +791,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget { '/sphere/publishers/invites/$publisherUname', data: {'related_user_id': result.id, 'role': 0}, ); - // Refresh both providers - memberNotifier.reset(); - await memberNotifier.loadMore(); - ref.invalidate(memberListProvider); + memberNotifier.refresh(); } catch (err) { showErrorAlert(err); } @@ -866,7 +808,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget { child: Row( children: [ Text( - 'members'.plural(memberState.total), + 'members'.plural(memberNotifier.totalCount ?? 0), style: Theme.of(context).textTheme.headlineSmall?.copyWith( fontWeight: FontWeight.w600, letterSpacing: -0.5, @@ -881,9 +823,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget { IconButton( icon: const Icon(Symbols.refresh), onPressed: () { - memberNotifier.reset(); - memberNotifier.loadMore(); - ref.invalidate(memberListProvider); + memberNotifier.refresh(); }, ), IconButton( @@ -943,10 +883,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget { ), ).then((value) { if (value != null) { - // Refresh both providers - memberNotifier.reset(); - memberNotifier.loadMore(); - ref.invalidate(memberListProvider); + memberNotifier.refresh(); } }); }, @@ -965,10 +902,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget { await apiClient.delete( '/sphere/publishers/$publisherUname/members/${member.accountId}', ); - // Refresh both providers - memberNotifier.reset(); - memberNotifier.loadMore(); - ref.invalidate(memberListProvider); + memberNotifier.refresh(); } catch (err) { showErrorAlert(err); } diff --git a/lib/screens/creators/hub.g.dart b/lib/screens/creators/hub.g.dart index 77b0d13a..237185a6 100644 --- a/lib/screens/creators/hub.g.dart +++ b/lib/screens/creators/hub.g.dart @@ -6,533 +6,351 @@ part of 'hub.dart'; // RiverpodGenerator // ************************************************************************** -String _$publisherStatsHash() => r'eea4ed98bf165cc785874f83b912bb7e23d1f7bc'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [publisherStats]. @ProviderFor(publisherStats) -const publisherStatsProvider = PublisherStatsFamily(); +const publisherStatsProvider = PublisherStatsFamily._(); -/// See also [publisherStats]. -class PublisherStatsFamily extends Family> { - /// See also [publisherStats]. - const PublisherStatsFamily(); +final class PublisherStatsProvider + extends + $FunctionalProvider< + AsyncValue, + SnPublisherStats?, + FutureOr + > + with + $FutureModifier, + $FutureProvider { + const PublisherStatsProvider._({ + required PublisherStatsFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'publisherStatsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [publisherStats]. - PublisherStatsProvider call(String? uname) { - return PublisherStatsProvider(uname); + @override + String debugGetCreateSourceHash() => _$publisherStatsHash(); + + @override + String toString() { + return r'publisherStatsProvider' + '' + '($argument)'; } + @$internal @override - PublisherStatsProvider getProviderOverride( - covariant PublisherStatsProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherStatsProvider'; -} - -/// See also [publisherStats]. -class PublisherStatsProvider - extends AutoDisposeFutureProvider { - /// See also [publisherStats]. - PublisherStatsProvider(String? uname) - : this._internal( - (ref) => publisherStats(ref as PublisherStatsRef, uname), - from: publisherStatsProvider, - name: r'publisherStatsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherStatsHash, - dependencies: PublisherStatsFamily._dependencies, - allTransitiveDependencies: - PublisherStatsFamily._allTransitiveDependencies, - uname: uname, - ); - - PublisherStatsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String? uname; - - @override - Override overrideWith( - FutureOr Function(PublisherStatsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PublisherStatsProvider._internal( - (ref) => create(ref as PublisherStatsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PublisherStatsProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String?; + return publisherStats(ref, argument); } @override bool operator ==(Object other) { - return other is PublisherStatsProvider && other.uname == uname; + return other is PublisherStatsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherStatsRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String? get uname; -} +String _$publisherStatsHash() => r'eea4ed98bf165cc785874f83b912bb7e23d1f7bc'; -class _PublisherStatsProviderElement - extends AutoDisposeFutureProviderElement - with PublisherStatsRef { - _PublisherStatsProviderElement(super.provider); +final class PublisherStatsFamily extends $Family + with $FunctionalFamilyOverride, String?> { + const PublisherStatsFamily._() + : super( + retry: null, + name: r'publisherStatsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + PublisherStatsProvider call(String? uname) => + PublisherStatsProvider._(argument: uname, from: this); @override - String? get uname => (origin as PublisherStatsProvider).uname; + String toString() => r'publisherStatsProvider'; +} + +@ProviderFor(publisherHeatmap) +const publisherHeatmapProvider = PublisherHeatmapFamily._(); + +final class PublisherHeatmapProvider + extends + $FunctionalProvider< + AsyncValue, + SnHeatmap?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const PublisherHeatmapProvider._({ + required PublisherHeatmapFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'publisherHeatmapProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$publisherHeatmapHash(); + + @override + String toString() { + return r'publisherHeatmapProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String?; + return publisherHeatmap(ref, argument); + } + + @override + bool operator ==(Object other) { + return other is PublisherHeatmapProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$publisherHeatmapHash() => r'5f70c55e14629ec8628445a317888e02fccd9af2'; -/// See also [publisherHeatmap]. -@ProviderFor(publisherHeatmap) -const publisherHeatmapProvider = PublisherHeatmapFamily(); - -/// See also [publisherHeatmap]. -class PublisherHeatmapFamily extends Family> { - /// See also [publisherHeatmap]. - const PublisherHeatmapFamily(); - - /// See also [publisherHeatmap]. - PublisherHeatmapProvider call(String? uname) { - return PublisherHeatmapProvider(uname); - } - - @override - PublisherHeatmapProvider getProviderOverride( - covariant PublisherHeatmapProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherHeatmapProvider'; -} - -/// See also [publisherHeatmap]. -class PublisherHeatmapProvider extends AutoDisposeFutureProvider { - /// See also [publisherHeatmap]. - PublisherHeatmapProvider(String? uname) - : this._internal( - (ref) => publisherHeatmap(ref as PublisherHeatmapRef, uname), - from: publisherHeatmapProvider, +final class PublisherHeatmapFamily extends $Family + with $FunctionalFamilyOverride, String?> { + const PublisherHeatmapFamily._() + : super( + retry: null, name: r'publisherHeatmapProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherHeatmapHash, - dependencies: PublisherHeatmapFamily._dependencies, - allTransitiveDependencies: - PublisherHeatmapFamily._allTransitiveDependencies, - uname: uname, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - PublisherHeatmapProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String? uname; + PublisherHeatmapProvider call(String? uname) => + PublisherHeatmapProvider._(argument: uname, from: this); @override - Override overrideWith( - FutureOr Function(PublisherHeatmapRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PublisherHeatmapProvider._internal( - (ref) => create(ref as PublisherHeatmapRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); + String toString() => r'publisherHeatmapProvider'; +} + +@ProviderFor(publisherIdentity) +const publisherIdentityProvider = PublisherIdentityFamily._(); + +final class PublisherIdentityProvider + extends + $FunctionalProvider< + AsyncValue, + SnPublisherMember?, + FutureOr + > + with + $FutureModifier, + $FutureProvider { + const PublisherIdentityProvider._({ + required PublisherIdentityFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'publisherIdentityProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$publisherIdentityHash(); + + @override + String toString() { + return r'publisherIdentityProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _PublisherHeatmapProviderElement(this); + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return publisherIdentity(ref, argument); } @override bool operator ==(Object other) { - return other is PublisherHeatmapProvider && other.uname == uname; + return other is PublisherIdentityProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherHeatmapRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String? get uname; -} - -class _PublisherHeatmapProviderElement - extends AutoDisposeFutureProviderElement - with PublisherHeatmapRef { - _PublisherHeatmapProviderElement(super.provider); - - @override - String? get uname => (origin as PublisherHeatmapProvider).uname; -} - String _$publisherIdentityHash() => r'299372f25fa4b2bf8e11a8ba2d645100fc38e76f'; -/// See also [publisherIdentity]. -@ProviderFor(publisherIdentity) -const publisherIdentityProvider = PublisherIdentityFamily(); - -/// See also [publisherIdentity]. -class PublisherIdentityFamily extends Family> { - /// See also [publisherIdentity]. - const PublisherIdentityFamily(); - - /// See also [publisherIdentity]. - PublisherIdentityProvider call(String uname) { - return PublisherIdentityProvider(uname); - } - - @override - PublisherIdentityProvider getProviderOverride( - covariant PublisherIdentityProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherIdentityProvider'; -} - -/// See also [publisherIdentity]. -class PublisherIdentityProvider - extends AutoDisposeFutureProvider { - /// See also [publisherIdentity]. - PublisherIdentityProvider(String uname) - : this._internal( - (ref) => publisherIdentity(ref as PublisherIdentityRef, uname), - from: publisherIdentityProvider, +final class PublisherIdentityFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PublisherIdentityFamily._() + : super( + retry: null, name: r'publisherIdentityProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherIdentityHash, - dependencies: PublisherIdentityFamily._dependencies, - allTransitiveDependencies: - PublisherIdentityFamily._allTransitiveDependencies, - uname: uname, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - PublisherIdentityProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; + PublisherIdentityProvider call(String uname) => + PublisherIdentityProvider._(argument: uname, from: this); @override - Override overrideWith( - FutureOr Function(PublisherIdentityRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PublisherIdentityProvider._internal( - (ref) => create(ref as PublisherIdentityRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); + String toString() => r'publisherIdentityProvider'; +} + +@ProviderFor(publisherFeatures) +const publisherFeaturesProvider = PublisherFeaturesFamily._(); + +final class PublisherFeaturesProvider + extends + $FunctionalProvider< + AsyncValue>, + Map, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const PublisherFeaturesProvider._({ + required PublisherFeaturesFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'publisherFeaturesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$publisherFeaturesHash(); + + @override + String toString() { + return r'publisherFeaturesProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _PublisherIdentityProviderElement(this); + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + final argument = this.argument as String?; + return publisherFeatures(ref, argument); } @override bool operator ==(Object other) { - return other is PublisherIdentityProvider && other.uname == uname; + return other is PublisherFeaturesProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherIdentityRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String get uname; -} - -class _PublisherIdentityProviderElement - extends AutoDisposeFutureProviderElement - with PublisherIdentityRef { - _PublisherIdentityProviderElement(super.provider); - - @override - String get uname => (origin as PublisherIdentityProvider).uname; -} - String _$publisherFeaturesHash() => r'08bace2d9a3da227ecec0cbf8709e55ee0646ca2'; -/// See also [publisherFeatures]. -@ProviderFor(publisherFeatures) -const publisherFeaturesProvider = PublisherFeaturesFamily(); - -/// See also [publisherFeatures]. -class PublisherFeaturesFamily extends Family>> { - /// See also [publisherFeatures]. - const PublisherFeaturesFamily(); - - /// See also [publisherFeatures]. - PublisherFeaturesProvider call(String? uname) { - return PublisherFeaturesProvider(uname); - } - - @override - PublisherFeaturesProvider getProviderOverride( - covariant PublisherFeaturesProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherFeaturesProvider'; -} - -/// See also [publisherFeatures]. -class PublisherFeaturesProvider - extends AutoDisposeFutureProvider> { - /// See also [publisherFeatures]. - PublisherFeaturesProvider(String? uname) - : this._internal( - (ref) => publisherFeatures(ref as PublisherFeaturesRef, uname), - from: publisherFeaturesProvider, +final class PublisherFeaturesFamily extends $Family + with $FunctionalFamilyOverride>, String?> { + const PublisherFeaturesFamily._() + : super( + retry: null, name: r'publisherFeaturesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherFeaturesHash, - dependencies: PublisherFeaturesFamily._dependencies, - allTransitiveDependencies: - PublisherFeaturesFamily._allTransitiveDependencies, - uname: uname, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - PublisherFeaturesProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String? uname; + PublisherFeaturesProvider call(String? uname) => + PublisherFeaturesProvider._(argument: uname, from: this); @override - Override overrideWith( - FutureOr> Function(PublisherFeaturesRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PublisherFeaturesProvider._internal( - (ref) => create(ref as PublisherFeaturesRef), - from: from, - name: null, + String toString() => r'publisherFeaturesProvider'; +} + +@ProviderFor(publisherInvites) +const publisherInvitesProvider = PublisherInvitesProvider._(); + +final class PublisherInvitesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const PublisherInvitesProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'publisherInvitesProvider', + isAutoDispose: true, dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); - } + $allTransitiveDependencies: null, + ); @override - AutoDisposeFutureProviderElement> createElement() { - return _PublisherFeaturesProviderElement(this); - } + String debugGetCreateSourceHash() => _$publisherInvitesHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - bool operator ==(Object other) { - return other is PublisherFeaturesProvider && other.uname == uname; + FutureOr> create(Ref ref) { + return publisherInvites(ref); } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); - } -} - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherFeaturesRef on AutoDisposeFutureProviderRef> { - /// The parameter `uname` of this provider. - String? get uname; -} - -class _PublisherFeaturesProviderElement - extends AutoDisposeFutureProviderElement> - with PublisherFeaturesRef { - _PublisherFeaturesProviderElement(super.provider); - - @override - String? get uname => (origin as PublisherFeaturesProvider).uname; } String _$publisherInvitesHash() => r'93aafc2f02af0a7a055ec1770b3999363dfaabdc'; - -/// See also [publisherInvites]. -@ProviderFor(publisherInvites) -final publisherInvitesProvider = - AutoDisposeFutureProvider>.internal( - publisherInvites, - name: r'publisherInvitesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherInvitesHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef PublisherInvitesRef = - AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/creators/poll/poll_list.dart b/lib/screens/creators/poll/poll_list.dart index 2ee598b6..23f0f306 100644 --- a/lib/screens/creators/poll/poll_list.dart +++ b/lib/screens/creators/poll/poll_list.dart @@ -21,11 +21,13 @@ final pollListNotifierProvider = AsyncNotifierProvider.family.autoDispose( PollListNotifier.new, ); -class PollListNotifier - extends AutoDisposeFamilyAsyncNotifier, String?> - with FamilyAsyncPaginationController { +class PollListNotifier extends AsyncNotifier> + with AsyncPaginationController { static const int pageSize = 20; + final String? arg; + PollListNotifier(this.arg); + @override Future> fetch() async { final client = ref.read(apiClientProvider); diff --git a/lib/screens/creators/poll/poll_list.g.dart b/lib/screens/creators/poll/poll_list.g.dart index dcfb847a..42674a53 100644 --- a/lib/screens/creators/poll/poll_list.g.dart +++ b/lib/screens/creators/poll/poll_list.g.dart @@ -6,147 +6,80 @@ part of 'poll_list.dart'; // RiverpodGenerator // ************************************************************************** -String _$pollWithStatsHash() => r'6bb910046ce1e09368f9922dbec52fdc2cc86740'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [pollWithStats]. @ProviderFor(pollWithStats) -const pollWithStatsProvider = PollWithStatsFamily(); +const pollWithStatsProvider = PollWithStatsFamily._(); -/// See also [pollWithStats]. -class PollWithStatsFamily extends Family> { - /// See also [pollWithStats]. - const PollWithStatsFamily(); +final class PollWithStatsProvider + extends + $FunctionalProvider< + AsyncValue, + SnPollWithStats, + FutureOr + > + with $FutureModifier, $FutureProvider { + const PollWithStatsProvider._({ + required PollWithStatsFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'pollWithStatsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [pollWithStats]. - PollWithStatsProvider call(String id) { - return PollWithStatsProvider(id); + @override + String debugGetCreateSourceHash() => _$pollWithStatsHash(); + + @override + String toString() { + return r'pollWithStatsProvider' + '' + '($argument)'; } + @$internal @override - PollWithStatsProvider getProviderOverride( - covariant PollWithStatsProvider provider, - ) { - return call(provider.id); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'pollWithStatsProvider'; -} - -/// See also [pollWithStats]. -class PollWithStatsProvider extends AutoDisposeFutureProvider { - /// See also [pollWithStats]. - PollWithStatsProvider(String id) - : this._internal( - (ref) => pollWithStats(ref as PollWithStatsRef, id), - from: pollWithStatsProvider, - name: r'pollWithStatsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$pollWithStatsHash, - dependencies: PollWithStatsFamily._dependencies, - allTransitiveDependencies: - PollWithStatsFamily._allTransitiveDependencies, - id: id, - ); - - PollWithStatsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.id, - }) : super.internal(); - - final String id; - - @override - Override overrideWith( - FutureOr Function(PollWithStatsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PollWithStatsProvider._internal( - (ref) => create(ref as PollWithStatsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - id: id, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PollWithStatsProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return pollWithStats(ref, argument); } @override bool operator ==(Object other) { - return other is PollWithStatsProvider && other.id == id; + return other is PollWithStatsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PollWithStatsRef on AutoDisposeFutureProviderRef { - /// The parameter `id` of this provider. - String get id; -} +String _$pollWithStatsHash() => r'6bb910046ce1e09368f9922dbec52fdc2cc86740'; -class _PollWithStatsProviderElement - extends AutoDisposeFutureProviderElement - with PollWithStatsRef { - _PollWithStatsProviderElement(super.provider); +final class PollWithStatsFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PollWithStatsFamily._() + : super( + retry: null, + name: r'pollWithStatsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + PollWithStatsProvider call(String id) => + PollWithStatsProvider._(argument: id, from: this); @override - String get id => (origin as PollWithStatsProvider).id; + String toString() => r'pollWithStatsProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/creators/publishers_form.g.dart b/lib/screens/creators/publishers_form.g.dart index e93d8b3e..8fd657f6 100644 --- a/lib/screens/creators/publishers_form.g.dart +++ b/lib/screens/creators/publishers_form.g.dart @@ -6,163 +6,121 @@ part of 'publishers_form.dart'; // RiverpodGenerator // ************************************************************************** -String _$publishersManagedHash() => r'ea83759fed9bd5119738b4d09f12b4476959e0a3'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [publishersManaged]. @ProviderFor(publishersManaged) -final publishersManagedProvider = - AutoDisposeFutureProvider>.internal( - publishersManaged, - name: r'publishersManagedProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publishersManagedHash, - dependencies: null, - allTransitiveDependencies: null, - ); +const publishersManagedProvider = PublishersManagedProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef PublishersManagedRef = AutoDisposeFutureProviderRef>; -String _$publisherHash() => r'18fb5c6b3d79dd8af4fbee108dec1a0e8a034038'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [publisher]. -@ProviderFor(publisher) -const publisherProvider = PublisherFamily(); - -/// See also [publisher]. -class PublisherFamily extends Family> { - /// See also [publisher]. - const PublisherFamily(); - - /// See also [publisher]. - PublisherProvider call(String? identifier) { - return PublisherProvider(identifier); - } - - @override - PublisherProvider getProviderOverride(covariant PublisherProvider provider) { - return call(provider.identifier); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherProvider'; -} - -/// See also [publisher]. -class PublisherProvider extends AutoDisposeFutureProvider { - /// See also [publisher]. - PublisherProvider(String? identifier) - : this._internal( - (ref) => publisher(ref as PublisherRef, identifier), - from: publisherProvider, - name: r'publisherProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherHash, - dependencies: PublisherFamily._dependencies, - allTransitiveDependencies: PublisherFamily._allTransitiveDependencies, - identifier: identifier, +final class PublishersManagedProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const PublishersManagedProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'publishersManagedProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, ); - PublisherProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.identifier, - }) : super.internal(); + @override + String debugGetCreateSourceHash() => _$publishersManagedHash(); - final String? identifier; + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Override overrideWith( - FutureOr Function(PublisherRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PublisherProvider._internal( - (ref) => create(ref as PublisherRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - identifier: identifier, - ), - ); + FutureOr> create(Ref ref) { + return publishersManaged(ref); + } +} + +String _$publishersManagedHash() => r'ea83759fed9bd5119738b4d09f12b4476959e0a3'; + +@ProviderFor(publisher) +const publisherProvider = PublisherFamily._(); + +final class PublisherProvider + extends + $FunctionalProvider< + AsyncValue, + SnPublisher?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const PublisherProvider._({ + required PublisherFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'publisherProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$publisherHash(); + + @override + String toString() { + return r'publisherProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _PublisherProviderElement(this); + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String?; + return publisher(ref, argument); } @override bool operator ==(Object other) { - return other is PublisherProvider && other.identifier == identifier; + return other is PublisherProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, identifier.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherRef on AutoDisposeFutureProviderRef { - /// The parameter `identifier` of this provider. - String? get identifier; -} +String _$publisherHash() => r'18fb5c6b3d79dd8af4fbee108dec1a0e8a034038'; -class _PublisherProviderElement - extends AutoDisposeFutureProviderElement - with PublisherRef { - _PublisherProviderElement(super.provider); +final class PublisherFamily extends $Family + with $FunctionalFamilyOverride, String?> { + const PublisherFamily._() + : super( + retry: null, + name: r'publisherProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + PublisherProvider call(String? identifier) => + PublisherProvider._(argument: identifier, from: this); @override - String? get identifier => (origin as PublisherProvider).identifier; + String toString() => r'publisherProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/creators/sites/site_detail.g.dart b/lib/screens/creators/sites/site_detail.g.dart index 9075ffc8..b36d41e8 100644 --- a/lib/screens/creators/sites/site_detail.g.dart +++ b/lib/screens/creators/sites/site_detail.g.dart @@ -6,168 +6,90 @@ part of 'site_detail.dart'; // RiverpodGenerator // ************************************************************************** -String _$publicationSiteDetailHash() => - r'e5d259ea39c4ba47e92d37e644fc3d84984927a9'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [publicationSiteDetail]. @ProviderFor(publicationSiteDetail) -const publicationSiteDetailProvider = PublicationSiteDetailFamily(); +const publicationSiteDetailProvider = PublicationSiteDetailFamily._(); -/// See also [publicationSiteDetail]. -class PublicationSiteDetailFamily - extends Family> { - /// See also [publicationSiteDetail]. - const PublicationSiteDetailFamily(); +final class PublicationSiteDetailProvider + extends + $FunctionalProvider< + AsyncValue, + SnPublicationSite, + FutureOr + > + with + $FutureModifier, + $FutureProvider { + const PublicationSiteDetailProvider._({ + required PublicationSiteDetailFamily super.from, + required (String, String) super.argument, + }) : super( + retry: null, + name: r'publicationSiteDetailProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [publicationSiteDetail]. - PublicationSiteDetailProvider call(String pubName, String siteSlug) { - return PublicationSiteDetailProvider(pubName, siteSlug); + @override + String debugGetCreateSourceHash() => _$publicationSiteDetailHash(); + + @override + String toString() { + return r'publicationSiteDetailProvider' + '' + '$argument'; } + @$internal @override - PublicationSiteDetailProvider getProviderOverride( - covariant PublicationSiteDetailProvider provider, - ) { - return call(provider.pubName, provider.siteSlug); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publicationSiteDetailProvider'; -} - -/// See also [publicationSiteDetail]. -class PublicationSiteDetailProvider - extends AutoDisposeFutureProvider { - /// See also [publicationSiteDetail]. - PublicationSiteDetailProvider(String pubName, String siteSlug) - : this._internal( - (ref) => publicationSiteDetail( - ref as PublicationSiteDetailRef, - pubName, - siteSlug, - ), - from: publicationSiteDetailProvider, - name: r'publicationSiteDetailProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publicationSiteDetailHash, - dependencies: PublicationSiteDetailFamily._dependencies, - allTransitiveDependencies: - PublicationSiteDetailFamily._allTransitiveDependencies, - pubName: pubName, - siteSlug: siteSlug, - ); - - PublicationSiteDetailProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.pubName, - required this.siteSlug, - }) : super.internal(); - - final String pubName; - final String siteSlug; - - @override - Override overrideWith( - FutureOr Function(PublicationSiteDetailRef provider) - create, - ) { - return ProviderOverride( - origin: this, - override: PublicationSiteDetailProvider._internal( - (ref) => create(ref as PublicationSiteDetailRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - pubName: pubName, - siteSlug: siteSlug, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PublicationSiteDetailProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as (String, String); + return publicationSiteDetail(ref, argument.$1, argument.$2); } @override bool operator ==(Object other) { - return other is PublicationSiteDetailProvider && - other.pubName == pubName && - other.siteSlug == siteSlug; + return other is PublicationSiteDetailProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, pubName.hashCode); - hash = _SystemHash.combine(hash, siteSlug.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublicationSiteDetailRef - on AutoDisposeFutureProviderRef { - /// The parameter `pubName` of this provider. - String get pubName; +String _$publicationSiteDetailHash() => + r'e5d259ea39c4ba47e92d37e644fc3d84984927a9'; - /// The parameter `siteSlug` of this provider. - String get siteSlug; -} +final class PublicationSiteDetailFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + (String, String) + > { + const PublicationSiteDetailFamily._() + : super( + retry: null, + name: r'publicationSiteDetailProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); -class _PublicationSiteDetailProviderElement - extends AutoDisposeFutureProviderElement - with PublicationSiteDetailRef { - _PublicationSiteDetailProviderElement(super.provider); + PublicationSiteDetailProvider call(String pubName, String siteSlug) => + PublicationSiteDetailProvider._( + argument: (pubName, siteSlug), + from: this, + ); @override - String get pubName => (origin as PublicationSiteDetailProvider).pubName; - @override - String get siteSlug => (origin as PublicationSiteDetailProvider).siteSlug; + String toString() => r'publicationSiteDetailProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/creators/sites/site_list.dart b/lib/screens/creators/sites/site_list.dart index 1c4151ed..ec090a0a 100644 --- a/lib/screens/creators/sites/site_list.dart +++ b/lib/screens/creators/sites/site_list.dart @@ -19,11 +19,13 @@ final siteListNotifierProvider = AsyncNotifierProvider.family.autoDispose( SiteListNotifier.new, ); -class SiteListNotifier - extends AutoDisposeFamilyAsyncNotifier, String> - with FamilyAsyncPaginationController { +class SiteListNotifier extends AsyncNotifier> + with AsyncPaginationController { static const int pageSize = 20; + final String arg; + SiteListNotifier(this.arg); + @override Future> fetch() async { final client = ref.read(apiClientProvider); diff --git a/lib/screens/creators/stickers/pack_detail.dart b/lib/screens/creators/stickers/pack_detail.dart index 2b578199..d2206b75 100644 --- a/lib/screens/creators/stickers/pack_detail.dart +++ b/lib/screens/creators/stickers/pack_detail.dart @@ -293,7 +293,7 @@ class StickerPackActionMenu extends HookConsumerWidget { if (confirm) { final client = ref.watch(apiClientProvider); client.delete('/sphere/stickers/$packId'); - ref.invalidate(stickerPacksNotifierProvider); + ref.invalidate(stickerPacksProvider); if (context.mounted) context.pop(true); } }); diff --git a/lib/screens/creators/stickers/pack_detail.g.dart b/lib/screens/creators/stickers/pack_detail.g.dart index 08dae19e..4f232d9c 100644 --- a/lib/screens/creators/stickers/pack_detail.g.dart +++ b/lib/screens/creators/stickers/pack_detail.g.dart @@ -6,272 +6,157 @@ part of 'pack_detail.dart'; // RiverpodGenerator // ************************************************************************** -String _$stickerPackContentHash() => - r'42d74f51022e67e35cb601c2f30f4f02e1f2be9d'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [stickerPackContent]. @ProviderFor(stickerPackContent) -const stickerPackContentProvider = StickerPackContentFamily(); +const stickerPackContentProvider = StickerPackContentFamily._(); -/// See also [stickerPackContent]. -class StickerPackContentFamily extends Family>> { - /// See also [stickerPackContent]. - const StickerPackContentFamily(); +final class StickerPackContentProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + const StickerPackContentProvider._({ + required StickerPackContentFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'stickerPackContentProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [stickerPackContent]. - StickerPackContentProvider call(String packId) { - return StickerPackContentProvider(packId); + @override + String debugGetCreateSourceHash() => _$stickerPackContentHash(); + + @override + String toString() { + return r'stickerPackContentProvider' + '' + '($argument)'; } + @$internal @override - StickerPackContentProvider getProviderOverride( - covariant StickerPackContentProvider provider, - ) { - return call(provider.packId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'stickerPackContentProvider'; -} - -/// See also [stickerPackContent]. -class StickerPackContentProvider - extends AutoDisposeFutureProvider> { - /// See also [stickerPackContent]. - StickerPackContentProvider(String packId) - : this._internal( - (ref) => stickerPackContent(ref as StickerPackContentRef, packId), - from: stickerPackContentProvider, - name: r'stickerPackContentProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$stickerPackContentHash, - dependencies: StickerPackContentFamily._dependencies, - allTransitiveDependencies: - StickerPackContentFamily._allTransitiveDependencies, - packId: packId, - ); - - StickerPackContentProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.packId, - }) : super.internal(); - - final String packId; - - @override - Override overrideWith( - FutureOr> Function(StickerPackContentRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: StickerPackContentProvider._internal( - (ref) => create(ref as StickerPackContentRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - packId: packId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _StickerPackContentProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return stickerPackContent(ref, argument); } @override bool operator ==(Object other) { - return other is StickerPackContentProvider && other.packId == packId; + return other is StickerPackContentProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, packId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin StickerPackContentRef on AutoDisposeFutureProviderRef> { - /// The parameter `packId` of this provider. - String get packId; -} +String _$stickerPackContentHash() => + r'42d74f51022e67e35cb601c2f30f4f02e1f2be9d'; -class _StickerPackContentProviderElement - extends AutoDisposeFutureProviderElement> - with StickerPackContentRef { - _StickerPackContentProviderElement(super.provider); +final class StickerPackContentFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const StickerPackContentFamily._() + : super( + retry: null, + name: r'stickerPackContentProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + StickerPackContentProvider call(String packId) => + StickerPackContentProvider._(argument: packId, from: this); @override - String get packId => (origin as StickerPackContentProvider).packId; + String toString() => r'stickerPackContentProvider'; +} + +@ProviderFor(stickerPackSticker) +const stickerPackStickerProvider = StickerPackStickerFamily._(); + +final class StickerPackStickerProvider + extends + $FunctionalProvider< + AsyncValue, + SnSticker?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const StickerPackStickerProvider._({ + required StickerPackStickerFamily super.from, + required StickerWithPackQuery? super.argument, + }) : super( + retry: null, + name: r'stickerPackStickerProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$stickerPackStickerHash(); + + @override + String toString() { + return r'stickerPackStickerProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as StickerWithPackQuery?; + return stickerPackSticker(ref, argument); + } + + @override + bool operator ==(Object other) { + return other is StickerPackStickerProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$stickerPackStickerHash() => r'5c553666b3a63530bdebae4b7cd52f303c5ab3a0'; -/// See also [stickerPackSticker]. -@ProviderFor(stickerPackSticker) -const stickerPackStickerProvider = StickerPackStickerFamily(); - -/// See also [stickerPackSticker]. -class StickerPackStickerFamily extends Family> { - /// See also [stickerPackSticker]. - const StickerPackStickerFamily(); - - /// See also [stickerPackSticker]. - StickerPackStickerProvider call(StickerWithPackQuery? query) { - return StickerPackStickerProvider(query); - } - - @override - StickerPackStickerProvider getProviderOverride( - covariant StickerPackStickerProvider provider, - ) { - return call(provider.query); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'stickerPackStickerProvider'; -} - -/// See also [stickerPackSticker]. -class StickerPackStickerProvider extends AutoDisposeFutureProvider { - /// See also [stickerPackSticker]. - StickerPackStickerProvider(StickerWithPackQuery? query) - : this._internal( - (ref) => stickerPackSticker(ref as StickerPackStickerRef, query), - from: stickerPackStickerProvider, +final class StickerPackStickerFamily extends $Family + with + $FunctionalFamilyOverride, StickerWithPackQuery?> { + const StickerPackStickerFamily._() + : super( + retry: null, name: r'stickerPackStickerProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$stickerPackStickerHash, - dependencies: StickerPackStickerFamily._dependencies, - allTransitiveDependencies: - StickerPackStickerFamily._allTransitiveDependencies, - query: query, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - StickerPackStickerProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.query, - }) : super.internal(); - - final StickerWithPackQuery? query; + StickerPackStickerProvider call(StickerWithPackQuery? query) => + StickerPackStickerProvider._(argument: query, from: this); @override - Override overrideWith( - FutureOr Function(StickerPackStickerRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: StickerPackStickerProvider._internal( - (ref) => create(ref as StickerPackStickerRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - query: query, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _StickerPackStickerProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is StickerPackStickerProvider && other.query == query; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, query.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'stickerPackStickerProvider'; } - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin StickerPackStickerRef on AutoDisposeFutureProviderRef { - /// The parameter `query` of this provider. - StickerWithPackQuery? get query; -} - -class _StickerPackStickerProviderElement - extends AutoDisposeFutureProviderElement - with StickerPackStickerRef { - _StickerPackStickerProviderElement(super.provider); - - @override - StickerWithPackQuery? get query => - (origin as StickerPackStickerProvider).query; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/creators/stickers/stickers.dart b/lib/screens/creators/stickers/stickers.dart index 1c5c8551..08441b93 100644 --- a/lib/screens/creators/stickers/stickers.dart +++ b/lib/screens/creators/stickers/stickers.dart @@ -48,7 +48,7 @@ class StickersScreen extends HookConsumerWidget { ), ).then((value) { if (value != null) { - ref.invalidate(stickerPacksNotifierProvider(pubName)); + ref.invalidate(stickerPacksProvider(pubName)); } }); }, @@ -83,8 +83,8 @@ class SliverStickerPacksList extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return PaginationList( - provider: stickerPacksNotifierProvider(pubName), - notifier: stickerPacksNotifierProvider(pubName).notifier, + provider: stickerPacksProvider(pubName), + notifier: stickerPacksProvider(pubName).notifier, itemBuilder: (context, index, sticker) { return ListTile( shape: RoundedRectangleBorder( @@ -139,15 +139,17 @@ class SliverStickerPacksList extends HookConsumerWidget { } } -final stickerPacksNotifierProvider = AsyncNotifierProvider.family.autoDispose( +final stickerPacksProvider = AsyncNotifierProvider.family.autoDispose( StickerPacksNotifier.new, ); -class StickerPacksNotifier - extends AutoDisposeFamilyAsyncNotifier, String> - with FamilyAsyncPaginationController { +class StickerPacksNotifier extends AsyncNotifier> + with AsyncPaginationController { static const int pageSize = 20; + final String arg; + StickerPacksNotifier(this.arg); + @override Future> fetch() async { final client = ref.read(apiClientProvider); diff --git a/lib/screens/creators/stickers/stickers.g.dart b/lib/screens/creators/stickers/stickers.g.dart index d6c4c1a6..0158b0c3 100644 --- a/lib/screens/creators/stickers/stickers.g.dart +++ b/lib/screens/creators/stickers/stickers.g.dart @@ -6,146 +6,80 @@ part of 'stickers.dart'; // RiverpodGenerator // ************************************************************************** -String _$stickerPackHash() => r'71ef84471237c8191918095094bdfc87d3920e77'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [stickerPack]. @ProviderFor(stickerPack) -const stickerPackProvider = StickerPackFamily(); +const stickerPackProvider = StickerPackFamily._(); -/// See also [stickerPack]. -class StickerPackFamily extends Family> { - /// See also [stickerPack]. - const StickerPackFamily(); +final class StickerPackProvider + extends + $FunctionalProvider< + AsyncValue, + SnStickerPack?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const StickerPackProvider._({ + required StickerPackFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'stickerPackProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [stickerPack]. - StickerPackProvider call(String? packId) { - return StickerPackProvider(packId); + @override + String debugGetCreateSourceHash() => _$stickerPackHash(); + + @override + String toString() { + return r'stickerPackProvider' + '' + '($argument)'; } + @$internal @override - StickerPackProvider getProviderOverride( - covariant StickerPackProvider provider, - ) { - return call(provider.packId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'stickerPackProvider'; -} - -/// See also [stickerPack]. -class StickerPackProvider extends AutoDisposeFutureProvider { - /// See also [stickerPack]. - StickerPackProvider(String? packId) - : this._internal( - (ref) => stickerPack(ref as StickerPackRef, packId), - from: stickerPackProvider, - name: r'stickerPackProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$stickerPackHash, - dependencies: StickerPackFamily._dependencies, - allTransitiveDependencies: StickerPackFamily._allTransitiveDependencies, - packId: packId, - ); - - StickerPackProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.packId, - }) : super.internal(); - - final String? packId; - - @override - Override overrideWith( - FutureOr Function(StickerPackRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: StickerPackProvider._internal( - (ref) => create(ref as StickerPackRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - packId: packId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _StickerPackProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String?; + return stickerPack(ref, argument); } @override bool operator ==(Object other) { - return other is StickerPackProvider && other.packId == packId; + return other is StickerPackProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, packId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin StickerPackRef on AutoDisposeFutureProviderRef { - /// The parameter `packId` of this provider. - String? get packId; -} +String _$stickerPackHash() => r'71ef84471237c8191918095094bdfc87d3920e77'; -class _StickerPackProviderElement - extends AutoDisposeFutureProviderElement - with StickerPackRef { - _StickerPackProviderElement(super.provider); +final class StickerPackFamily extends $Family + with $FunctionalFamilyOverride, String?> { + const StickerPackFamily._() + : super( + retry: null, + name: r'stickerPackProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + StickerPackProvider call(String? packId) => + StickerPackProvider._(argument: packId, from: this); @override - String? get packId => (origin as StickerPackProvider).packId; + String toString() => r'stickerPackProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/developers/app_secrets.g.dart b/lib/screens/developers/app_secrets.g.dart index 0d0702f6..fcdf1425 100644 --- a/lib/screens/developers/app_secrets.g.dart +++ b/lib/screens/developers/app_secrets.g.dart @@ -6,183 +6,92 @@ part of 'app_secrets.dart'; // RiverpodGenerator // ************************************************************************** -String _$customAppSecretsHash() => r'1bc62ad812487883ce739793b22a76168d656752'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [customAppSecrets]. @ProviderFor(customAppSecrets) -const customAppSecretsProvider = CustomAppSecretsFamily(); +const customAppSecretsProvider = CustomAppSecretsFamily._(); -/// See also [customAppSecrets]. -class CustomAppSecretsFamily extends Family>> { - /// See also [customAppSecrets]. - const CustomAppSecretsFamily(); +final class CustomAppSecretsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const CustomAppSecretsProvider._({ + required CustomAppSecretsFamily super.from, + required (String, String, String) super.argument, + }) : super( + retry: null, + name: r'customAppSecretsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [customAppSecrets]. - CustomAppSecretsProvider call( - String publisherName, - String projectId, - String appId, - ) { - return CustomAppSecretsProvider(publisherName, projectId, appId); + @override + String debugGetCreateSourceHash() => _$customAppSecretsHash(); + + @override + String toString() { + return r'customAppSecretsProvider' + '' + '$argument'; } + @$internal @override - CustomAppSecretsProvider getProviderOverride( - covariant CustomAppSecretsProvider provider, - ) { - return call(provider.publisherName, provider.projectId, provider.appId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'customAppSecretsProvider'; -} - -/// See also [customAppSecrets]. -class CustomAppSecretsProvider - extends AutoDisposeFutureProvider> { - /// See also [customAppSecrets]. - CustomAppSecretsProvider(String publisherName, String projectId, String appId) - : this._internal( - (ref) => customAppSecrets( - ref as CustomAppSecretsRef, - publisherName, - projectId, - appId, - ), - from: customAppSecretsProvider, - name: r'customAppSecretsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$customAppSecretsHash, - dependencies: CustomAppSecretsFamily._dependencies, - allTransitiveDependencies: - CustomAppSecretsFamily._allTransitiveDependencies, - publisherName: publisherName, - projectId: projectId, - appId: appId, - ); - - CustomAppSecretsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.publisherName, - required this.projectId, - required this.appId, - }) : super.internal(); - - final String publisherName; - final String projectId; - final String appId; - - @override - Override overrideWith( - FutureOr> Function(CustomAppSecretsRef provider) - create, - ) { - return ProviderOverride( - origin: this, - override: CustomAppSecretsProvider._internal( - (ref) => create(ref as CustomAppSecretsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - publisherName: publisherName, - projectId: projectId, - appId: appId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _CustomAppSecretsProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as (String, String, String); + return customAppSecrets(ref, argument.$1, argument.$2, argument.$3); } @override bool operator ==(Object other) { - return other is CustomAppSecretsProvider && - other.publisherName == publisherName && - other.projectId == projectId && - other.appId == appId; + return other is CustomAppSecretsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, publisherName.hashCode); - hash = _SystemHash.combine(hash, projectId.hashCode); - hash = _SystemHash.combine(hash, appId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin CustomAppSecretsRef - on AutoDisposeFutureProviderRef> { - /// The parameter `publisherName` of this provider. - String get publisherName; +String _$customAppSecretsHash() => r'1bc62ad812487883ce739793b22a76168d656752'; - /// The parameter `projectId` of this provider. - String get projectId; +final class CustomAppSecretsFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + (String, String, String) + > { + const CustomAppSecretsFamily._() + : super( + retry: null, + name: r'customAppSecretsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); - /// The parameter `appId` of this provider. - String get appId; + CustomAppSecretsProvider call( + String publisherName, + String projectId, + String appId, + ) => CustomAppSecretsProvider._( + argument: (publisherName, projectId, appId), + from: this, + ); + + @override + String toString() => r'customAppSecretsProvider'; } - -class _CustomAppSecretsProviderElement - extends AutoDisposeFutureProviderElement> - with CustomAppSecretsRef { - _CustomAppSecretsProviderElement(super.provider); - - @override - String get publisherName => - (origin as CustomAppSecretsProvider).publisherName; - @override - String get projectId => (origin as CustomAppSecretsProvider).projectId; - @override - String get appId => (origin as CustomAppSecretsProvider).appId; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/developers/apps.g.dart b/lib/screens/developers/apps.g.dart index f8514933..dd797b2a 100644 --- a/lib/screens/developers/apps.g.dart +++ b/lib/screens/developers/apps.g.dart @@ -6,300 +6,165 @@ part of 'apps.dart'; // RiverpodGenerator // ************************************************************************** -String _$customAppHash() => r'be05431ba8bf06fd20ee988a61c3663a68e15fc9'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [customApp]. @ProviderFor(customApp) -const customAppProvider = CustomAppFamily(); +const customAppProvider = CustomAppFamily._(); -/// See also [customApp]. -class CustomAppFamily extends Family> { - /// See also [customApp]. - const CustomAppFamily(); +final class CustomAppProvider + extends + $FunctionalProvider< + AsyncValue, + CustomApp, + FutureOr + > + with $FutureModifier, $FutureProvider { + const CustomAppProvider._({ + required CustomAppFamily super.from, + required (String, String, String) super.argument, + }) : super( + retry: null, + name: r'customAppProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [customApp]. - CustomAppProvider call(String publisherName, String projectId, String appId) { - return CustomAppProvider(publisherName, projectId, appId); + @override + String debugGetCreateSourceHash() => _$customAppHash(); + + @override + String toString() { + return r'customAppProvider' + '' + '$argument'; } + @$internal @override - CustomAppProvider getProviderOverride(covariant CustomAppProvider provider) { - return call(provider.publisherName, provider.projectId, provider.appId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'customAppProvider'; -} - -/// See also [customApp]. -class CustomAppProvider extends AutoDisposeFutureProvider { - /// See also [customApp]. - CustomAppProvider(String publisherName, String projectId, String appId) - : this._internal( - (ref) => - customApp(ref as CustomAppRef, publisherName, projectId, appId), - from: customAppProvider, - name: r'customAppProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$customAppHash, - dependencies: CustomAppFamily._dependencies, - allTransitiveDependencies: CustomAppFamily._allTransitiveDependencies, - publisherName: publisherName, - projectId: projectId, - appId: appId, - ); - - CustomAppProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.publisherName, - required this.projectId, - required this.appId, - }) : super.internal(); - - final String publisherName; - final String projectId; - final String appId; - - @override - Override overrideWith( - FutureOr Function(CustomAppRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: CustomAppProvider._internal( - (ref) => create(ref as CustomAppRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - publisherName: publisherName, - projectId: projectId, - appId: appId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _CustomAppProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as (String, String, String); + return customApp(ref, argument.$1, argument.$2, argument.$3); } @override bool operator ==(Object other) { - return other is CustomAppProvider && - other.publisherName == publisherName && - other.projectId == projectId && - other.appId == appId; + return other is CustomAppProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, publisherName.hashCode); - hash = _SystemHash.combine(hash, projectId.hashCode); - hash = _SystemHash.combine(hash, appId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin CustomAppRef on AutoDisposeFutureProviderRef { - /// The parameter `publisherName` of this provider. - String get publisherName; +String _$customAppHash() => r'be05431ba8bf06fd20ee988a61c3663a68e15fc9'; - /// The parameter `projectId` of this provider. - String get projectId; +final class CustomAppFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + (String, String, String) + > { + const CustomAppFamily._() + : super( + retry: null, + name: r'customAppProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); - /// The parameter `appId` of this provider. - String get appId; + CustomAppProvider call( + String publisherName, + String projectId, + String appId, + ) => CustomAppProvider._( + argument: (publisherName, projectId, appId), + from: this, + ); + + @override + String toString() => r'customAppProvider'; } -class _CustomAppProviderElement - extends AutoDisposeFutureProviderElement - with CustomAppRef { - _CustomAppProviderElement(super.provider); +@ProviderFor(customApps) +const customAppsProvider = CustomAppsFamily._(); + +final class CustomAppsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + const CustomAppsProvider._({ + required CustomAppsFamily super.from, + required (String, String) super.argument, + }) : super( + retry: null, + name: r'customAppsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); @override - String get publisherName => (origin as CustomAppProvider).publisherName; + String debugGetCreateSourceHash() => _$customAppsHash(); + @override - String get projectId => (origin as CustomAppProvider).projectId; + String toString() { + return r'customAppsProvider' + '' + '$argument'; + } + + @$internal @override - String get appId => (origin as CustomAppProvider).appId; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + final argument = this.argument as (String, String); + return customApps(ref, argument.$1, argument.$2); + } + + @override + bool operator ==(Object other) { + return other is CustomAppsProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$customAppsHash() => r'450bedaf4220b8963cb44afeb14d4c0e80f01b11'; -/// See also [customApps]. -@ProviderFor(customApps) -const customAppsProvider = CustomAppsFamily(); - -/// See also [customApps]. -class CustomAppsFamily extends Family>> { - /// See also [customApps]. - const CustomAppsFamily(); - - /// See also [customApps]. - CustomAppsProvider call(String publisherName, String projectId) { - return CustomAppsProvider(publisherName, projectId); - } - - @override - CustomAppsProvider getProviderOverride( - covariant CustomAppsProvider provider, - ) { - return call(provider.publisherName, provider.projectId); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'customAppsProvider'; -} - -/// See also [customApps]. -class CustomAppsProvider extends AutoDisposeFutureProvider> { - /// See also [customApps]. - CustomAppsProvider(String publisherName, String projectId) - : this._internal( - (ref) => customApps(ref as CustomAppsRef, publisherName, projectId), - from: customAppsProvider, +final class CustomAppsFamily extends $Family + with + $FunctionalFamilyOverride>, (String, String)> { + const CustomAppsFamily._() + : super( + retry: null, name: r'customAppsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$customAppsHash, - dependencies: CustomAppsFamily._dependencies, - allTransitiveDependencies: CustomAppsFamily._allTransitiveDependencies, - publisherName: publisherName, - projectId: projectId, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - CustomAppsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.publisherName, - required this.projectId, - }) : super.internal(); - - final String publisherName; - final String projectId; + CustomAppsProvider call(String publisherName, String projectId) => + CustomAppsProvider._(argument: (publisherName, projectId), from: this); @override - Override overrideWith( - FutureOr> Function(CustomAppsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: CustomAppsProvider._internal( - (ref) => create(ref as CustomAppsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - publisherName: publisherName, - projectId: projectId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _CustomAppsProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is CustomAppsProvider && - other.publisherName == publisherName && - other.projectId == projectId; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, publisherName.hashCode); - hash = _SystemHash.combine(hash, projectId.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'customAppsProvider'; } - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin CustomAppsRef on AutoDisposeFutureProviderRef> { - /// The parameter `publisherName` of this provider. - String get publisherName; - - /// The parameter `projectId` of this provider. - String get projectId; -} - -class _CustomAppsProviderElement - extends AutoDisposeFutureProviderElement> - with CustomAppsRef { - _CustomAppsProviderElement(super.provider); - - @override - String get publisherName => (origin as CustomAppsProvider).publisherName; - @override - String get projectId => (origin as CustomAppsProvider).projectId; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/developers/bot_keys.g.dart b/lib/screens/developers/bot_keys.g.dart index 7fde16a8..484ea4a4 100644 --- a/lib/screens/developers/bot_keys.g.dart +++ b/lib/screens/developers/bot_keys.g.dart @@ -6,167 +6,89 @@ part of 'bot_keys.dart'; // RiverpodGenerator // ************************************************************************** -String _$botKeysHash() => r'f7d1121833dc3da0cbd84b6171c2b2539edeb785'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [botKeys]. @ProviderFor(botKeys) -const botKeysProvider = BotKeysFamily(); +const botKeysProvider = BotKeysFamily._(); -/// See also [botKeys]. -class BotKeysFamily extends Family>> { - /// See also [botKeys]. - const BotKeysFamily(); +final class BotKeysProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const BotKeysProvider._({ + required BotKeysFamily super.from, + required (String, String, String) super.argument, + }) : super( + retry: null, + name: r'botKeysProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [botKeys]. - BotKeysProvider call(String publisherName, String projectId, String botId) { - return BotKeysProvider(publisherName, projectId, botId); + @override + String debugGetCreateSourceHash() => _$botKeysHash(); + + @override + String toString() { + return r'botKeysProvider' + '' + '$argument'; } + @$internal @override - BotKeysProvider getProviderOverride(covariant BotKeysProvider provider) { - return call(provider.publisherName, provider.projectId, provider.botId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'botKeysProvider'; -} - -/// See also [botKeys]. -class BotKeysProvider extends AutoDisposeFutureProvider> { - /// See also [botKeys]. - BotKeysProvider(String publisherName, String projectId, String botId) - : this._internal( - (ref) => botKeys(ref as BotKeysRef, publisherName, projectId, botId), - from: botKeysProvider, - name: r'botKeysProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$botKeysHash, - dependencies: BotKeysFamily._dependencies, - allTransitiveDependencies: BotKeysFamily._allTransitiveDependencies, - publisherName: publisherName, - projectId: projectId, - botId: botId, - ); - - BotKeysProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.publisherName, - required this.projectId, - required this.botId, - }) : super.internal(); - - final String publisherName; - final String projectId; - final String botId; - - @override - Override overrideWith( - FutureOr> Function(BotKeysRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: BotKeysProvider._internal( - (ref) => create(ref as BotKeysRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - publisherName: publisherName, - projectId: projectId, - botId: botId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _BotKeysProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as (String, String, String); + return botKeys(ref, argument.$1, argument.$2, argument.$3); } @override bool operator ==(Object other) { - return other is BotKeysProvider && - other.publisherName == publisherName && - other.projectId == projectId && - other.botId == botId; + return other is BotKeysProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, publisherName.hashCode); - hash = _SystemHash.combine(hash, projectId.hashCode); - hash = _SystemHash.combine(hash, botId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin BotKeysRef on AutoDisposeFutureProviderRef> { - /// The parameter `publisherName` of this provider. - String get publisherName; +String _$botKeysHash() => r'f7d1121833dc3da0cbd84b6171c2b2539edeb785'; - /// The parameter `projectId` of this provider. - String get projectId; +final class BotKeysFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + (String, String, String) + > { + const BotKeysFamily._() + : super( + retry: null, + name: r'botKeysProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); - /// The parameter `botId` of this provider. - String get botId; + BotKeysProvider call(String publisherName, String projectId, String botId) => + BotKeysProvider._( + argument: (publisherName, projectId, botId), + from: this, + ); + + @override + String toString() => r'botKeysProvider'; } - -class _BotKeysProviderElement - extends AutoDisposeFutureProviderElement> - with BotKeysRef { - _BotKeysProviderElement(super.provider); - - @override - String get publisherName => (origin as BotKeysProvider).publisherName; - @override - String get projectId => (origin as BotKeysProvider).projectId; - @override - String get botId => (origin as BotKeysProvider).botId; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/developers/bots.g.dart b/lib/screens/developers/bots.g.dart index ad316c04..c8367b10 100644 --- a/lib/screens/developers/bots.g.dart +++ b/lib/screens/developers/bots.g.dart @@ -6,151 +6,79 @@ part of 'bots.dart'; // RiverpodGenerator // ************************************************************************** -String _$botsHash() => r'15cefd5781350eb68208a342e85fcb0b9e0e3269'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [bots]. @ProviderFor(bots) -const botsProvider = BotsFamily(); +const botsProvider = BotsFamily._(); -/// See also [bots]. -class BotsFamily extends Family>> { - /// See also [bots]. - const BotsFamily(); +final class BotsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + const BotsProvider._({ + required BotsFamily super.from, + required (String, String) super.argument, + }) : super( + retry: null, + name: r'botsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [bots]. - BotsProvider call(String publisherName, String projectId) { - return BotsProvider(publisherName, projectId); + @override + String debugGetCreateSourceHash() => _$botsHash(); + + @override + String toString() { + return r'botsProvider' + '' + '$argument'; } + @$internal @override - BotsProvider getProviderOverride(covariant BotsProvider provider) { - return call(provider.publisherName, provider.projectId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'botsProvider'; -} - -/// See also [bots]. -class BotsProvider extends AutoDisposeFutureProvider> { - /// See also [bots]. - BotsProvider(String publisherName, String projectId) - : this._internal( - (ref) => bots(ref as BotsRef, publisherName, projectId), - from: botsProvider, - name: r'botsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$botsHash, - dependencies: BotsFamily._dependencies, - allTransitiveDependencies: BotsFamily._allTransitiveDependencies, - publisherName: publisherName, - projectId: projectId, - ); - - BotsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.publisherName, - required this.projectId, - }) : super.internal(); - - final String publisherName; - final String projectId; - - @override - Override overrideWith(FutureOr> Function(BotsRef provider) create) { - return ProviderOverride( - origin: this, - override: BotsProvider._internal( - (ref) => create(ref as BotsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - publisherName: publisherName, - projectId: projectId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _BotsProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as (String, String); + return bots(ref, argument.$1, argument.$2); } @override bool operator ==(Object other) { - return other is BotsProvider && - other.publisherName == publisherName && - other.projectId == projectId; + return other is BotsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, publisherName.hashCode); - hash = _SystemHash.combine(hash, projectId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin BotsRef on AutoDisposeFutureProviderRef> { - /// The parameter `publisherName` of this provider. - String get publisherName; +String _$botsHash() => r'15cefd5781350eb68208a342e85fcb0b9e0e3269'; - /// The parameter `projectId` of this provider. - String get projectId; -} +final class BotsFamily extends $Family + with $FunctionalFamilyOverride>, (String, String)> { + const BotsFamily._() + : super( + retry: null, + name: r'botsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); -class _BotsProviderElement extends AutoDisposeFutureProviderElement> - with BotsRef { - _BotsProviderElement(super.provider); + BotsProvider call(String publisherName, String projectId) => + BotsProvider._(argument: (publisherName, projectId), from: this); @override - String get publisherName => (origin as BotsProvider).publisherName; - @override - String get projectId => (origin as BotsProvider).projectId; + String toString() => r'botsProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/developers/edit_app.g.dart b/lib/screens/developers/edit_app.g.dart index d4c79505..3da908e5 100644 --- a/lib/screens/developers/edit_app.g.dart +++ b/lib/screens/developers/edit_app.g.dart @@ -6,167 +6,83 @@ part of 'edit_app.dart'; // RiverpodGenerator // ************************************************************************** -String _$customAppHash() => r'8e1b38f3dc9b04fad362ee1141fcbfc53f008c09'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [customApp]. @ProviderFor(customApp) -const customAppProvider = CustomAppFamily(); +const customAppProvider = CustomAppFamily._(); -/// See also [customApp]. -class CustomAppFamily extends Family> { - /// See also [customApp]. - const CustomAppFamily(); +final class CustomAppProvider + extends + $FunctionalProvider< + AsyncValue, + CustomApp?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const CustomAppProvider._({ + required CustomAppFamily super.from, + required (String, String, String) super.argument, + }) : super( + retry: null, + name: r'customAppProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [customApp]. - CustomAppProvider call(String publisherName, String projectId, String id) { - return CustomAppProvider(publisherName, projectId, id); + @override + String debugGetCreateSourceHash() => _$customAppHash(); + + @override + String toString() { + return r'customAppProvider' + '' + '$argument'; } + @$internal @override - CustomAppProvider getProviderOverride(covariant CustomAppProvider provider) { - return call(provider.publisherName, provider.projectId, provider.id); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'customAppProvider'; -} - -/// See also [customApp]. -class CustomAppProvider extends AutoDisposeFutureProvider { - /// See also [customApp]. - CustomAppProvider(String publisherName, String projectId, String id) - : this._internal( - (ref) => customApp(ref as CustomAppRef, publisherName, projectId, id), - from: customAppProvider, - name: r'customAppProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$customAppHash, - dependencies: CustomAppFamily._dependencies, - allTransitiveDependencies: CustomAppFamily._allTransitiveDependencies, - publisherName: publisherName, - projectId: projectId, - id: id, - ); - - CustomAppProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.publisherName, - required this.projectId, - required this.id, - }) : super.internal(); - - final String publisherName; - final String projectId; - final String id; - - @override - Override overrideWith( - FutureOr Function(CustomAppRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: CustomAppProvider._internal( - (ref) => create(ref as CustomAppRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - publisherName: publisherName, - projectId: projectId, - id: id, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _CustomAppProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as (String, String, String); + return customApp(ref, argument.$1, argument.$2, argument.$3); } @override bool operator ==(Object other) { - return other is CustomAppProvider && - other.publisherName == publisherName && - other.projectId == projectId && - other.id == id; + return other is CustomAppProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, publisherName.hashCode); - hash = _SystemHash.combine(hash, projectId.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin CustomAppRef on AutoDisposeFutureProviderRef { - /// The parameter `publisherName` of this provider. - String get publisherName; +String _$customAppHash() => r'8e1b38f3dc9b04fad362ee1141fcbfc53f008c09'; - /// The parameter `projectId` of this provider. - String get projectId; +final class CustomAppFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + (String, String, String) + > { + const CustomAppFamily._() + : super( + retry: null, + name: r'customAppProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); - /// The parameter `id` of this provider. - String get id; + CustomAppProvider call(String publisherName, String projectId, String id) => + CustomAppProvider._(argument: (publisherName, projectId, id), from: this); + + @override + String toString() => r'customAppProvider'; } - -class _CustomAppProviderElement - extends AutoDisposeFutureProviderElement - with CustomAppRef { - _CustomAppProviderElement(super.provider); - - @override - String get publisherName => (origin as CustomAppProvider).publisherName; - @override - String get projectId => (origin as CustomAppProvider).projectId; - @override - String get id => (origin as CustomAppProvider).id; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/developers/edit_bot.g.dart b/lib/screens/developers/edit_bot.g.dart index 2b1ae697..75fa0155 100644 --- a/lib/screens/developers/edit_bot.g.dart +++ b/lib/screens/developers/edit_bot.g.dart @@ -6,162 +6,74 @@ part of 'edit_bot.dart'; // RiverpodGenerator // ************************************************************************** -String _$botHash() => r'7bec47bb2a4061a5babc6d6d19c3d4c320c91188'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [bot]. @ProviderFor(bot) -const botProvider = BotFamily(); +const botProvider = BotFamily._(); -/// See also [bot]. -class BotFamily extends Family> { - /// See also [bot]. - const BotFamily(); +final class BotProvider + extends $FunctionalProvider, Bot?, FutureOr> + with $FutureModifier, $FutureProvider { + const BotProvider._({ + required BotFamily super.from, + required (String, String, String) super.argument, + }) : super( + retry: null, + name: r'botProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [bot]. - BotProvider call(String publisherName, String projectId, String id) { - return BotProvider(publisherName, projectId, id); + @override + String debugGetCreateSourceHash() => _$botHash(); + + @override + String toString() { + return r'botProvider' + '' + '$argument'; } + @$internal @override - BotProvider getProviderOverride(covariant BotProvider provider) { - return call(provider.publisherName, provider.projectId, provider.id); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'botProvider'; -} - -/// See also [bot]. -class BotProvider extends AutoDisposeFutureProvider { - /// See also [bot]. - BotProvider(String publisherName, String projectId, String id) - : this._internal( - (ref) => bot(ref as BotRef, publisherName, projectId, id), - from: botProvider, - name: r'botProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$botHash, - dependencies: BotFamily._dependencies, - allTransitiveDependencies: BotFamily._allTransitiveDependencies, - publisherName: publisherName, - projectId: projectId, - id: id, - ); - - BotProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.publisherName, - required this.projectId, - required this.id, - }) : super.internal(); - - final String publisherName; - final String projectId; - final String id; - - @override - Override overrideWith(FutureOr Function(BotRef provider) create) { - return ProviderOverride( - origin: this, - override: BotProvider._internal( - (ref) => create(ref as BotRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - publisherName: publisherName, - projectId: projectId, - id: id, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _BotProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as (String, String, String); + return bot(ref, argument.$1, argument.$2, argument.$3); } @override bool operator ==(Object other) { - return other is BotProvider && - other.publisherName == publisherName && - other.projectId == projectId && - other.id == id; + return other is BotProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, publisherName.hashCode); - hash = _SystemHash.combine(hash, projectId.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin BotRef on AutoDisposeFutureProviderRef { - /// The parameter `publisherName` of this provider. - String get publisherName; +String _$botHash() => r'7bec47bb2a4061a5babc6d6d19c3d4c320c91188'; - /// The parameter `projectId` of this provider. - String get projectId; +final class BotFamily extends $Family + with $FunctionalFamilyOverride, (String, String, String)> { + const BotFamily._() + : super( + retry: null, + name: r'botProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); - /// The parameter `id` of this provider. - String get id; + BotProvider call(String publisherName, String projectId, String id) => + BotProvider._(argument: (publisherName, projectId, id), from: this); + + @override + String toString() => r'botProvider'; } - -class _BotProviderElement extends AutoDisposeFutureProviderElement - with BotRef { - _BotProviderElement(super.provider); - - @override - String get publisherName => (origin as BotProvider).publisherName; - @override - String get projectId => (origin as BotProvider).projectId; - @override - String get id => (origin as BotProvider).id; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/developers/edit_project.g.dart b/lib/screens/developers/edit_project.g.dart index 0c525df6..f562e344 100644 --- a/lib/screens/developers/edit_project.g.dart +++ b/lib/screens/developers/edit_project.g.dart @@ -6,158 +6,80 @@ part of 'edit_project.dart'; // RiverpodGenerator // ************************************************************************** -String _$devProjectHash() => r'd92be3f5cdc510c2a377615ed5c70622a6842bf2'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [devProject]. @ProviderFor(devProject) -const devProjectProvider = DevProjectFamily(); +const devProjectProvider = DevProjectFamily._(); -/// See also [devProject]. -class DevProjectFamily extends Family> { - /// See also [devProject]. - const DevProjectFamily(); +final class DevProjectProvider + extends + $FunctionalProvider< + AsyncValue, + DevProject?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const DevProjectProvider._({ + required DevProjectFamily super.from, + required (String, String) super.argument, + }) : super( + retry: null, + name: r'devProjectProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [devProject]. - DevProjectProvider call(String pubName, String id) { - return DevProjectProvider(pubName, id); + @override + String debugGetCreateSourceHash() => _$devProjectHash(); + + @override + String toString() { + return r'devProjectProvider' + '' + '$argument'; } + @$internal @override - DevProjectProvider getProviderOverride( - covariant DevProjectProvider provider, - ) { - return call(provider.pubName, provider.id); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'devProjectProvider'; -} - -/// See also [devProject]. -class DevProjectProvider extends AutoDisposeFutureProvider { - /// See also [devProject]. - DevProjectProvider(String pubName, String id) - : this._internal( - (ref) => devProject(ref as DevProjectRef, pubName, id), - from: devProjectProvider, - name: r'devProjectProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$devProjectHash, - dependencies: DevProjectFamily._dependencies, - allTransitiveDependencies: DevProjectFamily._allTransitiveDependencies, - pubName: pubName, - id: id, - ); - - DevProjectProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.pubName, - required this.id, - }) : super.internal(); - - final String pubName; - final String id; - - @override - Override overrideWith( - FutureOr Function(DevProjectRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: DevProjectProvider._internal( - (ref) => create(ref as DevProjectRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - pubName: pubName, - id: id, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _DevProjectProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as (String, String); + return devProject(ref, argument.$1, argument.$2); } @override bool operator ==(Object other) { - return other is DevProjectProvider && - other.pubName == pubName && - other.id == id; + return other is DevProjectProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, pubName.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin DevProjectRef on AutoDisposeFutureProviderRef { - /// The parameter `pubName` of this provider. - String get pubName; +String _$devProjectHash() => r'd92be3f5cdc510c2a377615ed5c70622a6842bf2'; - /// The parameter `id` of this provider. - String get id; -} +final class DevProjectFamily extends $Family + with $FunctionalFamilyOverride, (String, String)> { + const DevProjectFamily._() + : super( + retry: null, + name: r'devProjectProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); -class _DevProjectProviderElement - extends AutoDisposeFutureProviderElement - with DevProjectRef { - _DevProjectProviderElement(super.provider); + DevProjectProvider call(String pubName, String id) => + DevProjectProvider._(argument: (pubName, id), from: this); @override - String get pubName => (origin as DevProjectProvider).pubName; - @override - String get id => (origin as DevProjectProvider).id; + String toString() => r'devProjectProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/developers/hub.g.dart b/lib/screens/developers/hub.g.dart index 611a649c..ac0fb995 100644 --- a/lib/screens/developers/hub.g.dart +++ b/lib/screens/developers/hub.g.dart @@ -6,287 +6,196 @@ part of 'hub.dart'; // RiverpodGenerator // ************************************************************************** -String _$developerStatsHash() => r'45546f29ec7cd1a9c3a4e0f4e39275e78bf34755'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [developerStats]. @ProviderFor(developerStats) -const developerStatsProvider = DeveloperStatsFamily(); +const developerStatsProvider = DeveloperStatsFamily._(); -/// See also [developerStats]. -class DeveloperStatsFamily extends Family> { - /// See also [developerStats]. - const DeveloperStatsFamily(); +final class DeveloperStatsProvider + extends + $FunctionalProvider< + AsyncValue, + DeveloperStats?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const DeveloperStatsProvider._({ + required DeveloperStatsFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'developerStatsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [developerStats]. - DeveloperStatsProvider call(String? uname) { - return DeveloperStatsProvider(uname); + @override + String debugGetCreateSourceHash() => _$developerStatsHash(); + + @override + String toString() { + return r'developerStatsProvider' + '' + '($argument)'; } + @$internal @override - DeveloperStatsProvider getProviderOverride( - covariant DeveloperStatsProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'developerStatsProvider'; -} - -/// See also [developerStats]. -class DeveloperStatsProvider - extends AutoDisposeFutureProvider { - /// See also [developerStats]. - DeveloperStatsProvider(String? uname) - : this._internal( - (ref) => developerStats(ref as DeveloperStatsRef, uname), - from: developerStatsProvider, - name: r'developerStatsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$developerStatsHash, - dependencies: DeveloperStatsFamily._dependencies, - allTransitiveDependencies: - DeveloperStatsFamily._allTransitiveDependencies, - uname: uname, - ); - - DeveloperStatsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String? uname; - - @override - Override overrideWith( - FutureOr Function(DeveloperStatsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: DeveloperStatsProvider._internal( - (ref) => create(ref as DeveloperStatsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _DeveloperStatsProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String?; + return developerStats(ref, argument); } @override bool operator ==(Object other) { - return other is DeveloperStatsProvider && other.uname == uname; + return other is DeveloperStatsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin DeveloperStatsRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String? get uname; -} +String _$developerStatsHash() => r'45546f29ec7cd1a9c3a4e0f4e39275e78bf34755'; -class _DeveloperStatsProviderElement - extends AutoDisposeFutureProviderElement - with DeveloperStatsRef { - _DeveloperStatsProviderElement(super.provider); +final class DeveloperStatsFamily extends $Family + with $FunctionalFamilyOverride, String?> { + const DeveloperStatsFamily._() + : super( + retry: null, + name: r'developerStatsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + DeveloperStatsProvider call(String? uname) => + DeveloperStatsProvider._(argument: uname, from: this); @override - String? get uname => (origin as DeveloperStatsProvider).uname; + String toString() => r'developerStatsProvider'; +} + +@ProviderFor(developers) +const developersProvider = DevelopersProvider._(); + +final class DevelopersProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const DevelopersProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'developersProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$developersHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return developers(ref); + } } String _$developersHash() => r'252341098617ac398ce133994453f318dd3edbd2'; -/// See also [developers]. -@ProviderFor(developers) -final developersProvider = - AutoDisposeFutureProvider>.internal( - developers, - name: r'developersProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$developersHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef DevelopersRef = AutoDisposeFutureProviderRef>; -String _$devProjectsHash() => r'715b395bebda785d38691ffee3b88e50b498c91a'; - -/// See also [devProjects]. @ProviderFor(devProjects) -const devProjectsProvider = DevProjectsFamily(); +const devProjectsProvider = DevProjectsFamily._(); -/// See also [devProjects]. -class DevProjectsFamily extends Family>> { - /// See also [devProjects]. - const DevProjectsFamily(); +final class DevProjectsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + const DevProjectsProvider._({ + required DevProjectsFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'devProjectsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [devProjects]. - DevProjectsProvider call(String pubName) { - return DevProjectsProvider(pubName); + @override + String debugGetCreateSourceHash() => _$devProjectsHash(); + + @override + String toString() { + return r'devProjectsProvider' + '' + '($argument)'; } + @$internal @override - DevProjectsProvider getProviderOverride( - covariant DevProjectsProvider provider, - ) { - return call(provider.pubName); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'devProjectsProvider'; -} - -/// See also [devProjects]. -class DevProjectsProvider extends AutoDisposeFutureProvider> { - /// See also [devProjects]. - DevProjectsProvider(String pubName) - : this._internal( - (ref) => devProjects(ref as DevProjectsRef, pubName), - from: devProjectsProvider, - name: r'devProjectsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$devProjectsHash, - dependencies: DevProjectsFamily._dependencies, - allTransitiveDependencies: DevProjectsFamily._allTransitiveDependencies, - pubName: pubName, - ); - - DevProjectsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.pubName, - }) : super.internal(); - - final String pubName; - - @override - Override overrideWith( - FutureOr> Function(DevProjectsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: DevProjectsProvider._internal( - (ref) => create(ref as DevProjectsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - pubName: pubName, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _DevProjectsProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return devProjects(ref, argument); } @override bool operator ==(Object other) { - return other is DevProjectsProvider && other.pubName == pubName; + return other is DevProjectsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, pubName.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin DevProjectsRef on AutoDisposeFutureProviderRef> { - /// The parameter `pubName` of this provider. - String get pubName; -} +String _$devProjectsHash() => r'715b395bebda785d38691ffee3b88e50b498c91a'; -class _DevProjectsProviderElement - extends AutoDisposeFutureProviderElement> - with DevProjectsRef { - _DevProjectsProviderElement(super.provider); +final class DevProjectsFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const DevProjectsFamily._() + : super( + retry: null, + name: r'devProjectsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + DevProjectsProvider call(String pubName) => + DevProjectsProvider._(argument: pubName, from: this); @override - String get pubName => (origin as DevProjectsProvider).pubName; + String toString() => r'devProjectsProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/discovery/articles.dart b/lib/screens/discovery/articles.dart index 52469306..3e854f22 100644 --- a/lib/screens/discovery/articles.dart +++ b/lib/screens/discovery/articles.dart @@ -22,11 +22,13 @@ final articlesListNotifierProvider = AsyncNotifierProvider.family.autoDispose( ArticlesListNotifier.new, ); -class ArticlesListNotifier - extends AutoDisposeFamilyAsyncNotifier, ArticleListQuery> - with FamilyAsyncPaginationController { +class ArticlesListNotifier extends AsyncNotifier> + with AsyncPaginationController { static const int pageSize = 20; + final ArticleListQuery arg; + ArticlesListNotifier(this.arg); + @override Future> fetch() async { final client = ref.read(apiClientProvider); diff --git a/lib/screens/discovery/articles.g.dart b/lib/screens/discovery/articles.g.dart index 1f041361..634bbe3a 100644 --- a/lib/screens/discovery/articles.g.dart +++ b/lib/screens/discovery/articles.g.dart @@ -6,24 +6,44 @@ part of 'articles.dart'; // RiverpodGenerator // ************************************************************************** -String _$subscribedFeedsHash() => r'5c0c8c30c5f543f6ea1d39786a6778f77ba5b3df'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [subscribedFeeds]. @ProviderFor(subscribedFeeds) -final subscribedFeedsProvider = - AutoDisposeFutureProvider>.internal( - subscribedFeeds, - name: r'subscribedFeedsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$subscribedFeedsHash, - dependencies: null, - allTransitiveDependencies: null, - ); +const subscribedFeedsProvider = SubscribedFeedsProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef SubscribedFeedsRef = AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class SubscribedFeedsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + const SubscribedFeedsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'subscribedFeedsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$subscribedFeedsHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return subscribedFeeds(ref); + } +} + +String _$subscribedFeedsHash() => r'5c0c8c30c5f543f6ea1d39786a6778f77ba5b3df'; diff --git a/lib/screens/discovery/feeds/feed_detail.dart b/lib/screens/discovery/feeds/feed_detail.dart index f48b6389..57e4af00 100644 --- a/lib/screens/discovery/feeds/feed_detail.dart +++ b/lib/screens/discovery/feeds/feed_detail.dart @@ -26,10 +26,13 @@ final marketplaceWebFeedContentNotifierProvider = AsyncNotifierProvider.family .autoDispose(MarketplaceWebFeedContentNotifier.new); class MarketplaceWebFeedContentNotifier - extends AutoDisposeFamilyAsyncNotifier, String> - with FamilyAsyncPaginationController { + extends AsyncNotifier> + with AsyncPaginationController { static const int pageSize = 20; + final String arg; + MarketplaceWebFeedContentNotifier(this.arg); + @override Future> fetch() async { final client = ref.read(apiClientProvider); diff --git a/lib/screens/discovery/feeds/feed_detail.g.dart b/lib/screens/discovery/feeds/feed_detail.g.dart index 03905634..9aac3cb7 100644 --- a/lib/screens/discovery/feeds/feed_detail.g.dart +++ b/lib/screens/discovery/feeds/feed_detail.g.dart @@ -6,289 +6,161 @@ part of 'feed_detail.dart'; // RiverpodGenerator // ************************************************************************** -String _$marketplaceWebFeedHash() => - r'8383f94f1bc272b903c341b8d95000313b69d14c'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [marketplaceWebFeed]. @ProviderFor(marketplaceWebFeed) -const marketplaceWebFeedProvider = MarketplaceWebFeedFamily(); +const marketplaceWebFeedProvider = MarketplaceWebFeedFamily._(); -/// See also [marketplaceWebFeed]. -class MarketplaceWebFeedFamily extends Family> { - /// See also [marketplaceWebFeed]. - const MarketplaceWebFeedFamily(); +final class MarketplaceWebFeedProvider + extends + $FunctionalProvider< + AsyncValue, + SnWebFeed, + FutureOr + > + with $FutureModifier, $FutureProvider { + const MarketplaceWebFeedProvider._({ + required MarketplaceWebFeedFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'marketplaceWebFeedProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [marketplaceWebFeed]. - MarketplaceWebFeedProvider call(String feedId) { - return MarketplaceWebFeedProvider(feedId); + @override + String debugGetCreateSourceHash() => _$marketplaceWebFeedHash(); + + @override + String toString() { + return r'marketplaceWebFeedProvider' + '' + '($argument)'; } + @$internal @override - MarketplaceWebFeedProvider getProviderOverride( - covariant MarketplaceWebFeedProvider provider, - ) { - return call(provider.feedId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'marketplaceWebFeedProvider'; -} - -/// See also [marketplaceWebFeed]. -class MarketplaceWebFeedProvider extends AutoDisposeFutureProvider { - /// See also [marketplaceWebFeed]. - MarketplaceWebFeedProvider(String feedId) - : this._internal( - (ref) => marketplaceWebFeed(ref as MarketplaceWebFeedRef, feedId), - from: marketplaceWebFeedProvider, - name: r'marketplaceWebFeedProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$marketplaceWebFeedHash, - dependencies: MarketplaceWebFeedFamily._dependencies, - allTransitiveDependencies: - MarketplaceWebFeedFamily._allTransitiveDependencies, - feedId: feedId, - ); - - MarketplaceWebFeedProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.feedId, - }) : super.internal(); - - final String feedId; - - @override - Override overrideWith( - FutureOr Function(MarketplaceWebFeedRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: MarketplaceWebFeedProvider._internal( - (ref) => create(ref as MarketplaceWebFeedRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - feedId: feedId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _MarketplaceWebFeedProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return marketplaceWebFeed(ref, argument); } @override bool operator ==(Object other) { - return other is MarketplaceWebFeedProvider && other.feedId == feedId; + return other is MarketplaceWebFeedProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, feedId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin MarketplaceWebFeedRef on AutoDisposeFutureProviderRef { - /// The parameter `feedId` of this provider. - String get feedId; -} +String _$marketplaceWebFeedHash() => + r'8383f94f1bc272b903c341b8d95000313b69d14c'; -class _MarketplaceWebFeedProviderElement - extends AutoDisposeFutureProviderElement - with MarketplaceWebFeedRef { - _MarketplaceWebFeedProviderElement(super.provider); +final class MarketplaceWebFeedFamily extends $Family + with $FunctionalFamilyOverride, String> { + const MarketplaceWebFeedFamily._() + : super( + retry: null, + name: r'marketplaceWebFeedProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + MarketplaceWebFeedProvider call(String feedId) => + MarketplaceWebFeedProvider._(argument: feedId, from: this); @override - String get feedId => (origin as MarketplaceWebFeedProvider).feedId; + String toString() => r'marketplaceWebFeedProvider'; +} + +/// Provider for web feed subscription status + +@ProviderFor(marketplaceWebFeedSubscription) +const marketplaceWebFeedSubscriptionProvider = + MarketplaceWebFeedSubscriptionFamily._(); + +/// Provider for web feed subscription status + +final class MarketplaceWebFeedSubscriptionProvider + extends $FunctionalProvider, bool, FutureOr> + with $FutureModifier, $FutureProvider { + /// Provider for web feed subscription status + const MarketplaceWebFeedSubscriptionProvider._({ + required MarketplaceWebFeedSubscriptionFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'marketplaceWebFeedSubscriptionProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$marketplaceWebFeedSubscriptionHash(); + + @override + String toString() { + return r'marketplaceWebFeedSubscriptionProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return marketplaceWebFeedSubscription(ref, feedId: argument); + } + + @override + bool operator ==(Object other) { + return other is MarketplaceWebFeedSubscriptionProvider && + other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$marketplaceWebFeedSubscriptionHash() => r'2ff06a48ed7d4236b57412ecca55e94c0a0b6330'; /// Provider for web feed subscription status -/// -/// Copied from [marketplaceWebFeedSubscription]. -@ProviderFor(marketplaceWebFeedSubscription) -const marketplaceWebFeedSubscriptionProvider = - MarketplaceWebFeedSubscriptionFamily(); -/// Provider for web feed subscription status -/// -/// Copied from [marketplaceWebFeedSubscription]. -class MarketplaceWebFeedSubscriptionFamily extends Family> { - /// Provider for web feed subscription status - /// - /// Copied from [marketplaceWebFeedSubscription]. - const MarketplaceWebFeedSubscriptionFamily(); - - /// Provider for web feed subscription status - /// - /// Copied from [marketplaceWebFeedSubscription]. - MarketplaceWebFeedSubscriptionProvider call({required String feedId}) { - return MarketplaceWebFeedSubscriptionProvider(feedId: feedId); - } - - @override - MarketplaceWebFeedSubscriptionProvider getProviderOverride( - covariant MarketplaceWebFeedSubscriptionProvider provider, - ) { - return call(feedId: provider.feedId); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'marketplaceWebFeedSubscriptionProvider'; -} - -/// Provider for web feed subscription status -/// -/// Copied from [marketplaceWebFeedSubscription]. -class MarketplaceWebFeedSubscriptionProvider - extends AutoDisposeFutureProvider { - /// Provider for web feed subscription status - /// - /// Copied from [marketplaceWebFeedSubscription]. - MarketplaceWebFeedSubscriptionProvider({required String feedId}) - : this._internal( - (ref) => marketplaceWebFeedSubscription( - ref as MarketplaceWebFeedSubscriptionRef, - feedId: feedId, - ), - from: marketplaceWebFeedSubscriptionProvider, +final class MarketplaceWebFeedSubscriptionFamily extends $Family + with $FunctionalFamilyOverride, String> { + const MarketplaceWebFeedSubscriptionFamily._() + : super( + retry: null, name: r'marketplaceWebFeedSubscriptionProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$marketplaceWebFeedSubscriptionHash, - dependencies: MarketplaceWebFeedSubscriptionFamily._dependencies, - allTransitiveDependencies: - MarketplaceWebFeedSubscriptionFamily._allTransitiveDependencies, - feedId: feedId, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - MarketplaceWebFeedSubscriptionProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.feedId, - }) : super.internal(); + /// Provider for web feed subscription status - final String feedId; + MarketplaceWebFeedSubscriptionProvider call({required String feedId}) => + MarketplaceWebFeedSubscriptionProvider._(argument: feedId, from: this); @override - Override overrideWith( - FutureOr Function(MarketplaceWebFeedSubscriptionRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: MarketplaceWebFeedSubscriptionProvider._internal( - (ref) => create(ref as MarketplaceWebFeedSubscriptionRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - feedId: feedId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _MarketplaceWebFeedSubscriptionProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is MarketplaceWebFeedSubscriptionProvider && - other.feedId == feedId; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, feedId.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'marketplaceWebFeedSubscriptionProvider'; } - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin MarketplaceWebFeedSubscriptionRef on AutoDisposeFutureProviderRef { - /// The parameter `feedId` of this provider. - String get feedId; -} - -class _MarketplaceWebFeedSubscriptionProviderElement - extends AutoDisposeFutureProviderElement - with MarketplaceWebFeedSubscriptionRef { - _MarketplaceWebFeedSubscriptionProviderElement(super.provider); - - @override - String get feedId => - (origin as MarketplaceWebFeedSubscriptionProvider).feedId; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/explore.dart b/lib/screens/explore.dart index 18524c18..8c4e90f4 100644 --- a/lib/screens/explore.dart +++ b/lib/screens/explore.dart @@ -73,19 +73,21 @@ class ExploreScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final currentFilter = useState(null); - final notifier = ref.watch(activityListNotifierProvider.notifier); + final notifier = ref.watch(activityListProvider.notifier); useEffect(() { // Set FAB type to chat + final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier); Future(() { - fabMenuNotifier.state = FabMenuType.compose; + fabMenuNotifier.setMenuType(FabMenuType.compose); }); return () { // Clean up: reset FAB type to main + final fabMenu = ref.read(fabMenuTypeProvider); WidgetsBinding.instance.addPostFrameCallback((_) { - if (fabMenuNotifier.state == FabMenuType.compose) { - fabMenuNotifier.state = FabMenuType.main; + if (fabMenu == FabMenuType.compose) { + fabMenuNotifier.setMenuType(FabMenuType.main); } }); }; @@ -99,7 +101,7 @@ class ExploreScreen extends HookConsumerWidget { // Listen for post creation events to refresh activities useEffect(() { final subscription = eventBus.on().listen((event) { - ref.invalidate(activityListNotifierProvider); + ref.invalidate(activityListProvider); }); return subscription.cancel; }, []); @@ -116,9 +118,7 @@ class ExploreScreen extends HookConsumerWidget { final user = ref.watch(userInfoProvider); - final notificationCount = ref.watch( - notificationUnreadCountNotifierProvider, - ); + final notificationCount = ref.watch(notificationUnreadCountProvider); final isWide = isWideScreen(context); @@ -316,8 +316,8 @@ class ExploreScreen extends HookConsumerWidget { final isWide = isWideScreen(context); return PaginationWidget( - provider: activityListNotifierProvider, - notifier: activityListNotifierProvider.notifier, + provider: activityListProvider, + notifier: activityListProvider.notifier, // Sliver list cannot provide refresh handled by the pagination list isRefreshable: false, isSliver: true, @@ -339,7 +339,7 @@ class ExploreScreen extends HookConsumerWidget { ) { final bodyView = _buildActivityList(context, ref); - final notifier = ref.watch(activityListNotifierProvider.notifier); + final notifier = ref.watch(activityListProvider.notifier); return Row( spacing: 12, @@ -557,13 +557,11 @@ class ExploreScreen extends HookConsumerWidget { String? currentFilter, ) { final user = ref.watch(userInfoProvider); - final notificationCount = ref.watch( - notificationUnreadCountNotifierProvider, - ); + final notificationCount = ref.watch(notificationUnreadCountProvider); final bodyView = _buildActivityList(context, ref); - final notifier = ref.watch(activityListNotifierProvider.notifier); + final notifier = ref.watch(activityListProvider.notifier); return Expanded( child: ClipRRect( @@ -737,7 +735,7 @@ class _ActivityListView extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final notifier = ref.watch(activityListNotifierProvider.notifier); + final notifier = ref.watch(activityListProvider.notifier); return SliverList.separated( itemCount: data.length + 1, diff --git a/lib/screens/files/file_list.dart b/lib/screens/files/file_list.dart index 431d6795..a51c086e 100644 --- a/lib/screens/files/file_list.dart +++ b/lib/screens/files/file_list.dart @@ -116,7 +116,7 @@ class FileListScreen extends HookConsumerWidget { completer.future .then((uploadedFile) { if (uploadedFile != null) { - ref.invalidate(indexedCloudFileListNotifierProvider); + ref.invalidate(indexedCloudFileListProvider); } }) .catchError((error) { diff --git a/lib/screens/lottery.g.dart b/lib/screens/lottery.g.dart index a06ef056..c7c2cbab 100644 --- a/lib/screens/lottery.g.dart +++ b/lib/screens/lottery.g.dart @@ -6,302 +6,173 @@ part of 'lottery.dart'; // RiverpodGenerator // ************************************************************************** -String _$lotteryTicketsHash() => r'dd17cd721fc3b176ffa0ee0a85d0d850740e5e80'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [lotteryTickets]. @ProviderFor(lotteryTickets) -const lotteryTicketsProvider = LotteryTicketsFamily(); +const lotteryTicketsProvider = LotteryTicketsFamily._(); -/// See also [lotteryTickets]. -class LotteryTicketsFamily extends Family>> { - /// See also [lotteryTickets]. - const LotteryTicketsFamily(); +final class LotteryTicketsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const LotteryTicketsProvider._({ + required LotteryTicketsFamily super.from, + required ({int offset, int take}) super.argument, + }) : super( + retry: null, + name: r'lotteryTicketsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [lotteryTickets]. - LotteryTicketsProvider call({int offset = 0, int take = 20}) { - return LotteryTicketsProvider(offset: offset, take: take); + @override + String debugGetCreateSourceHash() => _$lotteryTicketsHash(); + + @override + String toString() { + return r'lotteryTicketsProvider' + '' + '$argument'; } + @$internal @override - LotteryTicketsProvider getProviderOverride( - covariant LotteryTicketsProvider provider, - ) { - return call(offset: provider.offset, take: provider.take); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'lotteryTicketsProvider'; -} - -/// See also [lotteryTickets]. -class LotteryTicketsProvider - extends AutoDisposeFutureProvider> { - /// See also [lotteryTickets]. - LotteryTicketsProvider({int offset = 0, int take = 20}) - : this._internal( - (ref) => lotteryTickets( - ref as LotteryTicketsRef, - offset: offset, - take: take, - ), - from: lotteryTicketsProvider, - name: r'lotteryTicketsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$lotteryTicketsHash, - dependencies: LotteryTicketsFamily._dependencies, - allTransitiveDependencies: - LotteryTicketsFamily._allTransitiveDependencies, - offset: offset, - take: take, - ); - - LotteryTicketsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.offset, - required this.take, - }) : super.internal(); - - final int offset; - final int take; - - @override - Override overrideWith( - FutureOr> Function(LotteryTicketsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: LotteryTicketsProvider._internal( - (ref) => create(ref as LotteryTicketsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - offset: offset, - take: take, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _LotteryTicketsProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as ({int offset, int take}); + return lotteryTickets(ref, offset: argument.offset, take: argument.take); } @override bool operator ==(Object other) { - return other is LotteryTicketsProvider && - other.offset == offset && - other.take == take; + return other is LotteryTicketsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, offset.hashCode); - hash = _SystemHash.combine(hash, take.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin LotteryTicketsRef on AutoDisposeFutureProviderRef> { - /// The parameter `offset` of this provider. - int get offset; +String _$lotteryTicketsHash() => r'dd17cd721fc3b176ffa0ee0a85d0d850740e5e80'; - /// The parameter `take` of this provider. - int get take; +final class LotteryTicketsFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + ({int offset, int take}) + > { + const LotteryTicketsFamily._() + : super( + retry: null, + name: r'lotteryTicketsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + LotteryTicketsProvider call({int offset = 0, int take = 20}) => + LotteryTicketsProvider._( + argument: (offset: offset, take: take), + from: this, + ); + + @override + String toString() => r'lotteryTicketsProvider'; } -class _LotteryTicketsProviderElement - extends AutoDisposeFutureProviderElement> - with LotteryTicketsRef { - _LotteryTicketsProviderElement(super.provider); +@ProviderFor(lotteryRecords) +const lotteryRecordsProvider = LotteryRecordsFamily._(); + +final class LotteryRecordsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const LotteryRecordsProvider._({ + required LotteryRecordsFamily super.from, + required ({int offset, int take}) super.argument, + }) : super( + retry: null, + name: r'lotteryRecordsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); @override - int get offset => (origin as LotteryTicketsProvider).offset; + String debugGetCreateSourceHash() => _$lotteryRecordsHash(); + @override - int get take => (origin as LotteryTicketsProvider).take; + String toString() { + return r'lotteryRecordsProvider' + '' + '$argument'; + } + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + final argument = this.argument as ({int offset, int take}); + return lotteryRecords(ref, offset: argument.offset, take: argument.take); + } + + @override + bool operator ==(Object other) { + return other is LotteryRecordsProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$lotteryRecordsHash() => r'55c657460f18d9777741d09013b445ca036863f3'; -/// See also [lotteryRecords]. -@ProviderFor(lotteryRecords) -const lotteryRecordsProvider = LotteryRecordsFamily(); - -/// See also [lotteryRecords]. -class LotteryRecordsFamily extends Family>> { - /// See also [lotteryRecords]. - const LotteryRecordsFamily(); - - /// See also [lotteryRecords]. - LotteryRecordsProvider call({int offset = 0, int take = 20}) { - return LotteryRecordsProvider(offset: offset, take: take); - } - - @override - LotteryRecordsProvider getProviderOverride( - covariant LotteryRecordsProvider provider, - ) { - return call(offset: provider.offset, take: provider.take); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'lotteryRecordsProvider'; -} - -/// See also [lotteryRecords]. -class LotteryRecordsProvider - extends AutoDisposeFutureProvider> { - /// See also [lotteryRecords]. - LotteryRecordsProvider({int offset = 0, int take = 20}) - : this._internal( - (ref) => lotteryRecords( - ref as LotteryRecordsRef, - offset: offset, - take: take, - ), - from: lotteryRecordsProvider, +final class LotteryRecordsFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + ({int offset, int take}) + > { + const LotteryRecordsFamily._() + : super( + retry: null, name: r'lotteryRecordsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$lotteryRecordsHash, - dependencies: LotteryRecordsFamily._dependencies, - allTransitiveDependencies: - LotteryRecordsFamily._allTransitiveDependencies, - offset: offset, - take: take, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - LotteryRecordsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.offset, - required this.take, - }) : super.internal(); - - final int offset; - final int take; + LotteryRecordsProvider call({int offset = 0, int take = 20}) => + LotteryRecordsProvider._( + argument: (offset: offset, take: take), + from: this, + ); @override - Override overrideWith( - FutureOr> Function(LotteryRecordsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: LotteryRecordsProvider._internal( - (ref) => create(ref as LotteryRecordsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - offset: offset, - take: take, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _LotteryRecordsProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is LotteryRecordsProvider && - other.offset == offset && - other.take == take; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, offset.hashCode); - hash = _SystemHash.combine(hash, take.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'lotteryRecordsProvider'; } - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin LotteryRecordsRef on AutoDisposeFutureProviderRef> { - /// The parameter `offset` of this provider. - int get offset; - - /// The parameter `take` of this provider. - int get take; -} - -class _LotteryRecordsProviderElement - extends AutoDisposeFutureProviderElement> - with LotteryRecordsRef { - _LotteryRecordsProviderElement(super.provider); - - @override - int get offset => (origin as LotteryRecordsProvider).offset; - @override - int get take => (origin as LotteryRecordsProvider).take; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/notification.dart b/lib/screens/notification.dart index 3fa5f5e5..00ca8d66 100644 --- a/lib/screens/notification.dart +++ b/lib/screens/notification.dart @@ -82,7 +82,7 @@ class NotificationUnreadCountNotifier } } -final notificationListNotifierProvider = AsyncNotifierProvider( +final notificationListProvider = AsyncNotifierProvider( NotificationListNotifier.new, ); @@ -108,9 +108,7 @@ class NotificationListNotifier extends AsyncNotifier> .toList(); final unreadCount = notifications.where((n) => n.viewedAt == null).length; - ref - .read(notificationUnreadCountNotifierProvider.notifier) - .decrement(unreadCount); + ref.read(notificationUnreadCountProvider.notifier).decrement(unreadCount); return notifications; } @@ -147,7 +145,7 @@ class NotificationSheet extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { // Refresh unread count when sheet opens to sync across devices - ref.read(notificationUnreadCountNotifierProvider.notifier).refresh(); + ref.read(notificationUnreadCountProvider.notifier).refresh(); Future markAllRead() async { showLoadingModal(context); @@ -155,8 +153,8 @@ class NotificationSheet extends HookConsumerWidget { await apiClient.post('/ring/notifications/all/read'); if (!context.mounted) return; hideLoadingModal(context); - ref.invalidate(notificationListNotifierProvider); - ref.watch(notificationUnreadCountNotifierProvider.notifier).clear(); + ref.invalidate(notificationListProvider); + ref.watch(notificationUnreadCountProvider.notifier).clear(); } return SheetScaffold( @@ -168,8 +166,8 @@ class NotificationSheet extends HookConsumerWidget { ), ], child: PaginationList( - provider: notificationListNotifierProvider, - notifier: notificationListNotifierProvider.notifier, + provider: notificationListProvider, + notifier: notificationListProvider.notifier, itemBuilder: (context, index, notification) { final pfp = notification.meta['pfp'] as String?; final images = notification.meta['images'] as List?; diff --git a/lib/screens/notification.g.dart b/lib/screens/notification.g.dart index 2b01609d..b7374f9c 100644 --- a/lib/screens/notification.g.dart +++ b/lib/screens/notification.g.dart @@ -6,26 +6,52 @@ part of 'notification.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(NotificationUnreadCountNotifier) +const notificationUnreadCountProvider = + NotificationUnreadCountNotifierProvider._(); + +final class NotificationUnreadCountNotifierProvider + extends $AsyncNotifierProvider { + const NotificationUnreadCountNotifierProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'notificationUnreadCountProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$notificationUnreadCountNotifierHash(); + + @$internal + @override + NotificationUnreadCountNotifier create() => NotificationUnreadCountNotifier(); +} + String _$notificationUnreadCountNotifierHash() => r'8bff5ad3b65389589b4112add3246afd9b8e38f9'; -/// See also [NotificationUnreadCountNotifier]. -@ProviderFor(NotificationUnreadCountNotifier) -final notificationUnreadCountNotifierProvider = - AutoDisposeAsyncNotifierProvider< - NotificationUnreadCountNotifier, - int - >.internal( - NotificationUnreadCountNotifier.new, - name: r'notificationUnreadCountNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$notificationUnreadCountNotifierHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -typedef _$NotificationUnreadCountNotifier = AutoDisposeAsyncNotifier; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$NotificationUnreadCountNotifier extends $AsyncNotifier { + FutureOr build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = this.ref as $Ref, int>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, int>, + AsyncValue, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/screens/posts/compose_article.dart b/lib/screens/posts/compose_article.dart index eccface0..281c9c2e 100644 --- a/lib/screens/posts/compose_article.dart +++ b/lib/screens/posts/compose_article.dart @@ -122,7 +122,7 @@ class ArticleComposeScreen extends HookConsumerWidget { useEffect(() { if (originalPost == null && initialState == null) { // Try to load the most recent article draft - final drafts = ref.read(composeStorageNotifierProvider); + final drafts = ref.read(composeStorageProvider); if (drafts.isNotEmpty) { final mostRecentDraft = drafts.values.reduce( (a, b) => diff --git a/lib/screens/posts/post_categories_list.dart b/lib/screens/posts/post_categories_list.dart index d38244e5..c446168c 100644 --- a/lib/screens/posts/post_categories_list.dart +++ b/lib/screens/posts/post_categories_list.dart @@ -11,14 +11,13 @@ import 'package:island/widgets/paging/pagination_list.dart'; import 'package:material_symbols_icons/symbols.dart'; // Post Categories Notifier -final postCategoriesNotifierProvider = AsyncNotifierProvider.autoDispose< +final postCategoriesProvider = AsyncNotifierProvider.autoDispose< PostCategoriesNotifier, List >(PostCategoriesNotifier.new); -class PostCategoriesNotifier - extends AutoDisposeAsyncNotifier> - with AutoDisposeAsyncPaginationController { +class PostCategoriesNotifier extends AsyncNotifier> + with AsyncPaginationController { @override Future> fetch() async { final client = ref.read(apiClientProvider); @@ -35,13 +34,13 @@ class PostCategoriesNotifier } // Post Tags Notifier -final postTagsNotifierProvider = +final postTagsProvider = AsyncNotifierProvider.autoDispose>( PostTagsNotifier.new, ); -class PostTagsNotifier extends AutoDisposeAsyncNotifier> - with AutoDisposeAsyncPaginationController { +class PostTagsNotifier extends AsyncNotifier> + with AsyncPaginationController { @override Future> fetch() async { final client = ref.read(apiClientProvider); @@ -65,8 +64,8 @@ class PostCategoriesListScreen extends ConsumerWidget { return AppScaffold( appBar: AppBar(title: const Text('categories').tr()), body: PaginationList( - provider: postCategoriesNotifierProvider, - notifier: postCategoriesNotifierProvider.notifier, + provider: postCategoriesProvider, + notifier: postCategoriesProvider.notifier, padding: EdgeInsets.zero, itemBuilder: (context, index, category) { return ListTile( @@ -96,8 +95,8 @@ class PostTagsListScreen extends ConsumerWidget { return AppScaffold( appBar: AppBar(title: const Text('tags').tr()), body: PaginationList( - provider: postTagsNotifierProvider, - notifier: postTagsNotifierProvider.notifier, + provider: postTagsProvider, + notifier: postTagsProvider.notifier, padding: EdgeInsets.zero, itemBuilder: (context, index, tag) { return ListTile( diff --git a/lib/screens/posts/post_category_detail.g.dart b/lib/screens/posts/post_category_detail.g.dart index 91fa492b..1af39fac 100644 --- a/lib/screens/posts/post_category_detail.g.dart +++ b/lib/screens/posts/post_category_detail.g.dart @@ -6,406 +6,229 @@ part of 'post_category_detail.dart'; // RiverpodGenerator // ************************************************************************** -String _$postCategoryHash() => r'0df2de729ba96819ee37377314615abef0c99547'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [postCategory]. @ProviderFor(postCategory) -const postCategoryProvider = PostCategoryFamily(); +const postCategoryProvider = PostCategoryFamily._(); -/// See also [postCategory]. -class PostCategoryFamily extends Family> { - /// See also [postCategory]. - const PostCategoryFamily(); +final class PostCategoryProvider + extends + $FunctionalProvider< + AsyncValue, + SnPostCategory, + FutureOr + > + with $FutureModifier, $FutureProvider { + const PostCategoryProvider._({ + required PostCategoryFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'postCategoryProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [postCategory]. - PostCategoryProvider call(String slug) { - return PostCategoryProvider(slug); + @override + String debugGetCreateSourceHash() => _$postCategoryHash(); + + @override + String toString() { + return r'postCategoryProvider' + '' + '($argument)'; } + @$internal @override - PostCategoryProvider getProviderOverride( - covariant PostCategoryProvider provider, - ) { - return call(provider.slug); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'postCategoryProvider'; -} - -/// See also [postCategory]. -class PostCategoryProvider extends AutoDisposeFutureProvider { - /// See also [postCategory]. - PostCategoryProvider(String slug) - : this._internal( - (ref) => postCategory(ref as PostCategoryRef, slug), - from: postCategoryProvider, - name: r'postCategoryProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$postCategoryHash, - dependencies: PostCategoryFamily._dependencies, - allTransitiveDependencies: - PostCategoryFamily._allTransitiveDependencies, - slug: slug, - ); - - PostCategoryProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.slug, - }) : super.internal(); - - final String slug; - - @override - Override overrideWith( - FutureOr Function(PostCategoryRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PostCategoryProvider._internal( - (ref) => create(ref as PostCategoryRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - slug: slug, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PostCategoryProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return postCategory(ref, argument); } @override bool operator ==(Object other) { - return other is PostCategoryProvider && other.slug == slug; + return other is PostCategoryProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, slug.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PostCategoryRef on AutoDisposeFutureProviderRef { - /// The parameter `slug` of this provider. - String get slug; -} +String _$postCategoryHash() => r'0df2de729ba96819ee37377314615abef0c99547'; -class _PostCategoryProviderElement - extends AutoDisposeFutureProviderElement - with PostCategoryRef { - _PostCategoryProviderElement(super.provider); +final class PostCategoryFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PostCategoryFamily._() + : super( + retry: null, + name: r'postCategoryProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + PostCategoryProvider call(String slug) => + PostCategoryProvider._(argument: slug, from: this); @override - String get slug => (origin as PostCategoryProvider).slug; + String toString() => r'postCategoryProvider'; +} + +@ProviderFor(postTag) +const postTagProvider = PostTagFamily._(); + +final class PostTagProvider + extends + $FunctionalProvider< + AsyncValue, + SnPostTag, + FutureOr + > + with $FutureModifier, $FutureProvider { + const PostTagProvider._({ + required PostTagFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'postTagProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$postTagHash(); + + @override + String toString() { + return r'postTagProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return postTag(ref, argument); + } + + @override + bool operator ==(Object other) { + return other is PostTagProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$postTagHash() => r'e050fdf9af81a843a9abd9cf979dd2672e0a2b93'; -/// See also [postTag]. -@ProviderFor(postTag) -const postTagProvider = PostTagFamily(); - -/// See also [postTag]. -class PostTagFamily extends Family> { - /// See also [postTag]. - const PostTagFamily(); - - /// See also [postTag]. - PostTagProvider call(String slug) { - return PostTagProvider(slug); - } - - @override - PostTagProvider getProviderOverride(covariant PostTagProvider provider) { - return call(provider.slug); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'postTagProvider'; -} - -/// See also [postTag]. -class PostTagProvider extends AutoDisposeFutureProvider { - /// See also [postTag]. - PostTagProvider(String slug) - : this._internal( - (ref) => postTag(ref as PostTagRef, slug), - from: postTagProvider, +final class PostTagFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PostTagFamily._() + : super( + retry: null, name: r'postTagProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$postTagHash, - dependencies: PostTagFamily._dependencies, - allTransitiveDependencies: PostTagFamily._allTransitiveDependencies, - slug: slug, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - PostTagProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.slug, - }) : super.internal(); - - final String slug; + PostTagProvider call(String slug) => + PostTagProvider._(argument: slug, from: this); @override - Override overrideWith( - FutureOr Function(PostTagRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PostTagProvider._internal( - (ref) => create(ref as PostTagRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - slug: slug, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PostTagProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is PostTagProvider && other.slug == slug; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, slug.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'postTagProvider'; } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PostTagRef on AutoDisposeFutureProviderRef { - /// The parameter `slug` of this provider. - String get slug; -} - -class _PostTagProviderElement - extends AutoDisposeFutureProviderElement - with PostTagRef { - _PostTagProviderElement(super.provider); - - @override - String get slug => (origin as PostTagProvider).slug; -} - -String _$postCategorySubscriptionStatusHash() => - r'407dc7fcaeffc461b591b4ee2418811aa4f0a63f'; - -/// See also [postCategorySubscriptionStatus]. @ProviderFor(postCategorySubscriptionStatus) const postCategorySubscriptionStatusProvider = - PostCategorySubscriptionStatusFamily(); + PostCategorySubscriptionStatusFamily._(); -/// See also [postCategorySubscriptionStatus]. -class PostCategorySubscriptionStatusFamily extends Family> { - /// See also [postCategorySubscriptionStatus]. - const PostCategorySubscriptionStatusFamily(); +final class PostCategorySubscriptionStatusProvider + extends $FunctionalProvider, bool, FutureOr> + with $FutureModifier, $FutureProvider { + const PostCategorySubscriptionStatusProvider._({ + required PostCategorySubscriptionStatusFamily super.from, + required (String, bool) super.argument, + }) : super( + retry: null, + name: r'postCategorySubscriptionStatusProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [postCategorySubscriptionStatus]. - PostCategorySubscriptionStatusProvider call(String slug, bool isCategory) { - return PostCategorySubscriptionStatusProvider(slug, isCategory); + @override + String debugGetCreateSourceHash() => _$postCategorySubscriptionStatusHash(); + + @override + String toString() { + return r'postCategorySubscriptionStatusProvider' + '' + '$argument'; } + @$internal @override - PostCategorySubscriptionStatusProvider getProviderOverride( - covariant PostCategorySubscriptionStatusProvider provider, - ) { - return call(provider.slug, provider.isCategory); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'postCategorySubscriptionStatusProvider'; -} - -/// See also [postCategorySubscriptionStatus]. -class PostCategorySubscriptionStatusProvider - extends AutoDisposeFutureProvider { - /// See also [postCategorySubscriptionStatus]. - PostCategorySubscriptionStatusProvider(String slug, bool isCategory) - : this._internal( - (ref) => postCategorySubscriptionStatus( - ref as PostCategorySubscriptionStatusRef, - slug, - isCategory, - ), - from: postCategorySubscriptionStatusProvider, - name: r'postCategorySubscriptionStatusProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$postCategorySubscriptionStatusHash, - dependencies: PostCategorySubscriptionStatusFamily._dependencies, - allTransitiveDependencies: - PostCategorySubscriptionStatusFamily._allTransitiveDependencies, - slug: slug, - isCategory: isCategory, - ); - - PostCategorySubscriptionStatusProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.slug, - required this.isCategory, - }) : super.internal(); - - final String slug; - final bool isCategory; - - @override - Override overrideWith( - FutureOr Function(PostCategorySubscriptionStatusRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PostCategorySubscriptionStatusProvider._internal( - (ref) => create(ref as PostCategorySubscriptionStatusRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - slug: slug, - isCategory: isCategory, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PostCategorySubscriptionStatusProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as (String, bool); + return postCategorySubscriptionStatus(ref, argument.$1, argument.$2); } @override bool operator ==(Object other) { return other is PostCategorySubscriptionStatusProvider && - other.slug == slug && - other.isCategory == isCategory; + other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, slug.hashCode); - hash = _SystemHash.combine(hash, isCategory.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PostCategorySubscriptionStatusRef on AutoDisposeFutureProviderRef { - /// The parameter `slug` of this provider. - String get slug; +String _$postCategorySubscriptionStatusHash() => + r'407dc7fcaeffc461b591b4ee2418811aa4f0a63f'; - /// The parameter `isCategory` of this provider. - bool get isCategory; -} +final class PostCategorySubscriptionStatusFamily extends $Family + with $FunctionalFamilyOverride, (String, bool)> { + const PostCategorySubscriptionStatusFamily._() + : super( + retry: null, + name: r'postCategorySubscriptionStatusProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); -class _PostCategorySubscriptionStatusProviderElement - extends AutoDisposeFutureProviderElement - with PostCategorySubscriptionStatusRef { - _PostCategorySubscriptionStatusProviderElement(super.provider); + PostCategorySubscriptionStatusProvider call(String slug, bool isCategory) => + PostCategorySubscriptionStatusProvider._( + argument: (slug, isCategory), + from: this, + ); @override - String get slug => (origin as PostCategorySubscriptionStatusProvider).slug; - @override - bool get isCategory => - (origin as PostCategorySubscriptionStatusProvider).isCategory; + String toString() => r'postCategorySubscriptionStatusProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/posts/post_detail.dart b/lib/screens/posts/post_detail.dart index 7f42f3a0..b89ab2d0 100644 --- a/lib/screens/posts/post_detail.dart +++ b/lib/screens/posts/post_detail.dart @@ -17,8 +17,8 @@ import 'package:island/widgets/post/post_item.dart'; import 'package:island/widgets/post/post_award_history_sheet.dart'; import 'package:island/widgets/post/post_pin_sheet.dart'; import 'package:island/widgets/post/post_quick_reply.dart'; -import 'package:island/widgets/post/post_replies.dart'; import 'package:island/widgets/post/compose_sheet.dart'; +import 'package:island/widgets/post/post_replies.dart'; import 'package:island/widgets/response.dart'; import 'package:island/utils/share_utils.dart'; import 'package:island/widgets/safety/abuse_report_helper.dart'; @@ -38,20 +38,21 @@ Future post(Ref ref, String id) async { } final postStateProvider = - StateNotifierProvider.family, String>( - (ref, id) => PostState(ref, id), + NotifierProvider.family, String>( + PostState.new, ); -class PostState extends StateNotifier> { - final Ref _ref; - final String _id; +class PostState extends Notifier> { + final String arg; + PostState(this.arg); - PostState(this._ref, this._id) : super(const AsyncValue.loading()) { - // Initialize with the initial post data - _ref.listen>( - postProvider(_id), + @override + AsyncValue build() { + ref.listen>( + postProvider(arg), (_, next) => state = next, ); + return const AsyncValue.loading(); } void updatePost(SnPost? newPost) { @@ -460,7 +461,7 @@ class PostDetailScreen extends HookConsumerWidget { ExtendedRefreshIndicator( onRefresh: () async { ref.invalidate(postProvider(id)); - ref.invalidate(postRepliesNotifierProvider(id)); + ref.read(postRepliesProvider(id).notifier).refresh(); }, child: CustomScrollView( physics: const AlwaysScrollableScrollPhysics(), @@ -494,7 +495,9 @@ class PostDetailScreen extends HookConsumerWidget { ), onRefresh: () { ref.invalidate(postProvider(id)); - ref.invalidate(postRepliesNotifierProvider(id)); + ref + .read(postRepliesProvider(id).notifier) + .refresh(); }, onUpdate: (newItem) { ref @@ -523,9 +526,9 @@ class PostDetailScreen extends HookConsumerWidget { (post) => PostQuickReply( parent: post!, onPosted: () { - ref.invalidate( - postRepliesNotifierProvider(id), - ); + ref + .read(postRepliesProvider(id).notifier) + .refresh(); }, ), loading: () => const SizedBox.shrink(), diff --git a/lib/screens/posts/post_detail.g.dart b/lib/screens/posts/post_detail.g.dart index 23e037cf..fa7315ee 100644 --- a/lib/screens/posts/post_detail.g.dart +++ b/lib/screens/posts/post_detail.g.dart @@ -6,139 +6,73 @@ part of 'post_detail.dart'; // RiverpodGenerator // ************************************************************************** -String _$postHash() => r'66c2eb074c6d7467fef81cab70a13356e648e661'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [post]. @ProviderFor(post) -const postProvider = PostFamily(); +const postProvider = PostFamily._(); -/// See also [post]. -class PostFamily extends Family> { - /// See also [post]. - const PostFamily(); +final class PostProvider + extends $FunctionalProvider, SnPost?, FutureOr> + with $FutureModifier, $FutureProvider { + const PostProvider._({ + required PostFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'postProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [post]. - PostProvider call(String id) { - return PostProvider(id); + @override + String debugGetCreateSourceHash() => _$postHash(); + + @override + String toString() { + return r'postProvider' + '' + '($argument)'; } + @$internal @override - PostProvider getProviderOverride(covariant PostProvider provider) { - return call(provider.id); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'postProvider'; -} - -/// See also [post]. -class PostProvider extends AutoDisposeFutureProvider { - /// See also [post]. - PostProvider(String id) - : this._internal( - (ref) => post(ref as PostRef, id), - from: postProvider, - name: r'postProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$postHash, - dependencies: PostFamily._dependencies, - allTransitiveDependencies: PostFamily._allTransitiveDependencies, - id: id, - ); - - PostProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.id, - }) : super.internal(); - - final String id; - - @override - Override overrideWith(FutureOr Function(PostRef provider) create) { - return ProviderOverride( - origin: this, - override: PostProvider._internal( - (ref) => create(ref as PostRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - id: id, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PostProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return post(ref, argument); } @override bool operator ==(Object other) { - return other is PostProvider && other.id == id; + return other is PostProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PostRef on AutoDisposeFutureProviderRef { - /// The parameter `id` of this provider. - String get id; -} +String _$postHash() => r'66c2eb074c6d7467fef81cab70a13356e648e661'; -class _PostProviderElement extends AutoDisposeFutureProviderElement - with PostRef { - _PostProviderElement(super.provider); +final class PostFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PostFamily._() + : super( + retry: null, + name: r'postProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + PostProvider call(String id) => PostProvider._(argument: id, from: this); @override - String get id => (origin as PostProvider).id; + String toString() => r'postProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/posts/post_search.dart b/lib/screens/posts/post_search.dart index 34df0c59..921c8919 100644 --- a/lib/screens/posts/post_search.dart +++ b/lib/screens/posts/post_search.dart @@ -12,13 +12,12 @@ import 'package:island/pods/paging.dart'; import 'package:island/widgets/paging/pagination_list.dart'; import 'package:styled_widget/styled_widget.dart'; -final postSearchNotifierProvider = - AsyncNotifierProvider.autoDispose>( - PostSearchNotifier.new, - ); +final postSearchProvider = AsyncNotifierProvider.autoDispose( + PostSearchNotifier.new, +); -class PostSearchNotifier extends AutoDisposeAsyncNotifier> - with AutoDisposeAsyncPaginationController { +class PostSearchNotifier extends AsyncNotifier> + with AsyncPaginationController { static const int _pageSize = 20; String _currentQuery = ''; String? _pubName; @@ -131,7 +130,7 @@ class PostSearchScreen extends HookConsumerWidget { if (debounceTimer.value?.isActive ?? false) debounceTimer.value!.cancel(); debounceTimer.value = Timer(debounce, () { - ref.read(postSearchNotifierProvider.notifier).search(query); + ref.read(postSearchProvider.notifier).search(query); }); } @@ -140,7 +139,7 @@ class PostSearchScreen extends HookConsumerWidget { debounceTimer.value = Timer(debounce, () { ref - .read(postSearchNotifierProvider.notifier) + .read(postSearchProvider.notifier) .search( query, pubName: @@ -303,7 +302,7 @@ class PostSearchScreen extends HookConsumerWidget { ), body: Consumer( builder: (context, ref, child) { - final searchState = ref.watch(postSearchNotifierProvider); + final searchState = ref.watch(postSearchProvider); return CustomScrollView( slivers: [ @@ -318,8 +317,8 @@ class PostSearchScreen extends HookConsumerWidget { ), // Use PaginationList with isSliver=true PaginationList( - provider: postSearchNotifierProvider, - notifier: postSearchNotifierProvider.notifier, + provider: postSearchProvider, + notifier: postSearchProvider.notifier, isSliver: true, isRefreshable: false, // CustomScrollView handles refreshing usually, but here we don't have PullToRefresh @@ -338,7 +337,7 @@ class PostSearchScreen extends HookConsumerWidget { ); }, ), - if (searchState.valueOrNull?.isEmpty == true && + if (searchState.value?.isEmpty == true && searchController.text.isNotEmpty && !searchState.isLoading) SliverFillRemaining( diff --git a/lib/screens/posts/publisher_profile.g.dart b/lib/screens/posts/publisher_profile.g.dart index 3cf50153..080b2adf 100644 --- a/lib/screens/posts/publisher_profile.g.dart +++ b/lib/screens/posts/publisher_profile.g.dart @@ -6,650 +6,383 @@ part of 'publisher_profile.dart'; // RiverpodGenerator // ************************************************************************** -String _$publisherHash() => r'a1da21f0275421382e2882fd52c4e061c4675cf7'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [publisher]. @ProviderFor(publisher) -const publisherProvider = PublisherFamily(); +const publisherProvider = PublisherFamily._(); -/// See also [publisher]. -class PublisherFamily extends Family> { - /// See also [publisher]. - const PublisherFamily(); +final class PublisherProvider + extends + $FunctionalProvider< + AsyncValue, + SnPublisher, + FutureOr + > + with $FutureModifier, $FutureProvider { + const PublisherProvider._({ + required PublisherFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'publisherProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [publisher]. - PublisherProvider call(String uname) { - return PublisherProvider(uname); + @override + String debugGetCreateSourceHash() => _$publisherHash(); + + @override + String toString() { + return r'publisherProvider' + '' + '($argument)'; } + @$internal @override - PublisherProvider getProviderOverride(covariant PublisherProvider provider) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherProvider'; -} - -/// See also [publisher]. -class PublisherProvider extends AutoDisposeFutureProvider { - /// See also [publisher]. - PublisherProvider(String uname) - : this._internal( - (ref) => publisher(ref as PublisherRef, uname), - from: publisherProvider, - name: r'publisherProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherHash, - dependencies: PublisherFamily._dependencies, - allTransitiveDependencies: PublisherFamily._allTransitiveDependencies, - uname: uname, - ); - - PublisherProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; - - @override - Override overrideWith( - FutureOr Function(PublisherRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PublisherProvider._internal( - (ref) => create(ref as PublisherRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PublisherProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return publisher(ref, argument); } @override bool operator ==(Object other) { - return other is PublisherProvider && other.uname == uname; + return other is PublisherProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String get uname; -} +String _$publisherHash() => r'a1da21f0275421382e2882fd52c4e061c4675cf7'; -class _PublisherProviderElement - extends AutoDisposeFutureProviderElement - with PublisherRef { - _PublisherProviderElement(super.provider); +final class PublisherFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PublisherFamily._() + : super( + retry: null, + name: r'publisherProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + PublisherProvider call(String uname) => + PublisherProvider._(argument: uname, from: this); @override - String get uname => (origin as PublisherProvider).uname; + String toString() => r'publisherProvider'; +} + +@ProviderFor(publisherBadges) +const publisherBadgesProvider = PublisherBadgesFamily._(); + +final class PublisherBadgesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const PublisherBadgesProvider._({ + required PublisherBadgesFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'publisherBadgesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$publisherBadgesHash(); + + @override + String toString() { + return r'publisherBadgesProvider' + '' + '($argument)'; + } + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return publisherBadges(ref, argument); + } + + @override + bool operator ==(Object other) { + return other is PublisherBadgesProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$publisherBadgesHash() => r'26776fd6cb611953f52bdb6a7dfa004c34d5cd8e'; -/// See also [publisherBadges]. -@ProviderFor(publisherBadges) -const publisherBadgesProvider = PublisherBadgesFamily(); - -/// See also [publisherBadges]. -class PublisherBadgesFamily extends Family>> { - /// See also [publisherBadges]. - const PublisherBadgesFamily(); - - /// See also [publisherBadges]. - PublisherBadgesProvider call(String pubName) { - return PublisherBadgesProvider(pubName); - } - - @override - PublisherBadgesProvider getProviderOverride( - covariant PublisherBadgesProvider provider, - ) { - return call(provider.pubName); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherBadgesProvider'; -} - -/// See also [publisherBadges]. -class PublisherBadgesProvider - extends AutoDisposeFutureProvider> { - /// See also [publisherBadges]. - PublisherBadgesProvider(String pubName) - : this._internal( - (ref) => publisherBadges(ref as PublisherBadgesRef, pubName), - from: publisherBadgesProvider, +final class PublisherBadgesFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const PublisherBadgesFamily._() + : super( + retry: null, name: r'publisherBadgesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherBadgesHash, - dependencies: PublisherBadgesFamily._dependencies, - allTransitiveDependencies: - PublisherBadgesFamily._allTransitiveDependencies, - pubName: pubName, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - PublisherBadgesProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.pubName, - }) : super.internal(); - - final String pubName; + PublisherBadgesProvider call(String pubName) => + PublisherBadgesProvider._(argument: pubName, from: this); @override - Override overrideWith( - FutureOr> Function(PublisherBadgesRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PublisherBadgesProvider._internal( - (ref) => create(ref as PublisherBadgesRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - pubName: pubName, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _PublisherBadgesProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is PublisherBadgesProvider && other.pubName == pubName; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, pubName.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'publisherBadgesProvider'; } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherBadgesRef on AutoDisposeFutureProviderRef> { - /// The parameter `pubName` of this provider. - String get pubName; -} - -class _PublisherBadgesProviderElement - extends AutoDisposeFutureProviderElement> - with PublisherBadgesRef { - _PublisherBadgesProviderElement(super.provider); - - @override - String get pubName => (origin as PublisherBadgesProvider).pubName; -} - -String _$publisherSubscriptionStatusHash() => - r'634262ce519e1c8288267df11e08e1d4acaa4a44'; - -/// See also [publisherSubscriptionStatus]. @ProviderFor(publisherSubscriptionStatus) -const publisherSubscriptionStatusProvider = PublisherSubscriptionStatusFamily(); +const publisherSubscriptionStatusProvider = + PublisherSubscriptionStatusFamily._(); -/// See also [publisherSubscriptionStatus]. -class PublisherSubscriptionStatusFamily - extends Family> { - /// See also [publisherSubscriptionStatus]. - const PublisherSubscriptionStatusFamily(); +final class PublisherSubscriptionStatusProvider + extends + $FunctionalProvider< + AsyncValue, + SnSubscriptionStatus, + FutureOr + > + with + $FutureModifier, + $FutureProvider { + const PublisherSubscriptionStatusProvider._({ + required PublisherSubscriptionStatusFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'publisherSubscriptionStatusProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [publisherSubscriptionStatus]. - PublisherSubscriptionStatusProvider call(String pubName) { - return PublisherSubscriptionStatusProvider(pubName); + @override + String debugGetCreateSourceHash() => _$publisherSubscriptionStatusHash(); + + @override + String toString() { + return r'publisherSubscriptionStatusProvider' + '' + '($argument)'; } + @$internal @override - PublisherSubscriptionStatusProvider getProviderOverride( - covariant PublisherSubscriptionStatusProvider provider, - ) { - return call(provider.pubName); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherSubscriptionStatusProvider'; -} - -/// See also [publisherSubscriptionStatus]. -class PublisherSubscriptionStatusProvider - extends AutoDisposeFutureProvider { - /// See also [publisherSubscriptionStatus]. - PublisherSubscriptionStatusProvider(String pubName) - : this._internal( - (ref) => publisherSubscriptionStatus( - ref as PublisherSubscriptionStatusRef, - pubName, - ), - from: publisherSubscriptionStatusProvider, - name: r'publisherSubscriptionStatusProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherSubscriptionStatusHash, - dependencies: PublisherSubscriptionStatusFamily._dependencies, - allTransitiveDependencies: - PublisherSubscriptionStatusFamily._allTransitiveDependencies, - pubName: pubName, - ); - - PublisherSubscriptionStatusProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.pubName, - }) : super.internal(); - - final String pubName; - - @override - Override overrideWith( - FutureOr Function( - PublisherSubscriptionStatusRef provider, - ) - create, - ) { - return ProviderOverride( - origin: this, - override: PublisherSubscriptionStatusProvider._internal( - (ref) => create(ref as PublisherSubscriptionStatusRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - pubName: pubName, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PublisherSubscriptionStatusProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return publisherSubscriptionStatus(ref, argument); } @override bool operator ==(Object other) { return other is PublisherSubscriptionStatusProvider && - other.pubName == pubName; + other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, pubName.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherSubscriptionStatusRef - on AutoDisposeFutureProviderRef { - /// The parameter `pubName` of this provider. - String get pubName; -} +String _$publisherSubscriptionStatusHash() => + r'634262ce519e1c8288267df11e08e1d4acaa4a44'; -class _PublisherSubscriptionStatusProviderElement - extends AutoDisposeFutureProviderElement - with PublisherSubscriptionStatusRef { - _PublisherSubscriptionStatusProviderElement(super.provider); - - @override - String get pubName => (origin as PublisherSubscriptionStatusProvider).pubName; -} - -String _$publisherAppbarForcegroundColorHash() => - r'cd9a9816177a6eecc2bc354acebbbd48892ffdd7'; - -/// See also [publisherAppbarForcegroundColor]. -@ProviderFor(publisherAppbarForcegroundColor) -const publisherAppbarForcegroundColorProvider = - PublisherAppbarForcegroundColorFamily(); - -/// See also [publisherAppbarForcegroundColor]. -class PublisherAppbarForcegroundColorFamily extends Family> { - /// See also [publisherAppbarForcegroundColor]. - const PublisherAppbarForcegroundColorFamily(); - - /// See also [publisherAppbarForcegroundColor]. - PublisherAppbarForcegroundColorProvider call(String pubName) { - return PublisherAppbarForcegroundColorProvider(pubName); - } - - @override - PublisherAppbarForcegroundColorProvider getProviderOverride( - covariant PublisherAppbarForcegroundColorProvider provider, - ) { - return call(provider.pubName); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherAppbarForcegroundColorProvider'; -} - -/// See also [publisherAppbarForcegroundColor]. -class PublisherAppbarForcegroundColorProvider - extends AutoDisposeFutureProvider { - /// See also [publisherAppbarForcegroundColor]. - PublisherAppbarForcegroundColorProvider(String pubName) - : this._internal( - (ref) => publisherAppbarForcegroundColor( - ref as PublisherAppbarForcegroundColorRef, - pubName, - ), - from: publisherAppbarForcegroundColorProvider, - name: r'publisherAppbarForcegroundColorProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherAppbarForcegroundColorHash, - dependencies: PublisherAppbarForcegroundColorFamily._dependencies, - allTransitiveDependencies: - PublisherAppbarForcegroundColorFamily._allTransitiveDependencies, - pubName: pubName, +final class PublisherSubscriptionStatusFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PublisherSubscriptionStatusFamily._() + : super( + retry: null, + name: r'publisherSubscriptionStatusProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - PublisherAppbarForcegroundColorProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.pubName, - }) : super.internal(); - - final String pubName; + PublisherSubscriptionStatusProvider call(String pubName) => + PublisherSubscriptionStatusProvider._(argument: pubName, from: this); @override - Override overrideWith( - FutureOr Function(PublisherAppbarForcegroundColorRef provider) - create, - ) { - return ProviderOverride( - origin: this, - override: PublisherAppbarForcegroundColorProvider._internal( - (ref) => create(ref as PublisherAppbarForcegroundColorRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - pubName: pubName, - ), - ); + String toString() => r'publisherSubscriptionStatusProvider'; +} + +@ProviderFor(publisherAppbarForcegroundColor) +const publisherAppbarForcegroundColorProvider = + PublisherAppbarForcegroundColorFamily._(); + +final class PublisherAppbarForcegroundColorProvider + extends $FunctionalProvider, Color?, FutureOr> + with $FutureModifier, $FutureProvider { + const PublisherAppbarForcegroundColorProvider._({ + required PublisherAppbarForcegroundColorFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'publisherAppbarForcegroundColorProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$publisherAppbarForcegroundColorHash(); + + @override + String toString() { + return r'publisherAppbarForcegroundColorProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _PublisherAppbarForcegroundColorProviderElement(this); + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return publisherAppbarForcegroundColor(ref, argument); } @override bool operator ==(Object other) { return other is PublisherAppbarForcegroundColorProvider && - other.pubName == pubName; + other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, pubName.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherAppbarForcegroundColorRef - on AutoDisposeFutureProviderRef { - /// The parameter `pubName` of this provider. - String get pubName; -} +String _$publisherAppbarForcegroundColorHash() => + r'cd9a9816177a6eecc2bc354acebbbd48892ffdd7'; -class _PublisherAppbarForcegroundColorProviderElement - extends AutoDisposeFutureProviderElement - with PublisherAppbarForcegroundColorRef { - _PublisherAppbarForcegroundColorProviderElement(super.provider); - - @override - String get pubName => - (origin as PublisherAppbarForcegroundColorProvider).pubName; -} - -String _$publisherHeatmapHash() => r'86db275ce3861a2855b5ec35fbfef85fc47b23a6'; - -/// See also [publisherHeatmap]. -@ProviderFor(publisherHeatmap) -const publisherHeatmapProvider = PublisherHeatmapFamily(); - -/// See also [publisherHeatmap]. -class PublisherHeatmapFamily extends Family> { - /// See also [publisherHeatmap]. - const PublisherHeatmapFamily(); - - /// See also [publisherHeatmap]. - PublisherHeatmapProvider call(String uname) { - return PublisherHeatmapProvider(uname); - } - - @override - PublisherHeatmapProvider getProviderOverride( - covariant PublisherHeatmapProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'publisherHeatmapProvider'; -} - -/// See also [publisherHeatmap]. -class PublisherHeatmapProvider extends AutoDisposeFutureProvider { - /// See also [publisherHeatmap]. - PublisherHeatmapProvider(String uname) - : this._internal( - (ref) => publisherHeatmap(ref as PublisherHeatmapRef, uname), - from: publisherHeatmapProvider, - name: r'publisherHeatmapProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$publisherHeatmapHash, - dependencies: PublisherHeatmapFamily._dependencies, - allTransitiveDependencies: - PublisherHeatmapFamily._allTransitiveDependencies, - uname: uname, +final class PublisherAppbarForcegroundColorFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PublisherAppbarForcegroundColorFamily._() + : super( + retry: null, + name: r'publisherAppbarForcegroundColorProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - PublisherHeatmapProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; + PublisherAppbarForcegroundColorProvider call(String pubName) => + PublisherAppbarForcegroundColorProvider._(argument: pubName, from: this); @override - Override overrideWith( - FutureOr Function(PublisherHeatmapRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PublisherHeatmapProvider._internal( - (ref) => create(ref as PublisherHeatmapRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); + String toString() => r'publisherAppbarForcegroundColorProvider'; +} + +@ProviderFor(publisherHeatmap) +const publisherHeatmapProvider = PublisherHeatmapFamily._(); + +final class PublisherHeatmapProvider + extends + $FunctionalProvider< + AsyncValue, + SnHeatmap?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const PublisherHeatmapProvider._({ + required PublisherHeatmapFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'publisherHeatmapProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$publisherHeatmapHash(); + + @override + String toString() { + return r'publisherHeatmapProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _PublisherHeatmapProviderElement(this); + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return publisherHeatmap(ref, argument); } @override bool operator ==(Object other) { - return other is PublisherHeatmapProvider && other.uname == uname; + return other is PublisherHeatmapProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PublisherHeatmapRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String get uname; -} +String _$publisherHeatmapHash() => r'86db275ce3861a2855b5ec35fbfef85fc47b23a6'; -class _PublisherHeatmapProviderElement - extends AutoDisposeFutureProviderElement - with PublisherHeatmapRef { - _PublisherHeatmapProviderElement(super.provider); +final class PublisherHeatmapFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PublisherHeatmapFamily._() + : super( + retry: null, + name: r'publisherHeatmapProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + PublisherHeatmapProvider call(String uname) => + PublisherHeatmapProvider._(argument: uname, from: this); @override - String get uname => (origin as PublisherHeatmapProvider).uname; + String toString() => r'publisherHeatmapProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/realm/realm_detail.dart b/lib/screens/realm/realm_detail.dart index 354077c5..0cf88fa7 100644 --- a/lib/screens/realm/realm_detail.dart +++ b/lib/screens/realm/realm_detail.dart @@ -529,10 +529,12 @@ final realmMemberListNotifierProvider = AsyncNotifierProvider.autoDispose RealmMemberListNotifier.new, ); -class RealmMemberListNotifier - extends AutoDisposeFamilyAsyncNotifier, String> - with FamilyAsyncPaginationController { - static const int _pageSize = 20; +class RealmMemberListNotifier extends AsyncNotifier> + with AsyncPaginationController { + String arg; + RealmMemberListNotifier(this.arg); + + static const int pageSize = 20; @override Future> fetch() async { @@ -542,7 +544,7 @@ class RealmMemberListNotifier '/pass/realms/$arg/members', queryParameters: { 'offset': fetchedCount, - 'take': _pageSize, + 'take': pageSize, 'withStatus': true, }, ); diff --git a/lib/screens/realm/realms.dart b/lib/screens/realm/realms.dart index f5f25a02..0d85aefd 100644 --- a/lib/screens/realm/realms.dart +++ b/lib/screens/realm/realms.dart @@ -47,13 +47,14 @@ class RealmListScreen extends HookConsumerWidget { // Set FAB type to realm final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier); Future(() { - fabMenuNotifier.state = FabMenuType.realm; + fabMenuNotifier.setMenuType(FabMenuType.realm); }); return () { // Clean up: reset FAB type to main + final fabMenu = ref.read(fabMenuTypeProvider); WidgetsBinding.instance.addPostFrameCallback((_) { - if (fabMenuNotifier.state == FabMenuType.realm) { - fabMenuNotifier.state = FabMenuType.main; + if (fabMenu == FabMenuType.realm) { + fabMenuNotifier.setMenuType(FabMenuType.main); } }); }; diff --git a/lib/screens/realm/realms.g.dart b/lib/screens/realm/realms.g.dart index a57a7383..2ac55ee5 100644 --- a/lib/screens/realm/realms.g.dart +++ b/lib/screens/realm/realms.g.dart @@ -6,174 +6,155 @@ part of 'realms.dart'; // RiverpodGenerator // ************************************************************************** -String _$realmsJoinedHash() => r'b15029acd38f03bbbb8708adb78f25ac357a0421'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [realmsJoined]. @ProviderFor(realmsJoined) -final realmsJoinedProvider = AutoDisposeFutureProvider>.internal( - realmsJoined, - name: r'realmsJoinedProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$realmsJoinedHash, - dependencies: null, - allTransitiveDependencies: null, -); +const realmsJoinedProvider = RealmsJoinedProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef RealmsJoinedRef = AutoDisposeFutureProviderRef>; -String _$realmHash() => r'71a126ab2810566646e1629290c1ce9ffa0839e3'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [realm]. -@ProviderFor(realm) -const realmProvider = RealmFamily(); - -/// See also [realm]. -class RealmFamily extends Family> { - /// See also [realm]. - const RealmFamily(); - - /// See also [realm]. - RealmProvider call(String? identifier) { - return RealmProvider(identifier); - } - - @override - RealmProvider getProviderOverride(covariant RealmProvider provider) { - return call(provider.identifier); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'realmProvider'; -} - -/// See also [realm]. -class RealmProvider extends AutoDisposeFutureProvider { - /// See also [realm]. - RealmProvider(String? identifier) - : this._internal( - (ref) => realm(ref as RealmRef, identifier), - from: realmProvider, - name: r'realmProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$realmHash, - dependencies: RealmFamily._dependencies, - allTransitiveDependencies: RealmFamily._allTransitiveDependencies, - identifier: identifier, +final class RealmsJoinedProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + const RealmsJoinedProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'realmsJoinedProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, ); - RealmProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.identifier, - }) : super.internal(); + @override + String debugGetCreateSourceHash() => _$realmsJoinedHash(); - final String? identifier; + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Override overrideWith(FutureOr Function(RealmRef provider) create) { - return ProviderOverride( - origin: this, - override: RealmProvider._internal( - (ref) => create(ref as RealmRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - identifier: identifier, - ), - ); + FutureOr> create(Ref ref) { + return realmsJoined(ref); + } +} + +String _$realmsJoinedHash() => r'b15029acd38f03bbbb8708adb78f25ac357a0421'; + +@ProviderFor(realm) +const realmProvider = RealmFamily._(); + +final class RealmProvider + extends + $FunctionalProvider, SnRealm?, FutureOr> + with $FutureModifier, $FutureProvider { + const RealmProvider._({ + required RealmFamily super.from, + required String? super.argument, + }) : super( + retry: null, + name: r'realmProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$realmHash(); + + @override + String toString() { + return r'realmProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _RealmProviderElement(this); + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String?; + return realm(ref, argument); } @override bool operator ==(Object other) { - return other is RealmProvider && other.identifier == identifier; + return other is RealmProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, identifier.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin RealmRef on AutoDisposeFutureProviderRef { - /// The parameter `identifier` of this provider. - String? get identifier; -} +String _$realmHash() => r'71a126ab2810566646e1629290c1ce9ffa0839e3'; -class _RealmProviderElement extends AutoDisposeFutureProviderElement - with RealmRef { - _RealmProviderElement(super.provider); +final class RealmFamily extends $Family + with $FunctionalFamilyOverride, String?> { + const RealmFamily._() + : super( + retry: null, + name: r'realmProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + RealmProvider call(String? identifier) => + RealmProvider._(argument: identifier, from: this); @override - String? get identifier => (origin as RealmProvider).identifier; + String toString() => r'realmProvider'; +} + +@ProviderFor(realmInvites) +const realmInvitesProvider = RealmInvitesProvider._(); + +final class RealmInvitesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const RealmInvitesProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'realmInvitesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$realmInvitesHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return realmInvites(ref); + } } String _$realmInvitesHash() => r'92cce0978c7ca8813e27ae42fc6f3a93a09a8962'; - -/// See also [realmInvites]. -@ProviderFor(realmInvites) -final realmInvitesProvider = - AutoDisposeFutureProvider>.internal( - realmInvites, - name: r'realmInvitesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$realmInvitesHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef RealmInvitesRef = AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 840dabda..41cd0553 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -52,7 +52,7 @@ class SettingsScreen extends HookConsumerWidget { final serverUrl = ref.watch(serverUrlProvider); final prefs = ref.watch(sharedPreferencesProvider); final controller = TextEditingController(text: serverUrl); - final settings = ref.watch(appSettingsNotifierProvider); + final settings = ref.watch(appSettingsProvider); final isDesktop = !kIsWeb && (Platform.isWindows || Platform.isMacOS || Platform.isLinux); final isWide = isWideScreen(context); @@ -137,9 +137,7 @@ class SettingsScreen extends HookConsumerWidget { value: settings.themeMode, onChanged: (String? value) { if (value != null) { - ref - .read(appSettingsNotifierProvider.notifier) - .setThemeMode(value); + ref.read(appSettingsProvider.notifier).setThemeMode(value); showSnackBar('settingsApplied'.tr()); } }, @@ -170,9 +168,7 @@ class SettingsScreen extends HookConsumerWidget { suffixIcon: IconButton( icon: const Icon(Symbols.restart_alt), onPressed: () { - ref - .read(appSettingsNotifierProvider.notifier) - .setCustomFonts(null); + ref.read(appSettingsProvider.notifier).setCustomFonts(null); showSnackBar('settingsApplied'.tr()); }, ), @@ -183,7 +179,7 @@ class SettingsScreen extends HookConsumerWidget { ), onSubmitted: (value) { ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setCustomFonts(value.isEmpty ? null : value); showSnackBar('settingsApplied'.tr()); }, @@ -218,7 +214,7 @@ class SettingsScreen extends HookConsumerWidget { onChanged: (String? value) { if (value != null) { ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setMessageDisplayStyle(value); showSnackBar('settingsApplied'.tr()); } @@ -280,7 +276,7 @@ class SettingsScreen extends HookConsumerWidget { TextButton( onPressed: () { ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setAppColorScheme(selectedColor.value); Navigator.of(context).pop(); }, @@ -330,7 +326,7 @@ class SettingsScreen extends HookConsumerWidget { onColorChanged: (color) { final current = settings.customColors ?? ThemeColors(); ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setCustomColors(current.copyWith(primary: color?.value)); }, ), @@ -344,7 +340,7 @@ class SettingsScreen extends HookConsumerWidget { onColorChanged: (color) { final current = settings.customColors ?? ThemeColors(); ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setCustomColors(current.copyWith(secondary: color?.value)); }, ), @@ -358,7 +354,7 @@ class SettingsScreen extends HookConsumerWidget { onColorChanged: (color) { final current = settings.customColors ?? ThemeColors(); ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setCustomColors(current.copyWith(tertiary: color?.value)); }, ), @@ -372,7 +368,7 @@ class SettingsScreen extends HookConsumerWidget { onColorChanged: (color) { final current = settings.customColors ?? ThemeColors(); ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setCustomColors(current.copyWith(surface: color?.value)); }, ), @@ -386,7 +382,7 @@ class SettingsScreen extends HookConsumerWidget { onColorChanged: (color) { final current = settings.customColors ?? ThemeColors(); ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setCustomColors( current.copyWith(background: color?.value), ); @@ -402,7 +398,7 @@ class SettingsScreen extends HookConsumerWidget { onColorChanged: (color) { final current = settings.customColors ?? ThemeColors(); ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setCustomColors(current.copyWith(error: color?.value)); }, ), @@ -412,9 +408,7 @@ class SettingsScreen extends HookConsumerWidget { trailing: const Icon(Symbols.restart_alt).padding(right: 2), contentPadding: EdgeInsets.symmetric(horizontal: 20), onTap: () { - ref - .read(appSettingsNotifierProvider.notifier) - .setCustomColors(null); + ref.read(appSettingsProvider.notifier).setCustomColors(null); showSnackBar('settingsApplied'.tr()); }, ), @@ -448,9 +442,7 @@ class SettingsScreen extends HookConsumerWidget { value: settings.fabPosition, onChanged: (String? value) { if (value != null) { - ref - .read(appSettingsNotifierProvider.notifier) - .setFabPosition(value); + ref.read(appSettingsProvider.notifier).setFabPosition(value); showSnackBar('settingsApplied'.tr()); } }, @@ -481,7 +473,7 @@ class SettingsScreen extends HookConsumerWidget { label: '${(settings.cardTransparency * 100).round()}%', onChanged: (value) { ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setAppTransparentBackground(value); }, ), @@ -533,7 +525,7 @@ class SettingsScreen extends HookConsumerWidget { value: settings.showBackgroundImage, onChanged: (value) { ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setShowBackgroundImage(value); }, ), @@ -609,7 +601,7 @@ class SettingsScreen extends HookConsumerWidget { ? colorScheme.primary : colorScheme.primary; ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setAppColorScheme(color.value); if (context.mounted) { hideLoadingModal(context); @@ -699,7 +691,7 @@ class SettingsScreen extends HookConsumerWidget { value: currentPoolId, onChanged: (value) { ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setDefaultPoolId(value); showSnackBar('settingsApplied'.tr()); }, @@ -738,9 +730,7 @@ class SettingsScreen extends HookConsumerWidget { trailing: Switch( value: settings.autoTranslate, onChanged: (value) { - ref - .read(appSettingsNotifierProvider.notifier) - .setAutoTranslate(value); + ref.read(appSettingsProvider.notifier).setAutoTranslate(value); }, ), ), @@ -754,9 +744,7 @@ class SettingsScreen extends HookConsumerWidget { trailing: Switch( value: settings.soundEffects, onChanged: (value) { - ref - .read(appSettingsNotifierProvider.notifier) - .setSoundEffects(value); + ref.read(appSettingsProvider.notifier).setSoundEffects(value); }, ), ), @@ -770,9 +758,7 @@ class SettingsScreen extends HookConsumerWidget { trailing: Switch( value: settings.aprilFoolFeatures, onChanged: (value) { - ref - .read(appSettingsNotifierProvider.notifier) - .setAprilFoolFeatures(value); + ref.read(appSettingsProvider.notifier).setAprilFoolFeatures(value); }, ), ), @@ -790,9 +776,7 @@ class SettingsScreen extends HookConsumerWidget { trailing: Switch( value: settings.enterToSend, onChanged: (value) { - ref - .read(appSettingsNotifierProvider.notifier) - .setEnterToSend(value); + ref.read(appSettingsProvider.notifier).setEnterToSend(value); }, ), ), @@ -806,9 +790,7 @@ class SettingsScreen extends HookConsumerWidget { trailing: Switch( value: settings.appBarTransparent, onChanged: (value) { - ref - .read(appSettingsNotifierProvider.notifier) - .setAppBarTransparent(value); + ref.read(appSettingsProvider.notifier).setAppBarTransparent(value); }, ), ), @@ -820,9 +802,7 @@ class SettingsScreen extends HookConsumerWidget { trailing: Switch( value: settings.dataSavingMode, onChanged: (value) { - ref - .read(appSettingsNotifierProvider.notifier) - .setDataSavingMode(value); + ref.read(appSettingsProvider.notifier).setDataSavingMode(value); }, ), ), @@ -836,9 +816,7 @@ class SettingsScreen extends HookConsumerWidget { trailing: Switch( value: settings.disableAnimation, onChanged: (value) { - ref - .read(appSettingsNotifierProvider.notifier) - .setDisableAnimation(value); + ref.read(appSettingsProvider.notifier).setDisableAnimation(value); }, ), ), @@ -865,7 +843,7 @@ class SettingsScreen extends HookConsumerWidget { label: '${(settings.windowOpacity * 100).round()}%', onChanged: (value) { ref - .read(appSettingsNotifierProvider.notifier) + .read(appSettingsProvider.notifier) .setWindowOpacity(value); }, ), diff --git a/lib/screens/stickers/pack_detail.g.dart b/lib/screens/stickers/pack_detail.g.dart index dc23f1e9..1c260a67 100644 --- a/lib/screens/stickers/pack_detail.g.dart +++ b/lib/screens/stickers/pack_detail.g.dart @@ -6,312 +6,173 @@ part of 'pack_detail.dart'; // RiverpodGenerator // ************************************************************************** -String _$marketplaceStickerPackContentHash() => - r'886f8305c978dbea6e5d990a7d555048ac704a5d'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning /// Marketplace version of sticker pack detail page (no publisher dependency). /// Shows all stickers in the pack and provides a button to add the sticker. /// API interactions are intentionally left blank per request. -/// -/// Copied from [marketplaceStickerPackContent]. + @ProviderFor(marketplaceStickerPackContent) const marketplaceStickerPackContentProvider = - MarketplaceStickerPackContentFamily(); + MarketplaceStickerPackContentFamily._(); /// Marketplace version of sticker pack detail page (no publisher dependency). /// Shows all stickers in the pack and provides a button to add the sticker. /// API interactions are intentionally left blank per request. -/// -/// Copied from [marketplaceStickerPackContent]. -class MarketplaceStickerPackContentFamily - extends Family>> { + +final class MarketplaceStickerPackContentProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { /// Marketplace version of sticker pack detail page (no publisher dependency). /// Shows all stickers in the pack and provides a button to add the sticker. /// API interactions are intentionally left blank per request. - /// - /// Copied from [marketplaceStickerPackContent]. - const MarketplaceStickerPackContentFamily(); + const MarketplaceStickerPackContentProvider._({ + required MarketplaceStickerPackContentFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'marketplaceStickerPackContentProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// Marketplace version of sticker pack detail page (no publisher dependency). - /// Shows all stickers in the pack and provides a button to add the sticker. - /// API interactions are intentionally left blank per request. - /// - /// Copied from [marketplaceStickerPackContent]. - MarketplaceStickerPackContentProvider call({required String packId}) { - return MarketplaceStickerPackContentProvider(packId: packId); + @override + String debugGetCreateSourceHash() => _$marketplaceStickerPackContentHash(); + + @override + String toString() { + return r'marketplaceStickerPackContentProvider' + '' + '($argument)'; } + @$internal @override - MarketplaceStickerPackContentProvider getProviderOverride( - covariant MarketplaceStickerPackContentProvider provider, - ) { - return call(packId: provider.packId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'marketplaceStickerPackContentProvider'; -} - -/// Marketplace version of sticker pack detail page (no publisher dependency). -/// Shows all stickers in the pack and provides a button to add the sticker. -/// API interactions are intentionally left blank per request. -/// -/// Copied from [marketplaceStickerPackContent]. -class MarketplaceStickerPackContentProvider - extends AutoDisposeFutureProvider> { - /// Marketplace version of sticker pack detail page (no publisher dependency). - /// Shows all stickers in the pack and provides a button to add the sticker. - /// API interactions are intentionally left blank per request. - /// - /// Copied from [marketplaceStickerPackContent]. - MarketplaceStickerPackContentProvider({required String packId}) - : this._internal( - (ref) => marketplaceStickerPackContent( - ref as MarketplaceStickerPackContentRef, - packId: packId, - ), - from: marketplaceStickerPackContentProvider, - name: r'marketplaceStickerPackContentProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$marketplaceStickerPackContentHash, - dependencies: MarketplaceStickerPackContentFamily._dependencies, - allTransitiveDependencies: - MarketplaceStickerPackContentFamily._allTransitiveDependencies, - packId: packId, - ); - - MarketplaceStickerPackContentProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.packId, - }) : super.internal(); - - final String packId; - - @override - Override overrideWith( - FutureOr> Function( - MarketplaceStickerPackContentRef provider, - ) - create, - ) { - return ProviderOverride( - origin: this, - override: MarketplaceStickerPackContentProvider._internal( - (ref) => create(ref as MarketplaceStickerPackContentRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - packId: packId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _MarketplaceStickerPackContentProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return marketplaceStickerPackContent(ref, packId: argument); } @override bool operator ==(Object other) { return other is MarketplaceStickerPackContentProvider && - other.packId == packId; + other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, packId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin MarketplaceStickerPackContentRef - on AutoDisposeFutureProviderRef> { - /// The parameter `packId` of this provider. - String get packId; -} +String _$marketplaceStickerPackContentHash() => + r'886f8305c978dbea6e5d990a7d555048ac704a5d'; -class _MarketplaceStickerPackContentProviderElement - extends AutoDisposeFutureProviderElement> - with MarketplaceStickerPackContentRef { - _MarketplaceStickerPackContentProviderElement(super.provider); +/// Marketplace version of sticker pack detail page (no publisher dependency). +/// Shows all stickers in the pack and provides a button to add the sticker. +/// API interactions are intentionally left blank per request. - @override - String get packId => (origin as MarketplaceStickerPackContentProvider).packId; -} - -String _$marketplaceStickerPackOwnershipHash() => - r'e5dd301c309fac958729d13d984ce7a77edbe7e6'; - -/// See also [marketplaceStickerPackOwnership]. -@ProviderFor(marketplaceStickerPackOwnership) -const marketplaceStickerPackOwnershipProvider = - MarketplaceStickerPackOwnershipFamily(); - -/// See also [marketplaceStickerPackOwnership]. -class MarketplaceStickerPackOwnershipFamily extends Family> { - /// See also [marketplaceStickerPackOwnership]. - const MarketplaceStickerPackOwnershipFamily(); - - /// See also [marketplaceStickerPackOwnership]. - MarketplaceStickerPackOwnershipProvider call({required String packId}) { - return MarketplaceStickerPackOwnershipProvider(packId: packId); - } - - @override - MarketplaceStickerPackOwnershipProvider getProviderOverride( - covariant MarketplaceStickerPackOwnershipProvider provider, - ) { - return call(packId: provider.packId); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'marketplaceStickerPackOwnershipProvider'; -} - -/// See also [marketplaceStickerPackOwnership]. -class MarketplaceStickerPackOwnershipProvider - extends AutoDisposeFutureProvider { - /// See also [marketplaceStickerPackOwnership]. - MarketplaceStickerPackOwnershipProvider({required String packId}) - : this._internal( - (ref) => marketplaceStickerPackOwnership( - ref as MarketplaceStickerPackOwnershipRef, - packId: packId, - ), - from: marketplaceStickerPackOwnershipProvider, - name: r'marketplaceStickerPackOwnershipProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$marketplaceStickerPackOwnershipHash, - dependencies: MarketplaceStickerPackOwnershipFamily._dependencies, - allTransitiveDependencies: - MarketplaceStickerPackOwnershipFamily._allTransitiveDependencies, - packId: packId, +final class MarketplaceStickerPackContentFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const MarketplaceStickerPackContentFamily._() + : super( + retry: null, + name: r'marketplaceStickerPackContentProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - MarketplaceStickerPackOwnershipProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.packId, - }) : super.internal(); + /// Marketplace version of sticker pack detail page (no publisher dependency). + /// Shows all stickers in the pack and provides a button to add the sticker. + /// API interactions are intentionally left blank per request. - final String packId; + MarketplaceStickerPackContentProvider call({required String packId}) => + MarketplaceStickerPackContentProvider._(argument: packId, from: this); @override - Override overrideWith( - FutureOr Function(MarketplaceStickerPackOwnershipRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: MarketplaceStickerPackOwnershipProvider._internal( - (ref) => create(ref as MarketplaceStickerPackOwnershipRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - packId: packId, - ), - ); + String toString() => r'marketplaceStickerPackContentProvider'; +} + +@ProviderFor(marketplaceStickerPackOwnership) +const marketplaceStickerPackOwnershipProvider = + MarketplaceStickerPackOwnershipFamily._(); + +final class MarketplaceStickerPackOwnershipProvider + extends $FunctionalProvider, bool, FutureOr> + with $FutureModifier, $FutureProvider { + const MarketplaceStickerPackOwnershipProvider._({ + required MarketplaceStickerPackOwnershipFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'marketplaceStickerPackOwnershipProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$marketplaceStickerPackOwnershipHash(); + + @override + String toString() { + return r'marketplaceStickerPackOwnershipProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _MarketplaceStickerPackOwnershipProviderElement(this); + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return marketplaceStickerPackOwnership(ref, packId: argument); } @override bool operator ==(Object other) { return other is MarketplaceStickerPackOwnershipProvider && - other.packId == packId; + other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, packId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin MarketplaceStickerPackOwnershipRef on AutoDisposeFutureProviderRef { - /// The parameter `packId` of this provider. - String get packId; -} +String _$marketplaceStickerPackOwnershipHash() => + r'e5dd301c309fac958729d13d984ce7a77edbe7e6'; -class _MarketplaceStickerPackOwnershipProviderElement - extends AutoDisposeFutureProviderElement - with MarketplaceStickerPackOwnershipRef { - _MarketplaceStickerPackOwnershipProviderElement(super.provider); +final class MarketplaceStickerPackOwnershipFamily extends $Family + with $FunctionalFamilyOverride, String> { + const MarketplaceStickerPackOwnershipFamily._() + : super( + retry: null, + name: r'marketplaceStickerPackOwnershipProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + MarketplaceStickerPackOwnershipProvider call({required String packId}) => + MarketplaceStickerPackOwnershipProvider._(argument: packId, from: this); @override - String get packId => - (origin as MarketplaceStickerPackOwnershipProvider).packId; + String toString() => r'marketplaceStickerPackOwnershipProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/tabs.dart b/lib/screens/tabs.dart index 347ca559..6a356a0c 100644 --- a/lib/screens/tabs.dart +++ b/lib/screens/tabs.dart @@ -3,8 +3,8 @@ import 'dart:ui'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:go_router/go_router.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:island/pods/userinfo.dart'; import 'package:island/screens/notification.dart'; import 'package:island/services/responsive.dart'; @@ -16,7 +16,20 @@ import 'package:styled_widget/styled_widget.dart'; import 'package:island/pods/config.dart'; import 'package:island/pods/chat/chat_summary.dart'; -final currentRouteProvider = StateProvider((ref) => null); +final currentRouteProvider = NotifierProvider( + CurrentRouteNotifier.new, +); + +class CurrentRouteNotifier extends Notifier { + @override + String? build() { + return null; + } + + void updateRoute(String? route) { + state = route; + } +} const kWideScreenRouteStart = 4; const kTabRoutes = [ @@ -42,16 +55,14 @@ class TabsScreen extends HookConsumerWidget { // Update the current route provider whenever the location changes useEffect(() { WidgetsBinding.instance.addPostFrameCallback((_) { - ref.read(currentRouteProvider.notifier).state = currentLocation; + ref.read(currentRouteProvider.notifier).updateRoute(currentLocation); }); return null; }, [currentLocation]); - final notificationUnreadCount = ref.watch( - notificationUnreadCountNotifierProvider, - ); + final notificationUnreadCount = ref.watch(notificationUnreadCountProvider); - final chatUnreadCount = ref.watch(chatUnreadCountNotifierProvider); + final chatUnreadCount = ref.watch(chatUnreadCountProvider); final wideScreen = isWideScreen(context); @@ -134,7 +145,7 @@ class TabsScreen extends HookConsumerWidget { isWideScreen(context) ? null : kWideScreenRouteStart, ); final shouldShowFab = routes.contains(currentLocation) && !wideScreen; - final settings = ref.watch(appSettingsNotifierProvider); + final settings = ref.watch(appSettingsProvider); if (isWideScreen(context)) { return Container( diff --git a/lib/screens/thought/think.dart b/lib/screens/thought/think.dart index fbad2e41..a1324148 100644 --- a/lib/screens/thought/think.dart +++ b/lib/screens/thought/think.dart @@ -66,7 +66,7 @@ class ThoughtScreen extends HookConsumerWidget { ); // Get initial thoughts and topic from provider - final initialThoughts = thoughts.valueOrNull; + final initialThoughts = thoughts.value; final initialTopic = (initialThoughts?.isNotEmpty ?? false) && initialThoughts!.first.sequence?.topic != null diff --git a/lib/screens/thought/think.g.dart b/lib/screens/thought/think.g.dart index e457db28..2bfcbd0c 100644 --- a/lib/screens/thought/think.g.dart +++ b/lib/screens/thought/think.g.dart @@ -6,190 +6,157 @@ part of 'think.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(thoughtAvailableStaus) +const thoughtAvailableStausProvider = ThoughtAvailableStausProvider._(); + +final class ThoughtAvailableStausProvider + extends $FunctionalProvider, bool, FutureOr> + with $FutureModifier, $FutureProvider { + const ThoughtAvailableStausProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'thoughtAvailableStausProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$thoughtAvailableStausHash(); + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return thoughtAvailableStaus(ref); + } +} + String _$thoughtAvailableStausHash() => r'720e04e56bff8c4d4ca6854ce997da4e7926c84c'; -/// See also [thoughtAvailableStaus]. -@ProviderFor(thoughtAvailableStaus) -final thoughtAvailableStausProvider = AutoDisposeFutureProvider.internal( - thoughtAvailableStaus, - name: r'thoughtAvailableStausProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$thoughtAvailableStausHash, - dependencies: null, - allTransitiveDependencies: null, -); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef ThoughtAvailableStausRef = AutoDisposeFutureProviderRef; -String _$thoughtSequenceHash() => r'2a93c0a04f9a720ba474c02a36502940fb7f3ed7'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [thoughtSequence]. @ProviderFor(thoughtSequence) -const thoughtSequenceProvider = ThoughtSequenceFamily(); +const thoughtSequenceProvider = ThoughtSequenceFamily._(); -/// See also [thoughtSequence]. -class ThoughtSequenceFamily - extends Family>> { - /// See also [thoughtSequence]. - const ThoughtSequenceFamily(); +final class ThoughtSequenceProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const ThoughtSequenceProvider._({ + required ThoughtSequenceFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'thoughtSequenceProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [thoughtSequence]. - ThoughtSequenceProvider call(String sequenceId) { - return ThoughtSequenceProvider(sequenceId); + @override + String debugGetCreateSourceHash() => _$thoughtSequenceHash(); + + @override + String toString() { + return r'thoughtSequenceProvider' + '' + '($argument)'; } + @$internal @override - ThoughtSequenceProvider getProviderOverride( - covariant ThoughtSequenceProvider provider, - ) { - return call(provider.sequenceId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'thoughtSequenceProvider'; -} - -/// See also [thoughtSequence]. -class ThoughtSequenceProvider - extends AutoDisposeFutureProvider> { - /// See also [thoughtSequence]. - ThoughtSequenceProvider(String sequenceId) - : this._internal( - (ref) => thoughtSequence(ref as ThoughtSequenceRef, sequenceId), - from: thoughtSequenceProvider, - name: r'thoughtSequenceProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$thoughtSequenceHash, - dependencies: ThoughtSequenceFamily._dependencies, - allTransitiveDependencies: - ThoughtSequenceFamily._allTransitiveDependencies, - sequenceId: sequenceId, - ); - - ThoughtSequenceProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.sequenceId, - }) : super.internal(); - - final String sequenceId; - - @override - Override overrideWith( - FutureOr> Function(ThoughtSequenceRef provider) - create, - ) { - return ProviderOverride( - origin: this, - override: ThoughtSequenceProvider._internal( - (ref) => create(ref as ThoughtSequenceRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - sequenceId: sequenceId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _ThoughtSequenceProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return thoughtSequence(ref, argument); } @override bool operator ==(Object other) { - return other is ThoughtSequenceProvider && other.sequenceId == sequenceId; + return other is ThoughtSequenceProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, sequenceId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin ThoughtSequenceRef - on AutoDisposeFutureProviderRef> { - /// The parameter `sequenceId` of this provider. - String get sequenceId; -} +String _$thoughtSequenceHash() => r'2a93c0a04f9a720ba474c02a36502940fb7f3ed7'; -class _ThoughtSequenceProviderElement - extends AutoDisposeFutureProviderElement> - with ThoughtSequenceRef { - _ThoughtSequenceProviderElement(super.provider); +final class ThoughtSequenceFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const ThoughtSequenceFamily._() + : super( + retry: null, + name: r'thoughtSequenceProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + ThoughtSequenceProvider call(String sequenceId) => + ThoughtSequenceProvider._(argument: sequenceId, from: this); @override - String get sequenceId => (origin as ThoughtSequenceProvider).sequenceId; + String toString() => r'thoughtSequenceProvider'; +} + +@ProviderFor(thoughtServices) +const thoughtServicesProvider = ThoughtServicesProvider._(); + +final class ThoughtServicesProvider + extends + $FunctionalProvider< + AsyncValue, + ThoughtServicesResponse, + FutureOr + > + with + $FutureModifier, + $FutureProvider { + const ThoughtServicesProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'thoughtServicesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$thoughtServicesHash(); + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return thoughtServices(ref); + } } String _$thoughtServicesHash() => r'0ddeaec713ecfcdc9786c197f3d4cb41d36c26a5'; - -/// See also [thoughtServices]. -@ProviderFor(thoughtServices) -final thoughtServicesProvider = - AutoDisposeFutureProvider.internal( - thoughtServices, - name: r'thoughtServicesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$thoughtServicesHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef ThoughtServicesRef = - AutoDisposeFutureProviderRef; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/screens/wallet.dart b/lib/screens/wallet.dart index d10a63d5..a026165c 100644 --- a/lib/screens/wallet.dart +++ b/lib/screens/wallet.dart @@ -991,7 +991,7 @@ class _CreateTransferSheetState extends State { } } -final transactionListNotifierProvider = AsyncNotifierProvider( +final transactionListProvider = AsyncNotifierProvider( TransactionListNotifier.new, ); @@ -1019,9 +1019,7 @@ class TransactionListNotifier extends AsyncNotifier> } } -final walletFundsNotifierProvider = AsyncNotifierProvider( - WalletFundsNotifier.new, -); +final walletFundsProvider = AsyncNotifierProvider(WalletFundsNotifier.new); class WalletFundsNotifier extends AsyncNotifier> with AsyncPaginationController { @@ -1045,7 +1043,7 @@ class WalletFundsNotifier extends AsyncNotifier> } } -final walletFundRecipientsNotifierProvider = AsyncNotifierProvider( +final walletFundRecipientsProvider = AsyncNotifierProvider( WalletFundRecipientsNotifier.new, ); @@ -1428,8 +1426,8 @@ class WalletScreen extends HookConsumerWidget { // Transactions Tab PaginationList( padding: EdgeInsets.zero, - provider: transactionListNotifierProvider, - notifier: transactionListNotifierProvider.notifier, + provider: transactionListProvider, + notifier: transactionListProvider.notifier, itemBuilder: (context, index, transaction) { final isIncome = transaction.payeeWalletId == wallet.value?.id; @@ -1519,7 +1517,7 @@ class WalletScreen extends HookConsumerWidget { } Widget _buildFundsList(BuildContext context, WidgetRef ref) { - final funds = ref.watch(walletFundsNotifierProvider); + final funds = ref.watch(walletFundsProvider); return funds.when( data: (fundList) { @@ -1781,7 +1779,7 @@ class WalletScreen extends HookConsumerWidget { if (paidOrder != null) { // Wait for server to handle order await Future.delayed(const Duration(seconds: 1)); - ref.invalidate(walletFundsNotifierProvider); + ref.invalidate(walletFundsProvider); ref.invalidate(walletCurrentProvider); if (context.mounted) { showSnackBar('fundCreatedSuccessfully'.tr()); @@ -1807,7 +1805,7 @@ class WalletScreen extends HookConsumerWidget { if (context.mounted) hideLoadingModal(context); // Invalidate providers to refresh data - ref.invalidate(transactionListNotifierProvider); + ref.invalidate(transactionListProvider); ref.invalidate(walletCurrentProvider); if (context.mounted) { showSnackBar('transferCreatedSuccessfully'.tr()); diff --git a/lib/screens/wallet.g.dart b/lib/screens/wallet.g.dart index 40360d50..4a61121f 100644 --- a/lib/screens/wallet.g.dart +++ b/lib/screens/wallet.g.dart @@ -6,180 +6,157 @@ part of 'wallet.dart'; // RiverpodGenerator // ************************************************************************** -String _$walletCurrentHash() => r'bdc7cb27ce2286b561a03522085cc4efc884faad'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [walletCurrent]. @ProviderFor(walletCurrent) -final walletCurrentProvider = AutoDisposeFutureProvider.internal( - walletCurrent, - name: r'walletCurrentProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$walletCurrentHash, - dependencies: null, - allTransitiveDependencies: null, -); +const walletCurrentProvider = WalletCurrentProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef WalletCurrentRef = AutoDisposeFutureProviderRef; -String _$walletStatsHash() => r'2243011937b377a66cdf44cae144021cee69e82f'; - -/// See also [walletStats]. -@ProviderFor(walletStats) -final walletStatsProvider = AutoDisposeFutureProvider.internal( - walletStats, - name: r'walletStatsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') ? null : _$walletStatsHash, - dependencies: null, - allTransitiveDependencies: null, -); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef WalletStatsRef = AutoDisposeFutureProviderRef; -String _$walletFundHash() => r'459efdee5e2775eedaa4312e0d317c218fa7e1fa'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [walletFund]. -@ProviderFor(walletFund) -const walletFundProvider = WalletFundFamily(); - -/// See also [walletFund]. -class WalletFundFamily extends Family> { - /// See also [walletFund]. - const WalletFundFamily(); - - /// See also [walletFund]. - WalletFundProvider call(String fundId) { - return WalletFundProvider(fundId); - } - - @override - WalletFundProvider getProviderOverride( - covariant WalletFundProvider provider, - ) { - return call(provider.fundId); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'walletFundProvider'; -} - -/// See also [walletFund]. -class WalletFundProvider extends AutoDisposeFutureProvider { - /// See also [walletFund]. - WalletFundProvider(String fundId) - : this._internal( - (ref) => walletFund(ref as WalletFundRef, fundId), - from: walletFundProvider, - name: r'walletFundProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$walletFundHash, - dependencies: WalletFundFamily._dependencies, - allTransitiveDependencies: WalletFundFamily._allTransitiveDependencies, - fundId: fundId, +final class WalletCurrentProvider + extends + $FunctionalProvider< + AsyncValue, + SnWallet?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const WalletCurrentProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'walletCurrentProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, ); - WalletFundProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.fundId, - }) : super.internal(); + @override + String debugGetCreateSourceHash() => _$walletCurrentHash(); - final String fundId; + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Override overrideWith( - FutureOr Function(WalletFundRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: WalletFundProvider._internal( - (ref) => create(ref as WalletFundRef), - from: from, - name: null, + FutureOr create(Ref ref) { + return walletCurrent(ref); + } +} + +String _$walletCurrentHash() => r'bdc7cb27ce2286b561a03522085cc4efc884faad'; + +@ProviderFor(walletStats) +const walletStatsProvider = WalletStatsProvider._(); + +final class WalletStatsProvider + extends + $FunctionalProvider< + AsyncValue, + SnWalletStats, + FutureOr + > + with $FutureModifier, $FutureProvider { + const WalletStatsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'walletStatsProvider', + isAutoDispose: true, dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - fundId: fundId, - ), - ); + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$walletStatsHash(); + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return walletStats(ref); + } +} + +String _$walletStatsHash() => r'2243011937b377a66cdf44cae144021cee69e82f'; + +@ProviderFor(walletFund) +const walletFundProvider = WalletFundFamily._(); + +final class WalletFundProvider + extends + $FunctionalProvider< + AsyncValue, + SnWalletFund, + FutureOr + > + with $FutureModifier, $FutureProvider { + const WalletFundProvider._({ + required WalletFundFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'walletFundProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$walletFundHash(); + + @override + String toString() { + return r'walletFundProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement createElement() { - return _WalletFundProviderElement(this); + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return walletFund(ref, argument); } @override bool operator ==(Object other) { - return other is WalletFundProvider && other.fundId == fundId; + return other is WalletFundProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, fundId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin WalletFundRef on AutoDisposeFutureProviderRef { - /// The parameter `fundId` of this provider. - String get fundId; -} +String _$walletFundHash() => r'459efdee5e2775eedaa4312e0d317c218fa7e1fa'; -class _WalletFundProviderElement - extends AutoDisposeFutureProviderElement - with WalletFundRef { - _WalletFundProviderElement(super.provider); +final class WalletFundFamily extends $Family + with $FunctionalFamilyOverride, String> { + const WalletFundFamily._() + : super( + retry: null, + name: r'walletFundProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + WalletFundProvider call(String fundId) => + WalletFundProvider._(argument: fundId, from: this); @override - String get fundId => (origin as WalletFundProvider).fundId; + String toString() => r'walletFundProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/services/compose_storage_db.g.dart b/lib/services/compose_storage_db.g.dart index e40d3ca1..59031c6f 100644 --- a/lib/services/compose_storage_db.g.dart +++ b/lib/services/compose_storage_db.g.dart @@ -6,25 +6,59 @@ part of 'compose_storage_db.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(ComposeStorageNotifier) +const composeStorageProvider = ComposeStorageNotifierProvider._(); + +final class ComposeStorageNotifierProvider + extends $NotifierProvider> { + const ComposeStorageNotifierProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'composeStorageProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$composeStorageNotifierHash(); + + @$internal + @override + ComposeStorageNotifier create() => ComposeStorageNotifier(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(Map value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider>(value), + ); + } +} + String _$composeStorageNotifierHash() => r'e78dbfd8dbaf728970985aaa2ac4df3575ddfcdf'; -/// See also [ComposeStorageNotifier]. -@ProviderFor(ComposeStorageNotifier) -final composeStorageNotifierProvider = AutoDisposeNotifierProvider< - ComposeStorageNotifier, - Map ->.internal( - ComposeStorageNotifier.new, - name: r'composeStorageNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$composeStorageNotifierHash, - dependencies: null, - allTransitiveDependencies: null, -); - -typedef _$ComposeStorageNotifier = AutoDisposeNotifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$ComposeStorageNotifier extends $Notifier> { + Map build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = this.ref as $Ref, Map>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, Map>, + Map, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/services/tour.g.dart b/lib/services/tour.g.dart index 3fa869d6..8cfd68f1 100644 --- a/lib/services/tour.g.dart +++ b/lib/services/tour.g.dart @@ -6,23 +6,59 @@ part of 'tour.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(TourStatusNotifier) +const tourStatusProvider = TourStatusNotifierProvider._(); + +final class TourStatusNotifierProvider + extends $NotifierProvider> { + const TourStatusNotifierProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'tourStatusProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$tourStatusNotifierHash(); + + @$internal + @override + TourStatusNotifier create() => TourStatusNotifier(); + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(Map value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider>(value), + ); + } +} + String _$tourStatusNotifierHash() => r'ee712e1f8010311df8f24838814ab5c451f9e593'; -/// See also [TourStatusNotifier]. -@ProviderFor(TourStatusNotifier) -final tourStatusNotifierProvider = - AutoDisposeNotifierProvider>.internal( - TourStatusNotifier.new, - name: r'tourStatusNotifierProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$tourStatusNotifierHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -typedef _$TourStatusNotifier = AutoDisposeNotifier>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +abstract class _$TourStatusNotifier extends $Notifier> { + Map build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = this.ref as $Ref, Map>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier, Map>, + Map, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/widgets/account/account_devices.g.dart b/lib/widgets/account/account_devices.g.dart index 19d2141d..d7e6fc8b 100644 --- a/lib/widgets/account/account_devices.g.dart +++ b/lib/widgets/account/account_devices.g.dart @@ -6,25 +6,46 @@ part of 'account_devices.dart'; // RiverpodGenerator // ************************************************************************** -String _$authDevicesHash() => r'1af378149286020ec263be178c573ccc247a0cd1'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [authDevices]. @ProviderFor(authDevices) -final authDevicesProvider = - AutoDisposeFutureProvider>.internal( - authDevices, - name: r'authDevicesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$authDevicesHash, - dependencies: null, - allTransitiveDependencies: null, - ); +const authDevicesProvider = AuthDevicesProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef AuthDevicesRef = - AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class AuthDevicesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const AuthDevicesProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'authDevicesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$authDevicesHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return authDevices(ref); + } +} + +String _$authDevicesHash() => r'1af378149286020ec263be178c573ccc247a0cd1'; diff --git a/lib/widgets/account/account_picker.g.dart b/lib/widgets/account/account_picker.g.dart index ee142f81..d25b6e84 100644 --- a/lib/widgets/account/account_picker.g.dart +++ b/lib/widgets/account/account_picker.g.dart @@ -6,148 +6,80 @@ part of 'account_picker.dart'; // RiverpodGenerator // ************************************************************************** -String _$searchAccountsHash() => r'3b4aa4d7970a1e406c1a0a1dfac2c686e05bc533'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [searchAccounts]. @ProviderFor(searchAccounts) -const searchAccountsProvider = SearchAccountsFamily(); +const searchAccountsProvider = SearchAccountsFamily._(); -/// See also [searchAccounts]. -class SearchAccountsFamily extends Family>> { - /// See also [searchAccounts]. - const SearchAccountsFamily(); +final class SearchAccountsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + const SearchAccountsProvider._({ + required SearchAccountsFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'searchAccountsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [searchAccounts]. - SearchAccountsProvider call({required String query}) { - return SearchAccountsProvider(query: query); + @override + String debugGetCreateSourceHash() => _$searchAccountsHash(); + + @override + String toString() { + return r'searchAccountsProvider' + '' + '($argument)'; } + @$internal @override - SearchAccountsProvider getProviderOverride( - covariant SearchAccountsProvider provider, - ) { - return call(query: provider.query); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'searchAccountsProvider'; -} - -/// See also [searchAccounts]. -class SearchAccountsProvider - extends AutoDisposeFutureProvider> { - /// See also [searchAccounts]. - SearchAccountsProvider({required String query}) - : this._internal( - (ref) => searchAccounts(ref as SearchAccountsRef, query: query), - from: searchAccountsProvider, - name: r'searchAccountsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$searchAccountsHash, - dependencies: SearchAccountsFamily._dependencies, - allTransitiveDependencies: - SearchAccountsFamily._allTransitiveDependencies, - query: query, - ); - - SearchAccountsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.query, - }) : super.internal(); - - final String query; - - @override - Override overrideWith( - FutureOr> Function(SearchAccountsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: SearchAccountsProvider._internal( - (ref) => create(ref as SearchAccountsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - query: query, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _SearchAccountsProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as String; + return searchAccounts(ref, query: argument); } @override bool operator ==(Object other) { - return other is SearchAccountsProvider && other.query == query; + return other is SearchAccountsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, query.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin SearchAccountsRef on AutoDisposeFutureProviderRef> { - /// The parameter `query` of this provider. - String get query; -} +String _$searchAccountsHash() => r'3b4aa4d7970a1e406c1a0a1dfac2c686e05bc533'; -class _SearchAccountsProviderElement - extends AutoDisposeFutureProviderElement> - with SearchAccountsRef { - _SearchAccountsProviderElement(super.provider); +final class SearchAccountsFamily extends $Family + with $FunctionalFamilyOverride>, String> { + const SearchAccountsFamily._() + : super( + retry: null, + name: r'searchAccountsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + SearchAccountsProvider call({required String query}) => + SearchAccountsProvider._(argument: query, from: this); @override - String get query => (origin as SearchAccountsProvider).query; + String toString() => r'searchAccountsProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/widgets/account/activity_presence.g.dart b/lib/widgets/account/activity_presence.g.dart index b5cea611..7fca19ca 100644 --- a/lib/widgets/account/activity_presence.g.dart +++ b/lib/widgets/account/activity_presence.g.dart @@ -6,282 +6,159 @@ part of 'activity_presence.dart'; // RiverpodGenerator // ************************************************************************** -String _$discordAssetsHash() => r'3ef8465188059de96cf2ac9660ed3d88910443bf'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [discordAssets]. @ProviderFor(discordAssets) -const discordAssetsProvider = DiscordAssetsFamily(); +const discordAssetsProvider = DiscordAssetsFamily._(); -/// See also [discordAssets]. -class DiscordAssetsFamily extends Family?>> { - /// See also [discordAssets]. - const DiscordAssetsFamily(); +final class DiscordAssetsProvider + extends + $FunctionalProvider< + AsyncValue?>, + Map?, + FutureOr?> + > + with + $FutureModifier?>, + $FutureProvider?> { + const DiscordAssetsProvider._({ + required DiscordAssetsFamily super.from, + required SnPresenceActivity super.argument, + }) : super( + retry: null, + name: r'discordAssetsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [discordAssets]. - DiscordAssetsProvider call(SnPresenceActivity activity) { - return DiscordAssetsProvider(activity); + @override + String debugGetCreateSourceHash() => _$discordAssetsHash(); + + @override + String toString() { + return r'discordAssetsProvider' + '' + '($argument)'; } + @$internal @override - DiscordAssetsProvider getProviderOverride( - covariant DiscordAssetsProvider provider, - ) { - return call(provider.activity); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement?> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'discordAssetsProvider'; -} - -/// See also [discordAssets]. -class DiscordAssetsProvider - extends AutoDisposeFutureProvider?> { - /// See also [discordAssets]. - DiscordAssetsProvider(SnPresenceActivity activity) - : this._internal( - (ref) => discordAssets(ref as DiscordAssetsRef, activity), - from: discordAssetsProvider, - name: r'discordAssetsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$discordAssetsHash, - dependencies: DiscordAssetsFamily._dependencies, - allTransitiveDependencies: - DiscordAssetsFamily._allTransitiveDependencies, - activity: activity, - ); - - DiscordAssetsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.activity, - }) : super.internal(); - - final SnPresenceActivity activity; - - @override - Override overrideWith( - FutureOr?> Function(DiscordAssetsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: DiscordAssetsProvider._internal( - (ref) => create(ref as DiscordAssetsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - activity: activity, - ), - ); - } - - @override - AutoDisposeFutureProviderElement?> createElement() { - return _DiscordAssetsProviderElement(this); + FutureOr?> create(Ref ref) { + final argument = this.argument as SnPresenceActivity; + return discordAssets(ref, argument); } @override bool operator ==(Object other) { - return other is DiscordAssetsProvider && other.activity == activity; + return other is DiscordAssetsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, activity.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin DiscordAssetsRef on AutoDisposeFutureProviderRef?> { - /// The parameter `activity` of this provider. - SnPresenceActivity get activity; -} +String _$discordAssetsHash() => r'3ef8465188059de96cf2ac9660ed3d88910443bf'; -class _DiscordAssetsProviderElement - extends AutoDisposeFutureProviderElement?> - with DiscordAssetsRef { - _DiscordAssetsProviderElement(super.provider); +final class DiscordAssetsFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr?>, + SnPresenceActivity + > { + const DiscordAssetsFamily._() + : super( + retry: null, + name: r'discordAssetsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + DiscordAssetsProvider call(SnPresenceActivity activity) => + DiscordAssetsProvider._(argument: activity, from: this); @override - SnPresenceActivity get activity => (origin as DiscordAssetsProvider).activity; + String toString() => r'discordAssetsProvider'; +} + +@ProviderFor(discordAssetsUrl) +const discordAssetsUrlProvider = DiscordAssetsUrlFamily._(); + +final class DiscordAssetsUrlProvider + extends $FunctionalProvider, String?, FutureOr> + with $FutureModifier, $FutureProvider { + const DiscordAssetsUrlProvider._({ + required DiscordAssetsUrlFamily super.from, + required (SnPresenceActivity, String) super.argument, + }) : super( + retry: null, + name: r'discordAssetsUrlProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$discordAssetsUrlHash(); + + @override + String toString() { + return r'discordAssetsUrlProvider' + '' + '$argument'; + } + + @$internal + @override + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as (SnPresenceActivity, String); + return discordAssetsUrl(ref, argument.$1, argument.$2); + } + + @override + bool operator ==(Object other) { + return other is DiscordAssetsUrlProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$discordAssetsUrlHash() => r'a32f9333c3fb4d50ff88a54a6b8b72fbf5ba3ea1'; -/// See also [discordAssetsUrl]. -@ProviderFor(discordAssetsUrl) -const discordAssetsUrlProvider = DiscordAssetsUrlFamily(); - -/// See also [discordAssetsUrl]. -class DiscordAssetsUrlFamily extends Family> { - /// See also [discordAssetsUrl]. - const DiscordAssetsUrlFamily(); - - /// See also [discordAssetsUrl]. - DiscordAssetsUrlProvider call(SnPresenceActivity activity, String key) { - return DiscordAssetsUrlProvider(activity, key); - } - - @override - DiscordAssetsUrlProvider getProviderOverride( - covariant DiscordAssetsUrlProvider provider, - ) { - return call(provider.activity, provider.key); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'discordAssetsUrlProvider'; -} - -/// See also [discordAssetsUrl]. -class DiscordAssetsUrlProvider extends AutoDisposeFutureProvider { - /// See also [discordAssetsUrl]. - DiscordAssetsUrlProvider(SnPresenceActivity activity, String key) - : this._internal( - (ref) => discordAssetsUrl(ref as DiscordAssetsUrlRef, activity, key), - from: discordAssetsUrlProvider, +final class DiscordAssetsUrlFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr, + (SnPresenceActivity, String) + > { + const DiscordAssetsUrlFamily._() + : super( + retry: null, name: r'discordAssetsUrlProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$discordAssetsUrlHash, - dependencies: DiscordAssetsUrlFamily._dependencies, - allTransitiveDependencies: - DiscordAssetsUrlFamily._allTransitiveDependencies, - activity: activity, - key: key, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - DiscordAssetsUrlProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.activity, - required this.key, - }) : super.internal(); - - final SnPresenceActivity activity; - final String key; + DiscordAssetsUrlProvider call(SnPresenceActivity activity, String key) => + DiscordAssetsUrlProvider._(argument: (activity, key), from: this); @override - Override overrideWith( - FutureOr Function(DiscordAssetsUrlRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: DiscordAssetsUrlProvider._internal( - (ref) => create(ref as DiscordAssetsUrlRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - activity: activity, - key: key, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _DiscordAssetsUrlProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is DiscordAssetsUrlProvider && - other.activity == activity && - other.key == key; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, activity.hashCode); - hash = _SystemHash.combine(hash, key.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'discordAssetsUrlProvider'; } - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin DiscordAssetsUrlRef on AutoDisposeFutureProviderRef { - /// The parameter `activity` of this provider. - SnPresenceActivity get activity; - - /// The parameter `key` of this provider. - String get key; -} - -class _DiscordAssetsUrlProviderElement - extends AutoDisposeFutureProviderElement - with DiscordAssetsUrlRef { - _DiscordAssetsUrlProviderElement(super.provider); - - @override - SnPresenceActivity get activity => - (origin as DiscordAssetsUrlProvider).activity; - @override - String get key => (origin as DiscordAssetsUrlProvider).key; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/widgets/account/friends_overview.g.dart b/lib/widgets/account/friends_overview.g.dart index 0e43adeb..7e087a2c 100644 --- a/lib/widgets/account/friends_overview.g.dart +++ b/lib/widgets/account/friends_overview.g.dart @@ -6,25 +6,46 @@ part of 'friends_overview.dart'; // RiverpodGenerator // ************************************************************************** -String _$friendsOverviewHash() => r'5ef86c6849804c97abd3df094f120c7dd5e938db'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [friendsOverview]. @ProviderFor(friendsOverview) -final friendsOverviewProvider = - AutoDisposeFutureProvider>.internal( - friendsOverview, - name: r'friendsOverviewProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$friendsOverviewHash, - dependencies: null, - allTransitiveDependencies: null, - ); +const friendsOverviewProvider = FriendsOverviewProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef FriendsOverviewRef = - AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class FriendsOverviewProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const FriendsOverviewProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'friendsOverviewProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$friendsOverviewHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return friendsOverview(ref); + } +} + +String _$friendsOverviewHash() => r'5ef86c6849804c97abd3df094f120c7dd5e938db'; diff --git a/lib/widgets/account/status.dart b/lib/widgets/account/status.dart index 5933ca22..00948b0e 100644 --- a/lib/widgets/account/status.dart +++ b/lib/widgets/account/status.dart @@ -15,8 +15,16 @@ import 'package:styled_widget/styled_widget.dart'; part 'status.g.dart'; -class CurrentAccountStatusNotifier extends StateNotifier { - CurrentAccountStatusNotifier() : super(null); +final currentAccountStatusProvider = + NotifierProvider( + CurrentAccountStatusNotifier.new, + ); + +class CurrentAccountStatusNotifier extends Notifier { + @override + SnAccountStatus? build() { + return null; + } void setStatus(SnAccountStatus status) { state = status; @@ -27,13 +35,6 @@ class CurrentAccountStatusNotifier extends StateNotifier { } } -final currentAccountStatusProvider = - StateNotifierProvider(( - ref, - ) { - return CurrentAccountStatusNotifier(); - }); - @riverpod Future accountStatus(Ref ref, String uname) async { final userInfo = ref.watch(userInfoProvider); diff --git a/lib/widgets/account/status.g.dart b/lib/widgets/account/status.g.dart index 06399470..ebf60bb4 100644 --- a/lib/widgets/account/status.g.dart +++ b/lib/widgets/account/status.g.dart @@ -6,148 +6,80 @@ part of 'status.dart'; // RiverpodGenerator // ************************************************************************** -String _$accountStatusHash() => r'4cac809808e6f1345dab06dc32d759cfcea13315'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [accountStatus]. @ProviderFor(accountStatus) -const accountStatusProvider = AccountStatusFamily(); +const accountStatusProvider = AccountStatusFamily._(); -/// See also [accountStatus]. -class AccountStatusFamily extends Family> { - /// See also [accountStatus]. - const AccountStatusFamily(); +final class AccountStatusProvider + extends + $FunctionalProvider< + AsyncValue, + SnAccountStatus?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const AccountStatusProvider._({ + required AccountStatusFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'accountStatusProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [accountStatus]. - AccountStatusProvider call(String uname) { - return AccountStatusProvider(uname); + @override + String debugGetCreateSourceHash() => _$accountStatusHash(); + + @override + String toString() { + return r'accountStatusProvider' + '' + '($argument)'; } + @$internal @override - AccountStatusProvider getProviderOverride( - covariant AccountStatusProvider provider, - ) { - return call(provider.uname); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountStatusProvider'; -} - -/// See also [accountStatus]. -class AccountStatusProvider - extends AutoDisposeFutureProvider { - /// See also [accountStatus]. - AccountStatusProvider(String uname) - : this._internal( - (ref) => accountStatus(ref as AccountStatusRef, uname), - from: accountStatusProvider, - name: r'accountStatusProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountStatusHash, - dependencies: AccountStatusFamily._dependencies, - allTransitiveDependencies: - AccountStatusFamily._allTransitiveDependencies, - uname: uname, - ); - - AccountStatusProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.uname, - }) : super.internal(); - - final String uname; - - @override - Override overrideWith( - FutureOr Function(AccountStatusRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountStatusProvider._internal( - (ref) => create(ref as AccountStatusRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - uname: uname, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _AccountStatusProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return accountStatus(ref, argument); } @override bool operator ==(Object other) { - return other is AccountStatusProvider && other.uname == uname; + return other is AccountStatusProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, uname.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountStatusRef on AutoDisposeFutureProviderRef { - /// The parameter `uname` of this provider. - String get uname; -} +String _$accountStatusHash() => r'4cac809808e6f1345dab06dc32d759cfcea13315'; -class _AccountStatusProviderElement - extends AutoDisposeFutureProviderElement - with AccountStatusRef { - _AccountStatusProviderElement(super.provider); +final class AccountStatusFamily extends $Family + with $FunctionalFamilyOverride, String> { + const AccountStatusFamily._() + : super( + retry: null, + name: r'accountStatusProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + AccountStatusProvider call(String uname) => + AccountStatusProvider._(argument: uname, from: this); @override - String get uname => (origin as AccountStatusProvider).uname; + String toString() => r'accountStatusProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/widgets/account/stellar_program_tab.g.dart b/lib/widgets/account/stellar_program_tab.g.dart index 2d33182e..dc8c4e2d 100644 --- a/lib/widgets/account/stellar_program_tab.g.dart +++ b/lib/widgets/account/stellar_program_tab.g.dart @@ -6,447 +6,296 @@ part of 'stellar_program_tab.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(accountStellarSubscription) +const accountStellarSubscriptionProvider = + AccountStellarSubscriptionProvider._(); + +final class AccountStellarSubscriptionProvider + extends + $FunctionalProvider< + AsyncValue, + SnWalletSubscription?, + FutureOr + > + with + $FutureModifier, + $FutureProvider { + const AccountStellarSubscriptionProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'accountStellarSubscriptionProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$accountStellarSubscriptionHash(); + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return accountStellarSubscription(ref); + } +} + String _$accountStellarSubscriptionHash() => r'7cdfc7ca29aac240fc8704f4493498d87f307400'; -/// See also [accountStellarSubscription]. -@ProviderFor(accountStellarSubscription) -final accountStellarSubscriptionProvider = - AutoDisposeFutureProvider.internal( - accountStellarSubscription, - name: r'accountStellarSubscriptionProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountStellarSubscriptionHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef AccountStellarSubscriptionRef = - AutoDisposeFutureProviderRef; -String _$accountSentGiftsHash() => r'460af8d22e16dc402848cb94e9b8a8a26d023c41'; - -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [accountSentGifts]. @ProviderFor(accountSentGifts) -const accountSentGiftsProvider = AccountSentGiftsFamily(); +const accountSentGiftsProvider = AccountSentGiftsFamily._(); -/// See also [accountSentGifts]. -class AccountSentGiftsFamily extends Family>> { - /// See also [accountSentGifts]. - const AccountSentGiftsFamily(); +final class AccountSentGiftsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const AccountSentGiftsProvider._({ + required AccountSentGiftsFamily super.from, + required ({int offset, int take}) super.argument, + }) : super( + retry: null, + name: r'accountSentGiftsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [accountSentGifts]. - AccountSentGiftsProvider call({int offset = 0, int take = 20}) { - return AccountSentGiftsProvider(offset: offset, take: take); + @override + String debugGetCreateSourceHash() => _$accountSentGiftsHash(); + + @override + String toString() { + return r'accountSentGiftsProvider' + '' + '$argument'; } + @$internal @override - AccountSentGiftsProvider getProviderOverride( - covariant AccountSentGiftsProvider provider, - ) { - return call(offset: provider.offset, take: provider.take); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountSentGiftsProvider'; -} - -/// See also [accountSentGifts]. -class AccountSentGiftsProvider - extends AutoDisposeFutureProvider> { - /// See also [accountSentGifts]. - AccountSentGiftsProvider({int offset = 0, int take = 20}) - : this._internal( - (ref) => accountSentGifts( - ref as AccountSentGiftsRef, - offset: offset, - take: take, - ), - from: accountSentGiftsProvider, - name: r'accountSentGiftsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountSentGiftsHash, - dependencies: AccountSentGiftsFamily._dependencies, - allTransitiveDependencies: - AccountSentGiftsFamily._allTransitiveDependencies, - offset: offset, - take: take, - ); - - AccountSentGiftsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.offset, - required this.take, - }) : super.internal(); - - final int offset; - final int take; - - @override - Override overrideWith( - FutureOr> Function(AccountSentGiftsRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountSentGiftsProvider._internal( - (ref) => create(ref as AccountSentGiftsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - offset: offset, - take: take, - ), - ); - } - - @override - AutoDisposeFutureProviderElement> createElement() { - return _AccountSentGiftsProviderElement(this); + FutureOr> create(Ref ref) { + final argument = this.argument as ({int offset, int take}); + return accountSentGifts(ref, offset: argument.offset, take: argument.take); } @override bool operator ==(Object other) { - return other is AccountSentGiftsProvider && - other.offset == offset && - other.take == take; + return other is AccountSentGiftsProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, offset.hashCode); - hash = _SystemHash.combine(hash, take.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountSentGiftsRef on AutoDisposeFutureProviderRef> { - /// The parameter `offset` of this provider. - int get offset; +String _$accountSentGiftsHash() => r'460af8d22e16dc402848cb94e9b8a8a26d023c41'; - /// The parameter `take` of this provider. - int get take; +final class AccountSentGiftsFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + ({int offset, int take}) + > { + const AccountSentGiftsFamily._() + : super( + retry: null, + name: r'accountSentGiftsProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + AccountSentGiftsProvider call({int offset = 0, int take = 20}) => + AccountSentGiftsProvider._( + argument: (offset: offset, take: take), + from: this, + ); + + @override + String toString() => r'accountSentGiftsProvider'; } -class _AccountSentGiftsProviderElement - extends AutoDisposeFutureProviderElement> - with AccountSentGiftsRef { - _AccountSentGiftsProviderElement(super.provider); +@ProviderFor(accountReceivedGifts) +const accountReceivedGiftsProvider = AccountReceivedGiftsFamily._(); + +final class AccountReceivedGiftsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const AccountReceivedGiftsProvider._({ + required AccountReceivedGiftsFamily super.from, + required ({int offset, int take}) super.argument, + }) : super( + retry: null, + name: r'accountReceivedGiftsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); @override - int get offset => (origin as AccountSentGiftsProvider).offset; + String debugGetCreateSourceHash() => _$accountReceivedGiftsHash(); + @override - int get take => (origin as AccountSentGiftsProvider).take; + String toString() { + return r'accountReceivedGiftsProvider' + '' + '$argument'; + } + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + final argument = this.argument as ({int offset, int take}); + return accountReceivedGifts( + ref, + offset: argument.offset, + take: argument.take, + ); + } + + @override + bool operator ==(Object other) { + return other is AccountReceivedGiftsProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } } String _$accountReceivedGiftsHash() => r'1208c27cca49e154af073071a197b37a2703f56d'; -/// See also [accountReceivedGifts]. -@ProviderFor(accountReceivedGifts) -const accountReceivedGiftsProvider = AccountReceivedGiftsFamily(); - -/// See also [accountReceivedGifts]. -class AccountReceivedGiftsFamily - extends Family>> { - /// See also [accountReceivedGifts]. - const AccountReceivedGiftsFamily(); - - /// See also [accountReceivedGifts]. - AccountReceivedGiftsProvider call({int offset = 0, int take = 20}) { - return AccountReceivedGiftsProvider(offset: offset, take: take); - } - - @override - AccountReceivedGiftsProvider getProviderOverride( - covariant AccountReceivedGiftsProvider provider, - ) { - return call(offset: provider.offset, take: provider.take); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountReceivedGiftsProvider'; -} - -/// See also [accountReceivedGifts]. -class AccountReceivedGiftsProvider - extends AutoDisposeFutureProvider> { - /// See also [accountReceivedGifts]. - AccountReceivedGiftsProvider({int offset = 0, int take = 20}) - : this._internal( - (ref) => accountReceivedGifts( - ref as AccountReceivedGiftsRef, - offset: offset, - take: take, - ), - from: accountReceivedGiftsProvider, +final class AccountReceivedGiftsFamily extends $Family + with + $FunctionalFamilyOverride< + FutureOr>, + ({int offset, int take}) + > { + const AccountReceivedGiftsFamily._() + : super( + retry: null, name: r'accountReceivedGiftsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountReceivedGiftsHash, - dependencies: AccountReceivedGiftsFamily._dependencies, - allTransitiveDependencies: - AccountReceivedGiftsFamily._allTransitiveDependencies, - offset: offset, - take: take, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - AccountReceivedGiftsProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.offset, - required this.take, - }) : super.internal(); - - final int offset; - final int take; + AccountReceivedGiftsProvider call({int offset = 0, int take = 20}) => + AccountReceivedGiftsProvider._( + argument: (offset: offset, take: take), + from: this, + ); @override - Override overrideWith( - FutureOr> Function(AccountReceivedGiftsRef provider) - create, - ) { - return ProviderOverride( - origin: this, - override: AccountReceivedGiftsProvider._internal( - (ref) => create(ref as AccountReceivedGiftsRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - offset: offset, - take: take, - ), - ); + String toString() => r'accountReceivedGiftsProvider'; +} + +@ProviderFor(accountGift) +const accountGiftProvider = AccountGiftFamily._(); + +final class AccountGiftProvider + extends + $FunctionalProvider< + AsyncValue, + SnWalletGift, + FutureOr + > + with $FutureModifier, $FutureProvider { + const AccountGiftProvider._({ + required AccountGiftFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'accountGiftProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$accountGiftHash(); + + @override + String toString() { + return r'accountGiftProvider' + '' + '($argument)'; } + @$internal @override - AutoDisposeFutureProviderElement> createElement() { - return _AccountReceivedGiftsProviderElement(this); + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + final argument = this.argument as String; + return accountGift(ref, argument); } @override bool operator ==(Object other) { - return other is AccountReceivedGiftsProvider && - other.offset == offset && - other.take == take; + return other is AccountGiftProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, offset.hashCode); - hash = _SystemHash.combine(hash, take.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountReceivedGiftsRef - on AutoDisposeFutureProviderRef> { - /// The parameter `offset` of this provider. - int get offset; - - /// The parameter `take` of this provider. - int get take; -} - -class _AccountReceivedGiftsProviderElement - extends AutoDisposeFutureProviderElement> - with AccountReceivedGiftsRef { - _AccountReceivedGiftsProviderElement(super.provider); - - @override - int get offset => (origin as AccountReceivedGiftsProvider).offset; - @override - int get take => (origin as AccountReceivedGiftsProvider).take; -} - String _$accountGiftHash() => r'70ca553e0b84cba9dfbee428f9bf44207138713a'; -/// See also [accountGift]. -@ProviderFor(accountGift) -const accountGiftProvider = AccountGiftFamily(); - -/// See also [accountGift]. -class AccountGiftFamily extends Family> { - /// See also [accountGift]. - const AccountGiftFamily(); - - /// See also [accountGift]. - AccountGiftProvider call(String giftId) { - return AccountGiftProvider(giftId); - } - - @override - AccountGiftProvider getProviderOverride( - covariant AccountGiftProvider provider, - ) { - return call(provider.giftId); - } - - static const Iterable? _dependencies = null; - - @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'accountGiftProvider'; -} - -/// See also [accountGift]. -class AccountGiftProvider extends AutoDisposeFutureProvider { - /// See also [accountGift]. - AccountGiftProvider(String giftId) - : this._internal( - (ref) => accountGift(ref as AccountGiftRef, giftId), - from: accountGiftProvider, +final class AccountGiftFamily extends $Family + with $FunctionalFamilyOverride, String> { + const AccountGiftFamily._() + : super( + retry: null, name: r'accountGiftProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$accountGiftHash, - dependencies: AccountGiftFamily._dependencies, - allTransitiveDependencies: AccountGiftFamily._allTransitiveDependencies, - giftId: giftId, + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, ); - AccountGiftProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.giftId, - }) : super.internal(); - - final String giftId; + AccountGiftProvider call(String giftId) => + AccountGiftProvider._(argument: giftId, from: this); @override - Override overrideWith( - FutureOr Function(AccountGiftRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: AccountGiftProvider._internal( - (ref) => create(ref as AccountGiftRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - giftId: giftId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _AccountGiftProviderElement(this); - } - - @override - bool operator ==(Object other) { - return other is AccountGiftProvider && other.giftId == giftId; - } - - @override - int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, giftId.hashCode); - - return _SystemHash.finish(hash); - } + String toString() => r'accountGiftProvider'; } - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin AccountGiftRef on AutoDisposeFutureProviderRef { - /// The parameter `giftId` of this provider. - String get giftId; -} - -class _AccountGiftProviderElement - extends AutoDisposeFutureProviderElement - with AccountGiftRef { - _AccountGiftProviderElement(super.provider); - - @override - String get giftId => (origin as AccountGiftProvider).giftId; -} - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/widgets/app_scaffold.dart b/lib/widgets/app_scaffold.dart index 8ae17d0e..9edc8572 100644 --- a/lib/widgets/app_scaffold.dart +++ b/lib/widgets/app_scaffold.dart @@ -43,9 +43,7 @@ class WindowScaffold extends HookConsumerWidget { (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { void saveWindowSize() { windowManager.getBounds().then((bounds) { - final settingsNotifier = ref.read( - appSettingsNotifierProvider.notifier, - ); + final settingsNotifier = ref.read(appSettingsProvider.notifier); settingsNotifier.setWindowSize(bounds.size); }); } @@ -437,7 +435,7 @@ class AppBackground extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final imageFileAsync = ref.watch(backgroundImageFileProvider); - final settings = ref.watch(appSettingsNotifierProvider); + final settings = ref.watch(appSettingsProvider); if (isRoot || !isWideScreen(context)) { return imageFileAsync.when( @@ -482,8 +480,7 @@ class EmptyPageHolder extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final hasBackground = - ref.watch(backgroundImageFileProvider).valueOrNull != null; + final hasBackground = ref.watch(backgroundImageFileProvider).value != null; if (hasBackground) { return const SizedBox.shrink(); } diff --git a/lib/widgets/chat/call_button.dart b/lib/widgets/chat/call_button.dart index ca13a1c7..5701047b 100644 --- a/lib/widgets/chat/call_button.dart +++ b/lib/widgets/chat/call_button.dart @@ -34,8 +34,8 @@ class AudioCallButton extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final ongoingCall = ref.watch(ongoingCallProvider(room.id)); - final callState = ref.watch(callNotifierProvider); - final callNotifier = ref.read(callNotifierProvider.notifier); + final callState = ref.watch(callProvider); + final callNotifier = ref.read(callProvider.notifier); final isLoading = useState(false); final apiClient = ref.watch(apiClientProvider); diff --git a/lib/widgets/chat/call_button.g.dart b/lib/widgets/chat/call_button.g.dart index d2d28f7e..1224008f 100644 --- a/lib/widgets/chat/call_button.g.dart +++ b/lib/widgets/chat/call_button.g.dart @@ -6,146 +6,80 @@ part of 'call_button.dart'; // RiverpodGenerator // ************************************************************************** -String _$ongoingCallHash() => r'48031badb79efa07aefb3a4fc51635be457bd3f9'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [ongoingCall]. @ProviderFor(ongoingCall) -const ongoingCallProvider = OngoingCallFamily(); +const ongoingCallProvider = OngoingCallFamily._(); -/// See also [ongoingCall]. -class OngoingCallFamily extends Family> { - /// See also [ongoingCall]. - const OngoingCallFamily(); +final class OngoingCallProvider + extends + $FunctionalProvider< + AsyncValue, + SnRealtimeCall?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const OngoingCallProvider._({ + required OngoingCallFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'ongoingCallProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [ongoingCall]. - OngoingCallProvider call(String roomId) { - return OngoingCallProvider(roomId); + @override + String debugGetCreateSourceHash() => _$ongoingCallHash(); + + @override + String toString() { + return r'ongoingCallProvider' + '' + '($argument)'; } + @$internal @override - OngoingCallProvider getProviderOverride( - covariant OngoingCallProvider provider, - ) { - return call(provider.roomId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'ongoingCallProvider'; -} - -/// See also [ongoingCall]. -class OngoingCallProvider extends AutoDisposeFutureProvider { - /// See also [ongoingCall]. - OngoingCallProvider(String roomId) - : this._internal( - (ref) => ongoingCall(ref as OngoingCallRef, roomId), - from: ongoingCallProvider, - name: r'ongoingCallProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$ongoingCallHash, - dependencies: OngoingCallFamily._dependencies, - allTransitiveDependencies: OngoingCallFamily._allTransitiveDependencies, - roomId: roomId, - ); - - OngoingCallProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.roomId, - }) : super.internal(); - - final String roomId; - - @override - Override overrideWith( - FutureOr Function(OngoingCallRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: OngoingCallProvider._internal( - (ref) => create(ref as OngoingCallRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - roomId: roomId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _OngoingCallProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return ongoingCall(ref, argument); } @override bool operator ==(Object other) { - return other is OngoingCallProvider && other.roomId == roomId; + return other is OngoingCallProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, roomId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin OngoingCallRef on AutoDisposeFutureProviderRef { - /// The parameter `roomId` of this provider. - String get roomId; -} +String _$ongoingCallHash() => r'48031badb79efa07aefb3a4fc51635be457bd3f9'; -class _OngoingCallProviderElement - extends AutoDisposeFutureProviderElement - with OngoingCallRef { - _OngoingCallProviderElement(super.provider); +final class OngoingCallFamily extends $Family + with $FunctionalFamilyOverride, String> { + const OngoingCallFamily._() + : super( + retry: null, + name: r'ongoingCallProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + OngoingCallProvider call(String roomId) => + OngoingCallProvider._(argument: roomId, from: this); @override - String get roomId => (origin as OngoingCallProvider).roomId; + String toString() => r'ongoingCallProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/widgets/chat/call_content.dart b/lib/widgets/chat/call_content.dart index 9bada1f0..be02db69 100644 --- a/lib/widgets/chat/call_content.dart +++ b/lib/widgets/chat/call_content.dart @@ -10,8 +10,8 @@ class CallContent extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final callState = ref.watch(callNotifierProvider); - final callNotifier = ref.watch(callNotifierProvider.notifier); + final callState = ref.watch(callProvider); + final callNotifier = ref.watch(callProvider.notifier); if (!callState.isConnected) { return const Center(child: CircularProgressIndicator()); diff --git a/lib/widgets/chat/call_overlay.dart b/lib/widgets/chat/call_overlay.dart index ab1fe0d7..ab0a3770 100644 --- a/lib/widgets/chat/call_overlay.dart +++ b/lib/widgets/chat/call_overlay.dart @@ -25,8 +25,8 @@ class CallControlsBar extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final callState = ref.watch(callNotifierProvider); - final callNotifier = ref.read(callNotifierProvider.notifier); + final callState = ref.watch(callProvider); + final callNotifier = ref.read(callProvider.notifier); return Container( padding: EdgeInsets.symmetric( @@ -268,7 +268,7 @@ class CallControlsBar extends HookConsumerWidget { String deviceType, ) async { try { - final callNotifier = ref.read(callNotifierProvider.notifier); + final callNotifier = ref.read(callProvider.notifier); if (deviceType == 'videoinput') { // Switch camera device @@ -312,8 +312,8 @@ class CallOverlayBar extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final callState = ref.watch(callNotifierProvider); - final callNotifier = ref.read(callNotifierProvider.notifier); + final callState = ref.watch(callProvider); + final callNotifier = ref.read(callProvider.notifier); final ongoingCall = ref.watch(ongoingCallProvider(room.id)); // State for overlay mode: compact or preview @@ -398,7 +398,7 @@ class CallOverlayBar extends HookConsumerWidget { isLoading.value = true; try { // Just join the room, don't navigate - await ref.read(callNotifierProvider.notifier).joinRoom(room); + await ref.read(callProvider.notifier).joinRoom(room); } catch (e) { showErrorAlert(e); } finally { diff --git a/lib/widgets/chat/call_participant_card.dart b/lib/widgets/chat/call_participant_card.dart index 6f9f278d..56d19997 100644 --- a/lib/widgets/chat/call_participant_card.dart +++ b/lib/widgets/chat/call_participant_card.dart @@ -19,7 +19,7 @@ class CallParticipantCard extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final width = math.min(MediaQuery.of(context).size.width - 80, 360).toDouble(); - final callNotifier = ref.watch(callNotifierProvider.notifier); + final callNotifier = ref.watch(callProvider.notifier); final volumeSliderValue = useState(callNotifier.getParticipantVolume(live)); diff --git a/lib/widgets/chat/chat_input.dart b/lib/widgets/chat/chat_input.dart index 0267cba2..bb75a8f8 100644 --- a/lib/widgets/chat/chat_input.dart +++ b/lib/widgets/chat/chat_input.dart @@ -260,7 +260,7 @@ class ChatInput extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final inputFocusNode = useFocusNode(); - final chatSubscribe = ref.watch(chatSubscribeNotifierProvider(chatRoom.id)); + final chatSubscribe = ref.watch(chatSubscribeProvider(chatRoom.id)); final isExpanded = useState(false); void send() { @@ -310,7 +310,7 @@ class ChatInput extends HookConsumerWidget { } } - final settings = ref.watch(appSettingsNotifierProvider); + final settings = ref.watch(appSettingsProvider); inputFocusNode.onKeyEvent = (node, event) { if (event is! KeyDownEvent) return KeyEventResult.ignored; diff --git a/lib/widgets/chat/chat_link_attachments.dart b/lib/widgets/chat/chat_link_attachments.dart index 74780966..89c83303 100644 --- a/lib/widgets/chat/chat_link_attachments.dart +++ b/lib/widgets/chat/chat_link_attachments.dart @@ -13,14 +13,12 @@ import 'package:material_symbols_icons/symbols.dart'; import 'package:styled_widget/styled_widget.dart'; import 'package:url_launcher/url_launcher_string.dart'; -final chatCloudFileListNotifierProvider = AsyncNotifierProvider.autoDispose< - ChatCloudFileListNotifier, - List ->(ChatCloudFileListNotifier.new); +final chatCloudFileListNotifierProvider = AsyncNotifierProvider.autoDispose( + ChatCloudFileListNotifier.new, +); -class ChatCloudFileListNotifier - extends AutoDisposeAsyncNotifier> - with AutoDisposeAsyncPaginationController { +class ChatCloudFileListNotifier extends AsyncNotifier> + with AsyncPaginationController { @override Future> fetch() async { final client = ref.read(apiClientProvider); diff --git a/lib/widgets/chat/message_item.dart b/lib/widgets/chat/message_item.dart index c0f6f1db..7cd0ce77 100644 --- a/lib/widgets/chat/message_item.dart +++ b/lib/widgets/chat/message_item.dart @@ -67,7 +67,7 @@ class MessageItem extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final remoteMessage = message.toRemoteMessage(); - final settings = ref.watch(appSettingsNotifierProvider); + final settings = ref.watch(appSettingsProvider); final isMobile = !kIsWeb && (Platform.isAndroid || Platform.isIOS); @@ -1150,7 +1150,7 @@ class MessageQuoteWidget extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final messagesNotifier = ref.watch( - messagesNotifierProvider(message.roomId).notifier, + messagesProvider(message.roomId).notifier, ); return FutureBuilder( diff --git a/lib/widgets/chat/public_room_preview.dart b/lib/widgets/chat/public_room_preview.dart index 1c2e7f7e..39ab7686 100644 --- a/lib/widgets/chat/public_room_preview.dart +++ b/lib/widgets/chat/public_room_preview.dart @@ -28,8 +28,8 @@ class PublicRoomPreview extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final messages = ref.watch(messagesNotifierProvider(id)); - final messagesNotifier = ref.read(messagesNotifierProvider(id).notifier); + final messages = ref.watch(messagesProvider(id)); + final messagesNotifier = ref.read(messagesProvider(id).notifier); final scrollController = useScrollController(); final listController = useMemoized(() => ListController(), []); @@ -204,7 +204,7 @@ class PublicRoomPreview extends HookConsumerWidget { showLoadingModal(context); final apiClient = ref.read(apiClientProvider); await apiClient.post('/sphere/chat/${room.id}/members/me'); - ref.invalidate(ChatRoomIdentityNotifierProvider(id)); + ref.invalidate(chatRoomIdentityProvider(id)); } catch (err) { showErrorAlert(err); } finally { diff --git a/lib/widgets/check_in.dart b/lib/widgets/check_in.dart index 95d7a0f2..de0e591b 100644 --- a/lib/widgets/check_in.dart +++ b/lib/widgets/check_in.dart @@ -253,7 +253,7 @@ class CheckInWidget extends HookConsumerWidget { vertical: -2, ), onPressed: () { - if (todayResult.valueOrNull == null) { + if (todayResult.value == null) { checkIn(); } else { showModalBottomSheet( diff --git a/lib/widgets/check_in.g.dart b/lib/widgets/check_in.g.dart index 529f293b..154cb88a 100644 --- a/lib/widgets/check_in.g.dart +++ b/lib/widgets/check_in.g.dart @@ -6,44 +6,84 @@ part of 'check_in.dart'; // RiverpodGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(checkInResultToday) +const checkInResultTodayProvider = CheckInResultTodayProvider._(); + +final class CheckInResultTodayProvider + extends + $FunctionalProvider< + AsyncValue, + SnCheckInResult?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const CheckInResultTodayProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'checkInResultTodayProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$checkInResultTodayHash(); + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return checkInResultToday(ref); + } +} + String _$checkInResultTodayHash() => r'b4dc97b2243f542b36c295dc5cce3fe6097cb308'; -/// See also [checkInResultToday]. -@ProviderFor(checkInResultToday) -final checkInResultTodayProvider = - AutoDisposeFutureProvider.internal( - checkInResultToday, - name: r'checkInResultTodayProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$checkInResultTodayHash, - dependencies: null, - allTransitiveDependencies: null, - ); - -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef CheckInResultTodayRef = AutoDisposeFutureProviderRef; -String _$nextNotableDayHash() => r'c8404308f6b0f581cc7df251bce8f3c5ac130245'; - -/// See also [nextNotableDay]. @ProviderFor(nextNotableDay) -final nextNotableDayProvider = - AutoDisposeFutureProvider.internal( - nextNotableDay, - name: r'nextNotableDayProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$nextNotableDayHash, - dependencies: null, - allTransitiveDependencies: null, - ); +const nextNotableDayProvider = NextNotableDayProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef NextNotableDayRef = AutoDisposeFutureProviderRef; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class NextNotableDayProvider + extends + $FunctionalProvider< + AsyncValue, + SnNotableDay?, + FutureOr + > + with $FutureModifier, $FutureProvider { + const NextNotableDayProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'nextNotableDayProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$nextNotableDayHash(); + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return nextNotableDay(ref); + } +} + +String _$nextNotableDayHash() => r'c8404308f6b0f581cc7df251bce8f3c5ac130245'; diff --git a/lib/widgets/content/cloud_file_collection.dart b/lib/widgets/content/cloud_file_collection.dart index 7ef4b215..8396d784 100644 --- a/lib/widgets/content/cloud_file_collection.dart +++ b/lib/widgets/content/cloud_file_collection.dart @@ -410,7 +410,7 @@ class _CloudFileListEntry extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final dataSaving = ref.watch( - appSettingsNotifierProvider.select((s) => s.dataSavingMode), + appSettingsProvider.select((s) => s.dataSavingMode), ); final showMature = useState(false); final showDataSaving = useState(!dataSaving); diff --git a/lib/widgets/content/cloud_files.dart b/lib/widgets/content/cloud_files.dart index cefb9ab7..bd9c2d0e 100644 --- a/lib/widgets/content/cloud_files.dart +++ b/lib/widgets/content/cloud_files.dart @@ -35,7 +35,7 @@ class CloudFileWidget extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final dataSaving = ref.watch( - appSettingsNotifierProvider.select((s) => s.dataSavingMode), + appSettingsProvider.select((s) => s.dataSavingMode), ); final serverUrl = ref.watch(serverUrlProvider); final uri = '$serverUrl/drive/files/${item.id}'; diff --git a/lib/widgets/data_saving_gate.dart b/lib/widgets/data_saving_gate.dart index dc4c23b3..9ef38e28 100644 --- a/lib/widgets/data_saving_gate.dart +++ b/lib/widgets/data_saving_gate.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:island/pods/config.dart'; - typedef WidgetBuilder0 = Widget Function(); class DataSavingGate extends ConsumerWidget { @@ -19,8 +18,9 @@ class DataSavingGate extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final dataSaving = - ref.watch(appSettingsNotifierProvider.select((s) => s.dataSavingMode)); + final dataSaving = ref.watch( + appSettingsProvider.select((s) => s.dataSavingMode), + ); if (bypass || !dataSaving) return content(); return placeholder; } diff --git a/lib/widgets/file_list_view.dart b/lib/widgets/file_list_view.dart index e7983a30..b1d6a824 100644 --- a/lib/widgets/file_list_view.dart +++ b/lib/widgets/file_list_view.dart @@ -59,9 +59,7 @@ class FileListView extends HookConsumerWidget { useEffect(() { if (mode.value == FileListMode.normal) { - final notifier = ref.read( - indexedCloudFileListNotifierProvider.notifier, - ); + final notifier = ref.read(indexedCloudFileListProvider.notifier); notifier.setPath(currentPath.value); } return null; @@ -69,12 +67,8 @@ class FileListView extends HookConsumerWidget { if (usage == null) return const SizedBox.shrink(); - final unindexedNotifier = ref.read( - unindexedFileListNotifierProvider.notifier, - ); - final cloudNotifier = ref.read( - indexedCloudFileListNotifierProvider.notifier, - ); + final unindexedNotifier = ref.read(unindexedFileListProvider.notifier); + final cloudNotifier = ref.read(indexedCloudFileListProvider.notifier); final recycled = useState(false); final poolsAsync = ref.watch(poolsProvider); final isSelectionMode = useState(false); @@ -119,18 +113,14 @@ class FileListView extends HookConsumerWidget { final isRefreshing = ref.watch( mode.value == FileListMode.normal - ? indexedCloudFileListNotifierProvider.select( - (value) => value.isLoading, - ) - : unindexedFileListNotifierProvider.select( - (value) => value.isLoading, - ), + ? indexedCloudFileListProvider.select((value) => value.isLoading) + : unindexedFileListProvider.select((value) => value.isLoading), ); final bodyWidget = switch (mode.value) { FileListMode.unindexed => PaginationWidget( - provider: unindexedFileListNotifierProvider, - notifier: unindexedFileListNotifierProvider.notifier, + provider: unindexedFileListProvider, + notifier: unindexedFileListProvider.notifier, isRefreshable: false, isSliver: true, contentBuilder: @@ -151,8 +141,8 @@ class FileListView extends HookConsumerWidget { ), ), _ => PaginationWidget( - provider: indexedCloudFileListNotifierProvider, - notifier: indexedCloudFileListNotifierProvider.notifier, + provider: indexedCloudFileListProvider, + notifier: indexedCloudFileListProvider.notifier, isRefreshable: false, isSliver: true, contentBuilder: @@ -261,7 +251,7 @@ class FileListView extends HookConsumerWidget { completer.future .then((uploadedFile) { if (uploadedFile != null) { - ref.invalidate(indexedCloudFileListNotifierProvider); + ref.invalidate(indexedCloudFileListProvider); } }) .catchError((error) { @@ -538,8 +528,8 @@ class FileListView extends HookConsumerWidget { isSelectionMode.value = false; ref.invalidate( mode.value == FileListMode.normal - ? indexedCloudFileListNotifierProvider - : unindexedFileListNotifierProvider, + ? indexedCloudFileListProvider + : unindexedFileListProvider, ); showSnackBar('Deleted $count files.'); } catch (e) { @@ -804,7 +794,7 @@ class FileListView extends HookConsumerWidget { await client.delete( '/drive/index/remove/${fileItem.fileIndex.id}', ); - ref.invalidate(indexedCloudFileListNotifierProvider); + ref.invalidate(indexedCloudFileListProvider); } catch (e) { showSnackBar('failedToDeleteFile'.tr()); } finally { @@ -1168,7 +1158,7 @@ class FileListView extends HookConsumerWidget { try { final client = ref.read(apiClientProvider); await client.delete('/drive/index/remove/${fileItem.fileIndex.id}'); - ref.invalidate(indexedCloudFileListNotifierProvider); + ref.invalidate(indexedCloudFileListProvider); } catch (e) { showSnackBar('failedToDeleteFile'.tr()); } finally { @@ -1237,7 +1227,7 @@ class FileListView extends HookConsumerWidget { try { final client = ref.read(apiClientProvider); await client.delete('/drive/files/${file.id}'); - ref.invalidate(unindexedFileListNotifierProvider); + ref.invalidate(unindexedFileListProvider); } catch (e) { showSnackBar('failedToDeleteFile'.tr()); } finally { @@ -1280,7 +1270,7 @@ class FileListView extends HookConsumerWidget { try { final client = ref.read(apiClientProvider); await client.delete('/drive/files/${unindexedFileItem.file.id}'); - ref.invalidate(unindexedFileListNotifierProvider); + ref.invalidate(unindexedFileListProvider); } catch (e) { showSnackBar('failedToDeleteFile'.tr()); } finally { @@ -1374,7 +1364,7 @@ class FileListView extends HookConsumerWidget { ); final count = response.data['count'] as int? ?? 0; showSnackBar('Cleared $count recycled files.'); - ref.invalidate(unindexedFileListNotifierProvider); + ref.invalidate(unindexedFileListProvider); } catch (e) { showSnackBar('Failed to clear recycled files.'); } finally { @@ -1566,7 +1556,7 @@ class FileListView extends HookConsumerWidget { icon: const Icon(Symbols.refresh), onPressed: () { if (mode.value == FileListMode.unindexed) { - ref.invalidate(unindexedFileListNotifierProvider); + ref.invalidate(unindexedFileListProvider); } else { cloudNotifier.setPath(currentPath.value); } diff --git a/lib/widgets/navigation/fab_menu.dart b/lib/widgets/navigation/fab_menu.dart index 2319438a..fd46dee1 100644 --- a/lib/widgets/navigation/fab_menu.dart +++ b/lib/widgets/navigation/fab_menu.dart @@ -1,8 +1,8 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:go_router/go_router.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:island/pods/network.dart'; import 'package:island/pods/userinfo.dart'; import 'package:island/screens/auth/create_account_modal.dart'; @@ -19,10 +19,21 @@ import 'package:material_symbols_icons/symbols.dart'; enum FabMenuType { main, compose, chat, realm } /// Global state provider for FAB menu type -final fabMenuTypeProvider = StateProvider( - (ref) => FabMenuType.main, +final fabMenuTypeProvider = NotifierProvider( + FabMenuTypeNotifier.new, ); +class FabMenuTypeNotifier extends Notifier { + @override + FabMenuType build() { + return FabMenuType.main; + } + + void setMenuType(FabMenuType menuType) { + state = menuType; + } +} + class FabMenu extends HookConsumerWidget { final double? elevation; const FabMenu({super.key, this.elevation}); @@ -97,9 +108,7 @@ class FabMenu extends HookConsumerWidget { ), Consumer( builder: (context, ref, _) { - final notificationCount = ref.watch( - notificationUnreadCountNotifierProvider, - ); + final notificationCount = ref.watch(notificationUnreadCountProvider); return ListTile( contentPadding: const EdgeInsets.symmetric(horizontal: 24), leading: const Icon(Symbols.notifications), diff --git a/lib/widgets/paging/pagination_list.dart b/lib/widgets/paging/pagination_list.dart index a055ab73..12f8bcb5 100644 --- a/lib/widgets/paging/pagination_list.dart +++ b/lib/widgets/paging/pagination_list.dart @@ -1,11 +1,12 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/misc.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:island/pods/paging.dart'; - import 'package:island/widgets/extended_refresh_indicator.dart'; import 'package:island/widgets/response.dart'; import 'package:material_symbols_icons/material_symbols_icons.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:styled_widget/styled_widget.dart'; import 'package:super_sliver_list/super_sliver_list.dart'; import 'package:visibility_detector/visibility_detector.dart'; @@ -34,7 +35,7 @@ class PaginationList extends HookConsumerWidget { final data = ref.watch(provider); final noti = ref.watch(notifier); - if (data.isLoading && data.valueOrNull?.isEmpty == true) { + if (data.isLoading && data.value?.isEmpty == true) { final content = ResponseLoadingWidget(); return isSliver ? SliverFillRemaining(child: content) : content; } @@ -50,24 +51,24 @@ class PaginationList extends HookConsumerWidget { final listView = isSliver ? SuperSliverList.builder( - itemCount: (data.valueOrNull?.length ?? 0) + 1, + itemCount: (data.value?.length ?? 0) + 1, itemBuilder: (context, idx) { - if (idx == data.valueOrNull?.length) { + if (idx == data.value?.length) { return PaginationListFooter(noti: noti, data: data); } - final entry = data.valueOrNull?[idx]; + final entry = data.value?[idx]; if (entry != null) return itemBuilder(context, idx, entry); return null; }, ) : SuperListView.builder( padding: padding, - itemCount: (data.valueOrNull?.length ?? 0) + 1, + itemCount: (data.value?.length ?? 0) + 1, itemBuilder: (context, idx) { - if (idx == data.valueOrNull?.length) { + if (idx == data.value?.length) { return PaginationListFooter(noti: noti, data: data); } - final entry = data.valueOrNull?[idx]; + final entry = data.value?[idx]; if (entry != null) return itemBuilder(context, idx, entry); return null; }, @@ -101,7 +102,7 @@ class PaginationWidget extends HookConsumerWidget { final data = ref.watch(provider); final noti = ref.watch(notifier); - if (data.isLoading && data.valueOrNull?.isEmpty == true) { + if (data.isLoading && data.value?.isEmpty == true) { final content = ResponseLoadingWidget(); return isSliver ? SliverFillRemaining(child: content) : content; } @@ -115,7 +116,7 @@ class PaginationWidget extends HookConsumerWidget { } final footer = PaginationListFooter(noti: noti, data: data); - final content = contentBuilder(data.valueOrNull ?? [], footer); + final content = contentBuilder(data.value ?? [], footer); return isRefreshable ? ExtendedRefreshIndicator(onRefresh: noti.refresh, child: content) diff --git a/lib/widgets/poll/poll_feedback.dart b/lib/widgets/poll/poll_feedback.dart index d2945d1c..26440168 100644 --- a/lib/widgets/poll/poll_feedback.dart +++ b/lib/widgets/poll/poll_feedback.dart @@ -20,16 +20,18 @@ final pollFeedbackNotifierProvider = AsyncNotifierProvider.autoDispose PollFeedbackNotifier.new, ); -class PollFeedbackNotifier - extends AutoDisposeFamilyAsyncNotifier, String> - with FamilyAsyncPaginationController { - static const int _pageSize = 20; +class PollFeedbackNotifier extends AsyncNotifier> + with AsyncPaginationController { + static const int pageSize = 20; + + final String arg; + PollFeedbackNotifier(this.arg); @override Future> fetch() async { final client = ref.read(apiClientProvider); - final queryParams = {'offset': fetchedCount, 'take': _pageSize}; + final queryParams = {'offset': fetchedCount, 'take': pageSize}; final response = await client.get( '/sphere/polls/$arg/feedback', @@ -68,8 +70,7 @@ class PollFeedbackSheet extends HookConsumerWidget { return Column( children: [ _PollAnswerTile(answer: answer, poll: data), - if (index < - (ref.read(provider).valueOrNull?.length ?? 0) - 1) + if (index < (ref.read(provider).value?.length ?? 0) - 1) const Divider(height: 1).padding(vertical: 4), ], ); diff --git a/lib/widgets/post/compose_card.dart b/lib/widgets/post/compose_card.dart index 9562dd1e..ba169903 100644 --- a/lib/widgets/post/compose_card.dart +++ b/lib/widgets/post/compose_card.dart @@ -60,7 +60,7 @@ class PostComposeCard extends HookConsumerWidget { final theme = Theme.of(context); // Capture the notifier to avoid using ref after dispose - final notifier = ref.read(composeStorageNotifierProvider.notifier); + final notifier = ref.read(composeStorageProvider.notifier); // Create compose state final ComposeState composeState = @@ -158,7 +158,7 @@ class PostComposeCard extends HookConsumerWidget { // Delete draft after successful submission ref - .read(composeStorageNotifierProvider.notifier) + .read(composeStorageProvider.notifier) .deleteDraft(composeState.draftId); // Reset the form for new composition diff --git a/lib/widgets/post/compose_dialog.dart b/lib/widgets/post/compose_dialog.dart index be4c0328..82bf5e19 100644 --- a/lib/widgets/post/compose_dialog.dart +++ b/lib/widgets/post/compose_dialog.dart @@ -47,7 +47,7 @@ class PostComposeDialog extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final drafts = ref.watch(composeStorageNotifierProvider); + final drafts = ref.watch(composeStorageProvider); final restoredInitialState = useState(null); final prompted = useState(false); @@ -166,7 +166,7 @@ class PostComposeDialog extends HookConsumerWidget { WidgetRef ref, ValueNotifier restoredInitialState, ) async { - final drafts = ref.read(composeStorageNotifierProvider); + final drafts = ref.read(composeStorageProvider); if (drafts.isNotEmpty) { final latestDraft = drafts.values.last; @@ -200,7 +200,7 @@ class PostComposeDialog extends HookConsumerWidget { if (restore == true) { // Delete the old draft await ref - .read(composeStorageNotifierProvider.notifier) + .read(composeStorageProvider.notifier) .deleteDraft(latestDraft.id); restoredInitialState.value = PostComposeInitialState( title: latestDraft.title, diff --git a/lib/widgets/post/compose_fund.dart b/lib/widgets/post/compose_fund.dart index 06ecc87e..0f50e48d 100644 --- a/lib/widgets/post/compose_fund.dart +++ b/lib/widgets/post/compose_fund.dart @@ -22,7 +22,7 @@ class ComposeFundSheet extends HookConsumerWidget { final isPushing = useState(false); final errorText = useState(null); - final fundsData = ref.watch(walletFundsNotifierProvider); + final fundsData = ref.watch(walletFundsProvider); return SheetScaffold( heightFactor: 0.6, @@ -301,9 +301,7 @@ class ComposeFundSheet extends HookConsumerWidget { await Future.delayed( const Duration(seconds: 1), ); - ref.invalidate( - walletFundsNotifierProvider, - ); + ref.invalidate(walletFundsProvider); // Return the created fund final updatedResp = await client.get( diff --git a/lib/widgets/post/compose_link_attachments.dart b/lib/widgets/post/compose_link_attachments.dart index 4f60ca30..14fbf56b 100644 --- a/lib/widgets/post/compose_link_attachments.dart +++ b/lib/widgets/post/compose_link_attachments.dart @@ -18,8 +18,8 @@ final cloudFileListNotifierProvider = CloudFileListNotifier.new, ); -class CloudFileListNotifier extends AutoDisposeAsyncNotifier> - with AutoDisposeAsyncPaginationController { +class CloudFileListNotifier extends AsyncNotifier> + with AsyncPaginationController { @override Future> fetch() async { final client = ref.read(apiClientProvider); diff --git a/lib/widgets/post/compose_settings_sheet.g.dart b/lib/widgets/post/compose_settings_sheet.g.dart index d3455de9..7b57a3ef 100644 --- a/lib/widgets/post/compose_settings_sheet.g.dart +++ b/lib/widgets/post/compose_settings_sheet.g.dart @@ -6,24 +6,46 @@ part of 'compose_settings_sheet.dart'; // RiverpodGenerator // ************************************************************************** -String _$postCategoriesHash() => r'8799c10eb91cf8c8c7ea72eff3475e1eaa7b9a2b'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [postCategories]. @ProviderFor(postCategories) -final postCategoriesProvider = - AutoDisposeFutureProvider>.internal( - postCategories, - name: r'postCategoriesProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$postCategoriesHash, - dependencies: null, - allTransitiveDependencies: null, - ); +const postCategoriesProvider = PostCategoriesProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef PostCategoriesRef = AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class PostCategoriesProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + const PostCategoriesProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'postCategoriesProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$postCategoriesHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return postCategories(ref); + } +} + +String _$postCategoriesHash() => r'8799c10eb91cf8c8c7ea72eff3475e1eaa7b9a2b'; diff --git a/lib/widgets/post/compose_shared.dart b/lib/widgets/post/compose_shared.dart index 44b51305..569cd08a 100644 --- a/lib/widgets/post/compose_shared.dart +++ b/lib/widgets/post/compose_shared.dart @@ -272,7 +272,7 @@ class ComposeLogic { deletedAt: null, ); - await ref.read(composeStorageNotifierProvider.notifier).saveDraft(draft); + await ref.read(composeStorageProvider.notifier).saveDraft(draft); } catch (e) { talker.error('[ComposeLogic] Failed to save draft, error: $e'); } @@ -345,7 +345,7 @@ class ComposeLogic { deletedAt: null, ); - await ref.read(composeStorageNotifierProvider.notifier).saveDraft(draft); + await ref.read(composeStorageProvider.notifier).saveDraft(draft); } catch (e) { talker.error( '[ComposeLogic] Failed to save draft without upload, error: $e', @@ -374,9 +374,7 @@ class ComposeLogic { static Future deleteDraft(WidgetRef ref, String draftId) async { try { - await ref - .read(composeStorageNotifierProvider.notifier) - .deleteDraft(draftId); + await ref.read(composeStorageProvider.notifier).deleteDraft(draftId); } catch (e) { // Silently fail } @@ -384,9 +382,7 @@ class ComposeLogic { static Future loadDraft(WidgetRef ref, String draftId) async { try { - return ref - .read(composeStorageNotifierProvider.notifier) - .getDraft(draftId); + return ref.read(composeStorageProvider.notifier).getDraft(draftId); } catch (e) { return null; } @@ -778,12 +774,12 @@ class ComposeLogic { if (state.postType == 1) { // Delete article draft await ref - .read(composeStorageNotifierProvider.notifier) + .read(composeStorageProvider.notifier) .deleteDraft(state.draftId); } else { // Delete regular post draft await ref - .read(composeStorageNotifierProvider.notifier) + .read(composeStorageProvider.notifier) .deleteDraft(state.draftId); } diff --git a/lib/widgets/post/compose_sheet.dart b/lib/widgets/post/compose_sheet.dart index 3a7c9607..701edb2a 100644 --- a/lib/widgets/post/compose_sheet.dart +++ b/lib/widgets/post/compose_sheet.dart @@ -47,7 +47,7 @@ class PostComposeSheet extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final drafts = ref.watch(composeStorageNotifierProvider); + final drafts = ref.watch(composeStorageProvider); final restoredInitialState = useState(null); final prompted = useState(false); @@ -185,7 +185,7 @@ class PostComposeSheet extends HookConsumerWidget { WidgetRef ref, ValueNotifier restoredInitialState, ) async { - final drafts = ref.read(composeStorageNotifierProvider); + final drafts = ref.read(composeStorageProvider); if (drafts.isNotEmpty) { final latestDraft = drafts.values.last; @@ -219,7 +219,7 @@ class PostComposeSheet extends HookConsumerWidget { if (restore == true) { // Delete the old draft await ref - .read(composeStorageNotifierProvider.notifier) + .read(composeStorageProvider.notifier) .deleteDraft(latestDraft.id); restoredInitialState.value = PostComposeInitialState( title: latestDraft.title, diff --git a/lib/widgets/post/compose_state_utils.dart b/lib/widgets/post/compose_state_utils.dart index 29466f8e..9211daf6 100644 --- a/lib/widgets/post/compose_state_utils.dart +++ b/lib/widgets/post/compose_state_utils.dart @@ -60,7 +60,7 @@ class ComposeStateUtils { repliedPost == null && initialState == null) { // Try to load the most recent draft - final drafts = ref.read(composeStorageNotifierProvider); + final drafts = ref.read(composeStorageProvider); if (drafts.isNotEmpty) { final mostRecentDraft = drafts.values.reduce( (a, b) => @@ -128,7 +128,7 @@ class ComposeStateUtils { updatedAt: DateTime.now(), ); ref - .read(composeStorageNotifierProvider.notifier) + .read(composeStorageProvider.notifier) .saveDraft(draft) .catchError((e) => debugPrint('Failed to save draft: $e')); } diff --git a/lib/widgets/post/compose_toolbar.dart b/lib/widgets/post/compose_toolbar.dart index af8ba5bf..69c2f0bd 100644 --- a/lib/widgets/post/compose_toolbar.dart +++ b/lib/widgets/post/compose_toolbar.dart @@ -75,7 +75,7 @@ class ComposeToolbar extends HookConsumerWidget { builder: (context) => DraftManagerSheet( onDraftSelected: (draftId) { - final draft = ref.read(composeStorageNotifierProvider)[draftId]; + final draft = ref.read(composeStorageProvider)[draftId]; if (draft != null) { state.titleController.text = draft.title ?? ''; state.descriptionController.text = draft.description ?? ''; diff --git a/lib/widgets/post/draft_manager.dart b/lib/widgets/post/draft_manager.dart index f17b3f50..4f613d59 100644 --- a/lib/widgets/post/draft_manager.dart +++ b/lib/widgets/post/draft_manager.dart @@ -20,7 +20,7 @@ class DraftManagerSheet extends HookConsumerWidget { final searchController = useTextEditingController(); final searchQuery = useState(''); - final drafts = ref.watch(composeStorageNotifierProvider); + final drafts = ref.watch(composeStorageProvider); // Search functionality final filteredDrafts = useMemoized(() { @@ -101,7 +101,7 @@ class DraftManagerSheet extends HookConsumerWidget { }, onDelete: () async { await ref - .read(composeStorageNotifierProvider.notifier) + .read(composeStorageProvider.notifier) .deleteDraft(draft.id); }, ); @@ -127,7 +127,7 @@ class DraftManagerSheet extends HookConsumerWidget { if (confirmed == true) { await ref - .read(composeStorageNotifierProvider.notifier) + .read(composeStorageProvider.notifier) .clearAllDrafts(); } }, diff --git a/lib/widgets/post/post_award_history_sheet.dart b/lib/widgets/post/post_award_history_sheet.dart index f7b0bd26..efcde706 100644 --- a/lib/widgets/post/post_award_history_sheet.dart +++ b/lib/widgets/post/post_award_history_sheet.dart @@ -11,16 +11,18 @@ final postAwardListNotifierProvider = AsyncNotifierProvider.autoDispose PostAwardListNotifier.new, ); -class PostAwardListNotifier - extends AutoDisposeFamilyAsyncNotifier, String> - with FamilyAsyncPaginationController { - static const int _pageSize = 20; +class PostAwardListNotifier extends AsyncNotifier> + with AsyncPaginationController { + static const int pageSize = 20; + + final String arg; + PostAwardListNotifier(this.arg); @override Future> fetch() async { final client = ref.read(apiClientProvider); - final queryParams = {'offset': fetchedCount, 'take': _pageSize}; + final queryParams = {'offset': fetchedCount, 'take': pageSize}; final response = await client.get( '/sphere/posts/$arg/awards', @@ -50,7 +52,7 @@ class PostAwardHistorySheet extends HookConsumerWidget { return Column( children: [ PostAwardItem(award: award), - if (index < (ref.read(provider).valueOrNull?.length ?? 0) - 1) + if (index < (ref.read(provider).value?.length ?? 0) - 1) const Divider(height: 1), ], ); diff --git a/lib/widgets/post/post_featured.g.dart b/lib/widgets/post/post_featured.g.dart index febbdabe..0f48cfd6 100644 --- a/lib/widgets/post/post_featured.g.dart +++ b/lib/widgets/post/post_featured.g.dart @@ -6,23 +6,44 @@ part of 'post_featured.dart'; // RiverpodGenerator // ************************************************************************** -String _$featuredPostsHash() => r'4b7fffb02eac72f5861b02af1b1e5da36b571698'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// See also [featuredPosts]. @ProviderFor(featuredPosts) -final featuredPostsProvider = AutoDisposeFutureProvider>.internal( - featuredPosts, - name: r'featuredPostsProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$featuredPostsHash, - dependencies: null, - allTransitiveDependencies: null, -); +const featuredPostsProvider = FeaturedPostsProvider._(); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef FeaturedPostsRef = AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class FeaturedPostsProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with $FutureModifier>, $FutureProvider> { + const FeaturedPostsProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'featuredPostsProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$featuredPostsHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return featuredPosts(ref); + } +} + +String _$featuredPostsHash() => r'4b7fffb02eac72f5861b02af1b1e5da36b571698'; diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index cf9a1a58..b2848d91 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -99,7 +99,7 @@ class PostActionableItem extends HookConsumerWidget { [user], ); - final config = ref.watch(appSettingsNotifierProvider); + final config = ref.watch(appSettingsProvider); final widgetItem = InkWell( borderRadius: diff --git a/lib/widgets/post/post_list.dart b/lib/widgets/post/post_list.dart index a6080b15..e453a63a 100644 --- a/lib/widgets/post/post_list.dart +++ b/lib/widgets/post/post_list.dart @@ -35,10 +35,12 @@ final postListNotifierProvider = AsyncNotifierProvider.autoDispose PostListNotifier.new, ); -class PostListNotifier - extends AutoDisposeFamilyAsyncNotifier, PostListQuery> - with FamilyAsyncPaginationController { - static const int _pageSize = 20; +class PostListNotifier extends AsyncNotifier> + with AsyncPaginationController { + final PostListQuery arg; + PostListNotifier(this.arg); + + static const int pageSize = 20; @override Future> fetch() async { @@ -46,7 +48,7 @@ class PostListNotifier final queryParams = { 'offset': fetchedCount, - 'take': _pageSize, + 'take': pageSize, 'replies': arg.includeReplies, 'orderDesc': arg.orderDesc, if (arg.shuffle) 'shuffle': arg.shuffle, diff --git a/lib/widgets/post/post_reaction_sheet.dart b/lib/widgets/post/post_reaction_sheet.dart index b0eabebb..37737767 100644 --- a/lib/widgets/post/post_reaction_sheet.dart +++ b/lib/widgets/post/post_reaction_sheet.dart @@ -18,35 +18,29 @@ import 'package:material_symbols_icons/symbols.dart'; import 'package:styled_widget/styled_widget.dart'; import 'package:island/widgets/stickers/sticker_picker.dart'; import 'package:island/pods/config.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; -class ReactionListParams { - final String symbol; - final String postId; +part 'post_reaction_sheet.freezed.dart'; - const ReactionListParams({required this.symbol, required this.postId}); - - @override - bool operator ==(Object other) => - identical(this, other) || - other is ReactionListParams && - runtimeType == other.runtimeType && - symbol == other.symbol && - postId == other.postId; - - @override - int get hashCode => symbol.hashCode ^ postId.hashCode; +@freezed +sealed class ReactionListQuery with _$ReactionListQuery { + const factory ReactionListQuery({ + required String symbol, + required String postId, + }) = _ReactionListQuery; } final reactionListNotifierProvider = AsyncNotifierProvider.autoDispose - .family, ReactionListParams>( + .family, ReactionListQuery>( ReactionListNotifier.new, ); -class ReactionListNotifier - extends - AutoDisposeFamilyAsyncNotifier, ReactionListParams> - with FamilyAsyncPaginationController { - static const int _pageSize = 20; +class ReactionListNotifier extends AsyncNotifier> + with AsyncPaginationController { + static const int pageSize = 20; + + final ReactionListQuery arg; + ReactionListNotifier(this.arg); @override Future> fetch() async { @@ -57,7 +51,7 @@ class ReactionListNotifier queryParameters: { 'symbol': arg.symbol, 'offset': fetchedCount, - 'take': _pageSize, + 'take': pageSize, }, ); @@ -488,7 +482,7 @@ class ReactionDetailsPopup extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final params = ReactionListParams(symbol: symbol, postId: postId); + final params = ReactionListQuery(symbol: symbol, postId: postId); final provider = reactionListNotifierProvider(params); final width = math.min(MediaQuery.of(context).size.width * 0.8, 480.0); diff --git a/lib/widgets/post/post_reaction_sheet.freezed.dart b/lib/widgets/post/post_reaction_sheet.freezed.dart new file mode 100644 index 00000000..46d3d44d --- /dev/null +++ b/lib/widgets/post/post_reaction_sheet.freezed.dart @@ -0,0 +1,274 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'post_reaction_sheet.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ReactionListQuery { + + String get symbol; String get postId; +/// Create a copy of ReactionListQuery +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ReactionListQueryCopyWith get copyWith => _$ReactionListQueryCopyWithImpl(this as ReactionListQuery, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ReactionListQuery&&(identical(other.symbol, symbol) || other.symbol == symbol)&&(identical(other.postId, postId) || other.postId == postId)); +} + + +@override +int get hashCode => Object.hash(runtimeType,symbol,postId); + +@override +String toString() { + return 'ReactionListQuery(symbol: $symbol, postId: $postId)'; +} + + +} + +/// @nodoc +abstract mixin class $ReactionListQueryCopyWith<$Res> { + factory $ReactionListQueryCopyWith(ReactionListQuery value, $Res Function(ReactionListQuery) _then) = _$ReactionListQueryCopyWithImpl; +@useResult +$Res call({ + String symbol, String postId +}); + + + + +} +/// @nodoc +class _$ReactionListQueryCopyWithImpl<$Res> + implements $ReactionListQueryCopyWith<$Res> { + _$ReactionListQueryCopyWithImpl(this._self, this._then); + + final ReactionListQuery _self; + final $Res Function(ReactionListQuery) _then; + +/// Create a copy of ReactionListQuery +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? symbol = null,Object? postId = null,}) { + return _then(_self.copyWith( +symbol: null == symbol ? _self.symbol : symbol // ignore: cast_nullable_to_non_nullable +as String,postId: null == postId ? _self.postId : postId // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ReactionListQuery]. +extension ReactionListQueryPatterns on ReactionListQuery { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _ReactionListQuery value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ReactionListQuery() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _ReactionListQuery value) $default,){ +final _that = this; +switch (_that) { +case _ReactionListQuery(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _ReactionListQuery value)? $default,){ +final _that = this; +switch (_that) { +case _ReactionListQuery() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String symbol, String postId)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ReactionListQuery() when $default != null: +return $default(_that.symbol,_that.postId);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String symbol, String postId) $default,) {final _that = this; +switch (_that) { +case _ReactionListQuery(): +return $default(_that.symbol,_that.postId);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String symbol, String postId)? $default,) {final _that = this; +switch (_that) { +case _ReactionListQuery() when $default != null: +return $default(_that.symbol,_that.postId);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _ReactionListQuery implements ReactionListQuery { + const _ReactionListQuery({required this.symbol, required this.postId}); + + +@override final String symbol; +@override final String postId; + +/// Create a copy of ReactionListQuery +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ReactionListQueryCopyWith<_ReactionListQuery> get copyWith => __$ReactionListQueryCopyWithImpl<_ReactionListQuery>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ReactionListQuery&&(identical(other.symbol, symbol) || other.symbol == symbol)&&(identical(other.postId, postId) || other.postId == postId)); +} + + +@override +int get hashCode => Object.hash(runtimeType,symbol,postId); + +@override +String toString() { + return 'ReactionListQuery(symbol: $symbol, postId: $postId)'; +} + + +} + +/// @nodoc +abstract mixin class _$ReactionListQueryCopyWith<$Res> implements $ReactionListQueryCopyWith<$Res> { + factory _$ReactionListQueryCopyWith(_ReactionListQuery value, $Res Function(_ReactionListQuery) _then) = __$ReactionListQueryCopyWithImpl; +@override @useResult +$Res call({ + String symbol, String postId +}); + + + + +} +/// @nodoc +class __$ReactionListQueryCopyWithImpl<$Res> + implements _$ReactionListQueryCopyWith<$Res> { + __$ReactionListQueryCopyWithImpl(this._self, this._then); + + final _ReactionListQuery _self; + final $Res Function(_ReactionListQuery) _then; + +/// Create a copy of ReactionListQuery +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? symbol = null,Object? postId = null,}) { + return _then(_ReactionListQuery( +symbol: null == symbol ? _self.symbol : symbol // ignore: cast_nullable_to_non_nullable +as String,postId: null == postId ? _self.postId : postId // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/lib/widgets/post/post_replies.dart b/lib/widgets/post/post_replies.dart index 318001fa..38853ca9 100644 --- a/lib/widgets/post/post_replies.dart +++ b/lib/widgets/post/post_replies.dart @@ -6,13 +6,16 @@ import 'package:island/pods/paging.dart'; import 'package:island/widgets/paging/pagination_list.dart'; import 'package:island/widgets/post/post_item.dart'; -final postRepliesNotifierProvider = AsyncNotifierProvider.autoDispose - .family, String>(PostRepliesNotifier.new); +final postRepliesProvider = AsyncNotifierProvider.autoDispose.family( + PostRepliesNotifier.new, +); -class PostRepliesNotifier - extends AutoDisposeFamilyAsyncNotifier, String> - with FamilyAsyncPaginationController { - static const int _pageSize = 20; +class PostRepliesNotifier extends AsyncNotifier> + with AsyncPaginationController { + static const int pageSize = 20; + + final String arg; + PostRepliesNotifier(this.arg); @override Future> fetch() async { @@ -20,7 +23,7 @@ class PostRepliesNotifier final response = await client.get( '/sphere/posts/$arg/replies', - queryParameters: {'offset': fetchedCount, 'take': _pageSize}, + queryParameters: {'offset': fetchedCount, 'take': pageSize}, ); totalCount = int.parse(response.headers.value('X-Total') ?? '0'); @@ -42,7 +45,7 @@ class PostRepliesList extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final provider = postRepliesNotifierProvider(postId); + final provider = postRepliesProvider(postId); return PaginationList( provider: provider, diff --git a/lib/widgets/post/post_replies_sheet.dart b/lib/widgets/post/post_replies_sheet.dart index 6933e538..86a2ab87 100644 --- a/lib/widgets/post/post_replies_sheet.dart +++ b/lib/widgets/post/post_replies_sheet.dart @@ -41,7 +41,7 @@ class PostRepliesSheet extends HookConsumerWidget { child: PostQuickReply( parent: post, onPosted: () { - ref.invalidate(postRepliesNotifierProvider(post.id)); + ref.invalidate(postRepliesProvider(post.id)); }, onLaunch: () { Navigator.of(context).pop(); diff --git a/lib/widgets/post/post_shared.dart b/lib/widgets/post/post_shared.dart index 450e8b0d..d8deb4cd 100644 --- a/lib/widgets/post/post_shared.dart +++ b/lib/widgets/post/post_shared.dart @@ -115,7 +115,7 @@ class PostReplyPreview extends HookConsumerWidget { }, [parent]); final featuredReply = - isOpenable ? null : ref.watch(PostFeaturedReplyProvider(parent.id)); + isOpenable ? null : ref.watch(postFeaturedReplyProvider(parent.id)); final itemWidget = isOpenable diff --git a/lib/widgets/post/post_shared.g.dart b/lib/widgets/post/post_shared.g.dart index f1c23ec3..927b8038 100644 --- a/lib/widgets/post/post_shared.g.dart +++ b/lib/widgets/post/post_shared.g.dart @@ -6,147 +6,74 @@ part of 'post_shared.dart'; // RiverpodGenerator // ************************************************************************** -String _$postFeaturedReplyHash() => r'3f0ac0d51ad21f8754a63dd94109eb8ac4812293'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [postFeaturedReply]. @ProviderFor(postFeaturedReply) -const postFeaturedReplyProvider = PostFeaturedReplyFamily(); +const postFeaturedReplyProvider = PostFeaturedReplyFamily._(); -/// See also [postFeaturedReply]. -class PostFeaturedReplyFamily extends Family> { - /// See also [postFeaturedReply]. - const PostFeaturedReplyFamily(); +final class PostFeaturedReplyProvider + extends $FunctionalProvider, SnPost?, FutureOr> + with $FutureModifier, $FutureProvider { + const PostFeaturedReplyProvider._({ + required PostFeaturedReplyFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'postFeaturedReplyProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [postFeaturedReply]. - PostFeaturedReplyProvider call(String id) { - return PostFeaturedReplyProvider(id); + @override + String debugGetCreateSourceHash() => _$postFeaturedReplyHash(); + + @override + String toString() { + return r'postFeaturedReplyProvider' + '' + '($argument)'; } + @$internal @override - PostFeaturedReplyProvider getProviderOverride( - covariant PostFeaturedReplyProvider provider, - ) { - return call(provider.id); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement($ProviderPointer pointer) => + $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'postFeaturedReplyProvider'; -} - -/// See also [postFeaturedReply]. -class PostFeaturedReplyProvider extends AutoDisposeFutureProvider { - /// See also [postFeaturedReply]. - PostFeaturedReplyProvider(String id) - : this._internal( - (ref) => postFeaturedReply(ref as PostFeaturedReplyRef, id), - from: postFeaturedReplyProvider, - name: r'postFeaturedReplyProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$postFeaturedReplyHash, - dependencies: PostFeaturedReplyFamily._dependencies, - allTransitiveDependencies: - PostFeaturedReplyFamily._allTransitiveDependencies, - id: id, - ); - - PostFeaturedReplyProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.id, - }) : super.internal(); - - final String id; - - @override - Override overrideWith( - FutureOr Function(PostFeaturedReplyRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: PostFeaturedReplyProvider._internal( - (ref) => create(ref as PostFeaturedReplyRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - id: id, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _PostFeaturedReplyProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return postFeaturedReply(ref, argument); } @override bool operator ==(Object other) { - return other is PostFeaturedReplyProvider && other.id == id; + return other is PostFeaturedReplyProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, id.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin PostFeaturedReplyRef on AutoDisposeFutureProviderRef { - /// The parameter `id` of this provider. - String get id; -} +String _$postFeaturedReplyHash() => r'3f0ac0d51ad21f8754a63dd94109eb8ac4812293'; -class _PostFeaturedReplyProviderElement - extends AutoDisposeFutureProviderElement - with PostFeaturedReplyRef { - _PostFeaturedReplyProviderElement(super.provider); +final class PostFeaturedReplyFamily extends $Family + with $FunctionalFamilyOverride, String> { + const PostFeaturedReplyFamily._() + : super( + retry: null, + name: r'postFeaturedReplyProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + PostFeaturedReplyProvider call(String id) => + PostFeaturedReplyProvider._(argument: id, from: this); @override - String get id => (origin as PostFeaturedReplyProvider).id; + String toString() => r'postFeaturedReplyProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/widgets/post/post_shuffle.dart b/lib/widgets/post/post_shuffle.dart index fcf279e2..492560e3 100644 --- a/lib/widgets/post/post_shuffle.dart +++ b/lib/widgets/post/post_shuffle.dart @@ -38,9 +38,9 @@ class PostShuffleScreen extends HookConsumerWidget { kBottomControlHeight + MediaQuery.of(context).padding.bottom, ), child: Builder( - key: ValueKey(postListState.valueOrNull?.length ?? 0), + key: ValueKey(postListState.value?.length ?? 0), builder: (context) { - final items = postListState.valueOrNull ?? []; + final items = postListState.value ?? []; if (items.isNotEmpty) { return CardSwiper( controller: cardSwiperController, diff --git a/lib/widgets/realm/realm_list.dart b/lib/widgets/realm/realm_list.dart index 28ebff72..f502e4fe 100644 --- a/lib/widgets/realm/realm_list.dart +++ b/lib/widgets/realm/realm_list.dart @@ -11,9 +11,11 @@ import 'package:styled_widget/styled_widget.dart'; final realmListNotifierProvider = AsyncNotifierProvider.autoDispose .family, String?>(RealmListNotifier.new); -class RealmListNotifier - extends AutoDisposeFamilyAsyncNotifier, String?> - with FamilyAsyncPaginationController { +class RealmListNotifier extends AsyncNotifier> + with AsyncPaginationController { + String? arg; + RealmListNotifier(this.arg); + static const int _pageSize = 20; @override @@ -61,9 +63,9 @@ class SliverRealmList extends HookConsumerWidget { ).center(), ), if (index < - (ref.read(provider).valueOrNull?.length ?? 0) - + (ref.read(provider).value?.length ?? 0) - 1) // Add gap except for last item? Actually PaginationList handles loading indicator which might look like last item. - // Wait, ref.read(provider).valueOrNull?.length might change. + // Wait, ref.read(provider).value?.length might change. // Simpler to just add bottom padding to all, or Gap. const Gap(8), ], diff --git a/lib/widgets/share/share_sheet.dart b/lib/widgets/share/share_sheet.dart index 91433fc7..0e1a6ba2 100644 --- a/lib/widgets/share/share_sheet.dart +++ b/lib/widgets/share/share_sheet.dart @@ -664,7 +664,7 @@ class _ChatRoomsList extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final chatRooms = ref.watch(chatRoomJoinedNotifierProvider); + final chatRooms = ref.watch(chatRoomJoinedProvider); return chatRooms.when( data: (rooms) { diff --git a/lib/widgets/stickers/sticker_picker.dart b/lib/widgets/stickers/sticker_picker.dart index 2fb16f70..d7db8e27 100644 --- a/lib/widgets/stickers/sticker_picker.dart +++ b/lib/widgets/stickers/sticker_picker.dart @@ -463,7 +463,6 @@ Future showStickerPickerPopover( width: math.min(480, MediaQuery.of(context).size.width * 0.9), height: 480, child: ProviderScope( - parent: ProviderScope.containerOf(context), child: StickerPicker( onPick: (ph) { onPick(ph); diff --git a/lib/widgets/stickers/sticker_picker.g.dart b/lib/widgets/stickers/sticker_picker.g.dart index ec430323..c2a744c3 100644 --- a/lib/widgets/stickers/sticker_picker.g.dart +++ b/lib/widgets/stickers/sticker_picker.g.dart @@ -6,27 +6,53 @@ part of 'sticker_picker.dart'; // RiverpodGenerator // ************************************************************************** -String _$myStickerPacksHash() => r'1e19832e8ab1cb139ad18aebfa5aebdf4fdea499'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning +/// Fetch user-added sticker packs (with stickers) from API: +/// GET /sphere/stickers/me + +@ProviderFor(myStickerPacks) +const myStickerPacksProvider = MyStickerPacksProvider._(); /// Fetch user-added sticker packs (with stickers) from API: /// GET /sphere/stickers/me -/// -/// Copied from [myStickerPacks]. -@ProviderFor(myStickerPacks) -final myStickerPacksProvider = - AutoDisposeFutureProvider>.internal( - myStickerPacks, - name: r'myStickerPacksProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$myStickerPacksHash, - dependencies: null, - allTransitiveDependencies: null, - ); -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -typedef MyStickerPacksRef = AutoDisposeFutureProviderRef>; -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package +final class MyStickerPacksProvider + extends + $FunctionalProvider< + AsyncValue>, + List, + FutureOr> + > + with + $FutureModifier>, + $FutureProvider> { + /// Fetch user-added sticker packs (with stickers) from API: + /// GET /sphere/stickers/me + const MyStickerPacksProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'myStickerPacksProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$myStickerPacksHash(); + + @$internal + @override + $FutureProviderElement> $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr> create(Ref ref) { + return myStickerPacks(ref); + } +} + +String _$myStickerPacksHash() => r'1e19832e8ab1cb139ad18aebfa5aebdf4fdea499'; diff --git a/lib/widgets/thought/thought_sequence_list.dart b/lib/widgets/thought/thought_sequence_list.dart index d6ff796b..0a7268d5 100644 --- a/lib/widgets/thought/thought_sequence_list.dart +++ b/lib/widgets/thought/thought_sequence_list.dart @@ -13,15 +13,15 @@ final thoughtSequenceListNotifierProvider = AsyncNotifierProvider.autoDispose< >(ThoughtSequenceListNotifier.new); class ThoughtSequenceListNotifier - extends AutoDisposeAsyncNotifier> - with AutoDisposeAsyncPaginationController { - static const int _pageSize = 20; + extends AsyncNotifier> + with AsyncPaginationController { + static const int pageSize = 20; @override Future> fetch() async { final client = ref.read(apiClientProvider); - final queryParams = {'offset': fetchedCount, 'take': _pageSize}; + final queryParams = {'offset': fetchedCount, 'take': pageSize}; final response = await client.get( '/insight/thought/sequences', diff --git a/lib/widgets/tour/tour.dart b/lib/widgets/tour/tour.dart index f9d4ae66..ba7f517a 100644 --- a/lib/widgets/tour/tour.dart +++ b/lib/widgets/tour/tour.dart @@ -11,7 +11,7 @@ class TourTriggerWidget extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final tourStatus = ref.watch(tourStatusNotifierProvider.notifier); + final tourStatus = ref.watch(tourStatusProvider.notifier); useEffect(() { Future(() async { diff --git a/lib/widgets/wallet/fund_envelope.g.dart b/lib/widgets/wallet/fund_envelope.g.dart index 5afa8987..821c8174 100644 --- a/lib/widgets/wallet/fund_envelope.g.dart +++ b/lib/widgets/wallet/fund_envelope.g.dart @@ -6,146 +6,80 @@ part of 'fund_envelope.dart'; // RiverpodGenerator // ************************************************************************** -String _$walletFundHash() => r'521fa280708e71266f8164268ba11f135f4ba810'; +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning -/// Copied from Dart SDK -class _SystemHash { - _SystemHash._(); - - static int combine(int hash, int value) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + value); - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - static int finish(int hash) { - // ignore: parameter_assignments - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - // ignore: parameter_assignments - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } -} - -/// See also [walletFund]. @ProviderFor(walletFund) -const walletFundProvider = WalletFundFamily(); +const walletFundProvider = WalletFundFamily._(); -/// See also [walletFund]. -class WalletFundFamily extends Family> { - /// See also [walletFund]. - const WalletFundFamily(); +final class WalletFundProvider + extends + $FunctionalProvider< + AsyncValue, + SnWalletFund, + FutureOr + > + with $FutureModifier, $FutureProvider { + const WalletFundProvider._({ + required WalletFundFamily super.from, + required String super.argument, + }) : super( + retry: null, + name: r'walletFundProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); - /// See also [walletFund]. - WalletFundProvider call(String fundId) { - return WalletFundProvider(fundId); + @override + String debugGetCreateSourceHash() => _$walletFundHash(); + + @override + String toString() { + return r'walletFundProvider' + '' + '($argument)'; } + @$internal @override - WalletFundProvider getProviderOverride( - covariant WalletFundProvider provider, - ) { - return call(provider.fundId); - } - - static const Iterable? _dependencies = null; + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); @override - Iterable? get dependencies => _dependencies; - - static const Iterable? _allTransitiveDependencies = null; - - @override - Iterable? get allTransitiveDependencies => - _allTransitiveDependencies; - - @override - String? get name => r'walletFundProvider'; -} - -/// See also [walletFund]. -class WalletFundProvider extends AutoDisposeFutureProvider { - /// See also [walletFund]. - WalletFundProvider(String fundId) - : this._internal( - (ref) => walletFund(ref as WalletFundRef, fundId), - from: walletFundProvider, - name: r'walletFundProvider', - debugGetCreateSourceHash: - const bool.fromEnvironment('dart.vm.product') - ? null - : _$walletFundHash, - dependencies: WalletFundFamily._dependencies, - allTransitiveDependencies: WalletFundFamily._allTransitiveDependencies, - fundId: fundId, - ); - - WalletFundProvider._internal( - super._createNotifier, { - required super.name, - required super.dependencies, - required super.allTransitiveDependencies, - required super.debugGetCreateSourceHash, - required super.from, - required this.fundId, - }) : super.internal(); - - final String fundId; - - @override - Override overrideWith( - FutureOr Function(WalletFundRef provider) create, - ) { - return ProviderOverride( - origin: this, - override: WalletFundProvider._internal( - (ref) => create(ref as WalletFundRef), - from: from, - name: null, - dependencies: null, - allTransitiveDependencies: null, - debugGetCreateSourceHash: null, - fundId: fundId, - ), - ); - } - - @override - AutoDisposeFutureProviderElement createElement() { - return _WalletFundProviderElement(this); + FutureOr create(Ref ref) { + final argument = this.argument as String; + return walletFund(ref, argument); } @override bool operator ==(Object other) { - return other is WalletFundProvider && other.fundId == fundId; + return other is WalletFundProvider && other.argument == argument; } @override int get hashCode { - var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, fundId.hashCode); - - return _SystemHash.finish(hash); + return argument.hashCode; } } -@Deprecated('Will be removed in 3.0. Use Ref instead') -// ignore: unused_element -mixin WalletFundRef on AutoDisposeFutureProviderRef { - /// The parameter `fundId` of this provider. - String get fundId; -} +String _$walletFundHash() => r'521fa280708e71266f8164268ba11f135f4ba810'; -class _WalletFundProviderElement - extends AutoDisposeFutureProviderElement - with WalletFundRef { - _WalletFundProviderElement(super.provider); +final class WalletFundFamily extends $Family + with $FunctionalFamilyOverride, String> { + const WalletFundFamily._() + : super( + retry: null, + name: r'walletFundProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + WalletFundProvider call(String fundId) => + WalletFundProvider._(argument: fundId, from: this); @override - String get fundId => (origin as WalletFundProvider).fundId; + String toString() => r'walletFundProvider'; } - -// ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/pubspec.lock b/pubspec.lock index 806beac7..008bee77 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f + sha256: c209688d9f5a5f26b2fb47a188131a6fb9e876ae9e47af3737c0b4f58a93470d url: "https://pub.dev" source: hosted - version: "85.0.0" + version: "91.0.0" _flutterfire_internals: dependency: transitive description: @@ -29,18 +29,26 @@ packages: dependency: transitive description: name: analyzer - sha256: f4ad0fea5f102201015c9aae9d93bc02f75dd9491529a8c21f88d17a8523d44c + sha256: a40a0cee526a7e1f387c6847bd8a5ccbf510a75952ef8a28338e989558072cb0 url: "https://pub.dev" source: hosted - version: "7.6.0" + version: "8.4.0" + analyzer_buffer: + dependency: transitive + description: + name: analyzer_buffer + sha256: aba2f75e63b3135fd1efaa8b6abefe1aa6e41b6bd9806221620fa48f98156033 + url: "https://pub.dev" + source: hosted + version: "0.1.11" analyzer_plugin: dependency: transitive description: name: analyzer_plugin - sha256: a5ab7590c27b779f3d4de67f31c4109dbe13dd7339f86461a6f2a8ab2594d8ce + sha256: "08cfefa90b4f4dd3b447bda831cecf644029f9f8e22820f6ee310213ebe2dd53" url: "https://pub.dev" source: hosted - version: "0.13.4" + version: "0.13.10" animations: dependency: "direct main" description: @@ -109,18 +117,18 @@ packages: dependency: transitive description: name: build - sha256: "51dc711996cbf609b90cbe5b335bbce83143875a9d58e4b5c6d3c4f684d3dda7" + sha256: c1668065e9ba04752570ad7e038288559d1e2ca5c6d0131c0f5f55e39e777413 url: "https://pub.dev" source: hosted - version: "2.5.4" + version: "4.0.3" build_config: dependency: transitive description: name: build_config - sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" + sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.0" build_daemon: dependency: transitive description: @@ -129,30 +137,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.1" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: ee4257b3f20c0c90e72ed2b57ad637f694ccba48839a821e87db762548c22a62 - url: "https://pub.dev" - source: hosted - version: "2.5.4" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "382a4d649addbfb7ba71a3631df0ec6a45d5ab9b098638144faf27f02778eb53" + sha256: "110c56ef29b5eb367b4d17fc79375fa8c18a6cd7acd92c05bb3986c17a079057" url: "https://pub.dev" source: hosted - version: "2.5.4" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: "85fbbb1036d576d966332a3f5ce83f2ce66a40bea1a94ad2d5fc29a19a0d3792" - url: "https://pub.dev" - source: hosted - version: "9.1.2" + version: "2.10.4" built_collection: dependency: transitive description: @@ -241,6 +233,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.0" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" cli_util: dependency: transitive description: @@ -305,6 +305,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d" + url: "https://pub.dev" + source: hosted + version: "1.15.0" croppy: dependency: "direct main" description: @@ -349,34 +357,34 @@ packages: dependency: "direct dev" description: name: custom_lint - sha256: "9656925637516c5cf0f5da018b33df94025af2088fe09c8ae2ca54c53f2d9a84" + sha256: "751ee9440920f808266c3ec2553420dea56d3c7837dd2d62af76b11be3fcece5" url: "https://pub.dev" source: hosted - version: "0.7.6" + version: "0.8.1" custom_lint_builder: dependency: transitive description: name: custom_lint_builder - sha256: "6cdc8e87e51baaaba9c43e283ed8d28e59a0c4732279df62f66f7b5984655414" + sha256: "1128db6f58e71d43842f3b9be7465c83f0c47f4dd8918f878dd6ad3b72a32072" url: "https://pub.dev" source: hosted - version: "0.7.6" + version: "0.8.1" custom_lint_core: dependency: transitive description: name: custom_lint_core - sha256: "31110af3dde9d29fb10828ca33f1dce24d2798477b167675543ce3d208dee8be" + sha256: "85b339346154d5646952d44d682965dfe9e12cae5febd706f0db3aa5010d6423" url: "https://pub.dev" source: hosted - version: "0.7.5" + version: "0.8.1" custom_lint_visitor: dependency: transitive description: name: custom_lint_visitor - sha256: "4a86a0d8415a91fbb8298d6ef03e9034dc8e323a599ddc4120a0e36c433983a2" + sha256: "91f2a81e9f0abb4b9f3bb529f78b6227ce6050300d1ae5b1e2c69c66c7a566d8" url: "https://pub.dev" source: hosted - version: "1.0.0+7.7.0" + version: "1.0.0+8.4.0" dart_ipc: dependency: "direct main" description: @@ -397,10 +405,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb" + sha256: a9c30492da18ff84efe2422ba2d319a89942d93e58eb0b73d32abe822ef54b7b url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.3" dart_webrtc: dependency: transitive description: @@ -485,18 +493,18 @@ packages: dependency: "direct main" description: name: drift - sha256: "540cf382a3bfa99b76e51514db5b0ebcd81ce3679b7c1c9cb9478ff3735e47a1" + sha256: "83290a32ae006a7535c5ecf300722cb77177250d9df4ee2becc5fa8a36095114" url: "https://pub.dev" source: hosted - version: "2.28.2" + version: "2.29.0" drift_dev: dependency: "direct dev" description: name: drift_dev - sha256: "68c138e884527d2bd61df2ade276c3a144df84d1adeb0ab8f3196b5afe021bd4" + sha256: "6019f827544e77524ffd5134ae0cb75dfd92ef5ef3e269872af92840c929cd43" url: "https://pub.dev" source: hosted - version: "2.28.0" + version: "2.29.0" drift_flutter: dependency: "direct main" description: @@ -1063,10 +1071,10 @@ packages: dependency: "direct main" description: name: flutter_riverpod - sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1" + sha256: "9e2d6907f12cc7d23a846847615941bddee8709bf2bfd274acdf5e80bcf22fde" url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "3.0.3" flutter_secure_storage: dependency: "direct main" description: @@ -1193,10 +1201,10 @@ packages: dependency: "direct dev" description: name: freezed - sha256: "2d399f823b8849663744d2a9ddcce01c49268fb4170d0442a655bf6a2f47be22" + sha256: "13065f10e135263a4f5a4391b79a8efc5fb8106f8dd555a9e49b750b45393d77" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.3" freezed_annotation: dependency: "direct main" description: @@ -1297,10 +1305,10 @@ packages: dependency: "direct main" description: name: hooks_riverpod - sha256: "70bba33cfc5670c84b796e6929c54b8bc5be7d0fe15bb28c2560500b9ad06966" + sha256: ae4a2f6d82dd895379f9b95457e090ac2d2fef9446f9325f8d31b9c86cadc131 url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "3.0.3" hotreloader: dependency: transitive description: @@ -1385,10 +1393,10 @@ packages: dependency: transitive description: name: image_picker_ios - sha256: "997d100ce1dda5b1ba4085194c5e36c9f8a1fb7987f6a36ab677a344cd2dc986" + sha256: "956c16a42c0c708f914021666ffcd8265dde36e673c9fa68c81f7d085d9774ad" url: "https://pub.dev" source: hosted - version: "0.8.13+2" + version: "0.8.13+3" image_picker_linux: dependency: transitive description: @@ -1473,10 +1481,10 @@ packages: dependency: "direct dev" description: name: json_serializable - sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c + sha256: c5b2ee75210a0f263c6c7b9eeea80553dbae96ea1bf57f02484e806a3ffdffa3 url: "https://pub.dev" source: hosted - version: "6.9.5" + version: "6.11.2" leak_tracker: dependency: transitive description: @@ -1733,6 +1741,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + mockito: + dependency: transitive + description: + name: mockito + sha256: dac24d461418d363778d53198d9ac0510b9d073869f078450f195766ec48d05e + url: "https://pub.dev" + source: hosted + version: "5.6.1" mocktail: dependency: transitive description: @@ -1781,6 +1797,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.5.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" octo_image: dependency: transitive description: @@ -2194,50 +2218,42 @@ packages: dependency: transitive description: name: riverpod - sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" + sha256: c406de02bff19d920b832bddfb8283548bfa05ce41c59afba57ce643e116aa59 url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "3.0.3" riverpod_analyzer_utils: dependency: transitive description: name: riverpod_analyzer_utils - sha256: "03a17170088c63aab6c54c44456f5ab78876a1ddb6032ffde1662ddab4959611" + sha256: a0f68adb078b790faa3c655110a017f9a7b7b079a57bbd40f540e80dce5fcd29 url: "https://pub.dev" source: hosted - version: "0.5.10" + version: "1.0.0-dev.7" riverpod_annotation: dependency: "direct main" description: name: riverpod_annotation - sha256: e14b0bf45b71326654e2705d462f21b958f987087be850afd60578fcd502d1b8 + sha256: "7230014155777fc31ba3351bc2cb5a3b5717b11bfafe52b1553cb47d385f8897" url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "3.0.3" riverpod_generator: dependency: "direct dev" description: name: riverpod_generator - sha256: "44a0992d54473eb199ede00e2260bd3c262a86560e3c6f6374503d86d0580e36" + sha256: "49894543a42cf7a9954fc4e7366b6d3cb2e6ec0fa07775f660afcdd92d097702" url: "https://pub.dev" source: hosted - version: "2.6.5" + version: "3.0.3" riverpod_lint: dependency: "direct dev" description: name: riverpod_lint - sha256: "89a52b7334210dbff8605c3edf26cfe69b15062beed5cbfeff2c3812c33c9e35" + sha256: "7ef9c43469e9b5ac4e4c3b24d7c30642e47ce1b12cd7dcdd643534db0a72ed13" url: "https://pub.dev" source: hosted - version: "2.6.5" - riverpod_paging_utils: - dependency: "direct main" - description: - name: riverpod_paging_utils - sha256: a3eb7cc87d53d90dac9bf0b0d695ecdc049aae5dd6debd7d2d62ab3682cf5841 - url: "https://pub.dev" - source: hosted - version: "0.8.1" + version: "3.0.3" rxdart: dependency: transitive description: @@ -2406,6 +2422,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" shelf_web_socket: dependency: "direct main" description: @@ -2471,18 +2503,34 @@ packages: dependency: transitive description: name: source_gen - sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" + sha256: "07b277b67e0096c45196cbddddf2d8c6ffc49342e88bf31d460ce04605ddac75" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "4.1.1" source_helper: dependency: transitive description: name: source_helper - sha256: a447acb083d3a5ef17f983dd36201aeea33fedadb3228fa831f2f0c92f0f3aca + sha256: "6a3c6cc82073a8797f8c4dc4572146114a39652851c157db37e964d9c7038723" url: "https://pub.dev" source: hosted - version: "1.3.7" + version: "1.3.8" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" source_span: dependency: transitive description: @@ -2551,10 +2599,10 @@ packages: dependency: transitive description: name: sqlparser - sha256: "57090342af1ce32bb499aa641f4ecdd2d6231b9403cea537ac059e803cc20d67" + sha256: "54eea43e36dd3769274c3108625f9ea1a382f8d2ac8b16f3e4589d9bd9b0e16c" url: "https://pub.dev" source: hosted - version: "0.41.2" + version: "0.42.0" stack_trace: dependency: transitive description: @@ -2759,10 +2807,10 @@ packages: dependency: "direct main" description: name: talker_riverpod_logger - sha256: ff4f80201c5bfefa916f86f6fe8853cd6fe8b9f93f6cdc8bb7cc98fb085fc816 + sha256: "7040a9e4efcd6b41a169b607bfd1db6cbe0a22182659006979531f63155a1426" url: "https://pub.dev" source: hosted - version: "5.0.1" + version: "5.1.3" term_glyph: dependency: transitive description: @@ -2771,6 +2819,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.2" + test: + dependency: transitive + description: + name: test + sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7" + url: "https://pub.dev" + source: hosted + version: "1.26.3" test_api: dependency: transitive description: @@ -2779,6 +2835,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.7" + test_core: + dependency: transitive + description: + name: test_core + sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0" + url: "https://pub.dev" + source: hosted + version: "0.6.12" timezone: dependency: "direct main" description: @@ -2787,14 +2851,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.10.1" - timing: - dependency: transitive - description: - name: timing - sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" - url: "https://pub.dev" - source: hosted - version: "1.0.2" top_snackbar_flutter: dependency: "direct main" description: @@ -3044,6 +3100,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" webrtc_interface: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 22933471..b879463f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 3.5.0+150 environment: - sdk: ^3.7.2 + sdk: ^3.8.0 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -37,11 +37,11 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 flutter_hooks: ^0.21.3+1 - hooks_riverpod: ^2.6.1 + hooks_riverpod: ^3.0.3 go_router: ^17.0.0 styled_widget: ^0.4.1 shared_preferences: ^2.5.3 - flutter_riverpod: ^2.6.1 + flutter_riverpod: ^3.0.3 path_provider: ^2.1.5 dio: ^5.9.0 very_good_infinite_list: ^0.9.0 @@ -74,7 +74,7 @@ dependencies: cross_file: ^0.3.5+1 image_picker: ^1.2.1 file_picker: ^10.3.7 - riverpod_annotation: ^2.6.1 + riverpod_annotation: ^3.0.3 image_picker_platform_interface: ^2.11.1 image_picker_android: ^0.8.13+10 super_context_menu: ^0.9.1 @@ -84,7 +84,7 @@ dependencies: firebase_core: ^4.2.1 web_socket_channel: ^3.0.3 material_symbols_icons: ^4.2892.0 - drift: ^2.28.2 + drift: ^2.29.0 drift_flutter: ^0.2.7 path: ^1.9.1 collection: ^1.19.1 @@ -93,7 +93,6 @@ dependencies: table_calendar: ^3.2.0 relative_time: ^5.0.0 dropdown_button2: ^2.3.9 - riverpod_paging_utils: ^0.8.1 crypto: ^3.0.7 avatar_stack: ^3.0.0 markdown_widget: ^2.3.2+8 @@ -159,7 +158,7 @@ dependencies: talker_flutter: ^5.1.3 talker_logger: ^5.1.3 talker_dio_logger: ^5.1.3 - talker_riverpod_logger: ^5.0.1 + talker_riverpod_logger: ^5.1.3 syncfusion_flutter_pdfviewer: ^31.1.21 swipe_to: ^1.0.6 fl_heatmap: ^0.4.6 @@ -182,13 +181,13 @@ dev_dependencies: # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^6.0.0 - build_runner: ^2.5.4 - freezed: ^3.1.0 - json_serializable: ^6.9.5 - riverpod_generator: ^2.6.5 - custom_lint: ^0.7.6 - riverpod_lint: ^2.6.5 - drift_dev: ^2.28.0 + build_runner: ^2.10.4 + freezed: ^3.2.3 + json_serializable: ^6.11.2 + riverpod_generator: ^3.0.3 + custom_lint: ^0.8.1 + riverpod_lint: ^3.0.3 + drift_dev: ^2.29.0 flutter_launcher_icons: ^0.14.4 msix: ^3.16.12