♻️ Continued to migrate list pagination
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/webfeed.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/pods/paging.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
import 'package:island/widgets/paging/pagination_list.dart';
|
||||
import 'package:island/widgets/web_article_card.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
part 'feed_detail.g.dart';
|
||||
@@ -23,52 +22,32 @@ Future<SnWebFeed> marketplaceWebFeed(Ref ref, String feedId) async {
|
||||
return SnWebFeed.fromJson(resp.data);
|
||||
}
|
||||
|
||||
/// Provider for web feed articles content
|
||||
@riverpod
|
||||
final marketplaceWebFeedContentNotifierProvider = AsyncNotifierProvider.family
|
||||
.autoDispose(MarketplaceWebFeedContentNotifier.new);
|
||||
|
||||
class MarketplaceWebFeedContentNotifier
|
||||
extends _$MarketplaceWebFeedContentNotifier
|
||||
with CursorPagingNotifierMixin<SnWebArticle> {
|
||||
static const int _pageSize = 20;
|
||||
extends AutoDisposeFamilyAsyncNotifier<List<SnWebArticle>, String>
|
||||
with FamilyAsyncPaginationController<SnWebArticle, String> {
|
||||
static const int pageSize = 20;
|
||||
|
||||
@override
|
||||
Future<CursorPagingData<SnWebArticle>> build(String feedId) async {
|
||||
_feedId = feedId;
|
||||
return fetch(cursor: null);
|
||||
}
|
||||
|
||||
late final String _feedId;
|
||||
ValueNotifier<int> totalCount = ValueNotifier(0);
|
||||
|
||||
@override
|
||||
Future<CursorPagingData<SnWebArticle>> fetch({
|
||||
required String? cursor,
|
||||
}) async {
|
||||
Future<List<SnWebArticle>> fetch() async {
|
||||
final client = ref.read(apiClientProvider);
|
||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
||||
|
||||
final queryParams = {'offset': offset, 'take': _pageSize};
|
||||
final queryParams = {'offset': fetchedCount.toString(), 'take': pageSize};
|
||||
|
||||
final response = await client.get(
|
||||
'/sphere/feeds/$_feedId/articles',
|
||||
'/sphere/feeds/$arg/articles',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
||||
totalCount.value = total;
|
||||
final List<dynamic> data = response.data;
|
||||
final articles = data.map((json) => SnWebArticle.fromJson(json)).toList();
|
||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||
final articles =
|
||||
response.data
|
||||
.map((json) => SnWebArticle.fromJson(json))
|
||||
.cast<SnWebArticle>()
|
||||
.toList();
|
||||
|
||||
final hasMore = offset + articles.length < total;
|
||||
final nextCursor = hasMore ? (offset + articles.length).toString() : null;
|
||||
|
||||
return CursorPagingData(
|
||||
items: articles,
|
||||
hasMore: hasMore,
|
||||
nextCursor: nextCursor,
|
||||
);
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
totalCount.dispose();
|
||||
return articles;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,10 +105,6 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
|
||||
marketplaceWebFeedContentNotifierProvider(id).notifier,
|
||||
);
|
||||
|
||||
useEffect(() {
|
||||
return feedNotifier.dispose;
|
||||
}, []);
|
||||
|
||||
return AppScaffold(
|
||||
appBar: AppBar(title: Text(feed.value?.title ?? 'loading'.tr())),
|
||||
body: Column(
|
||||
@@ -147,14 +122,10 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
|
||||
spacing: 4,
|
||||
children: [
|
||||
const Icon(Symbols.rss_feed, size: 16),
|
||||
ListenableBuilder(
|
||||
listenable: feedNotifier.totalCount,
|
||||
builder:
|
||||
(context, _) => Text(
|
||||
'webFeedArticleCount'.plural(
|
||||
feedNotifier.totalCount.value,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'webFeedArticleCount'.plural(
|
||||
feedNotifier.totalCount ?? 0,
|
||||
),
|
||||
),
|
||||
],
|
||||
).opacity(0.85),
|
||||
@@ -174,29 +145,12 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
|
||||
const Divider(height: 1),
|
||||
// Articles list
|
||||
Expanded(
|
||||
child: PagingHelperView(
|
||||
child: PaginationList(
|
||||
provider: marketplaceWebFeedContentNotifierProvider(id),
|
||||
futureRefreshable:
|
||||
marketplaceWebFeedContentNotifierProvider(id).future,
|
||||
notifierRefreshable:
|
||||
marketplaceWebFeedContentNotifierProvider(id).notifier,
|
||||
contentBuilder:
|
||||
(data, widgetCount, endItemView) => ListView.separated(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 24,
|
||||
vertical: 20,
|
||||
),
|
||||
itemCount: widgetCount,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == widgetCount - 1) {
|
||||
return endItemView;
|
||||
}
|
||||
|
||||
final article = data.items[index];
|
||||
return WebArticleCard(article: article);
|
||||
},
|
||||
separatorBuilder: (context, index) => const Gap(12),
|
||||
),
|
||||
notifier: marketplaceWebFeedContentNotifierProvider(id).notifier,
|
||||
itemBuilder: (context, index, article) {
|
||||
return WebArticleCard(article: article);
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
||||
@@ -290,169 +290,5 @@ class _MarketplaceWebFeedSubscriptionProviderElement
|
||||
(origin as MarketplaceWebFeedSubscriptionProvider).feedId;
|
||||
}
|
||||
|
||||
String _$marketplaceWebFeedContentNotifierHash() =>
|
||||
r'25688082884cb824eeff300888ba38c9748295dc';
|
||||
|
||||
abstract class _$MarketplaceWebFeedContentNotifier
|
||||
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnWebArticle>> {
|
||||
late final String feedId;
|
||||
|
||||
FutureOr<CursorPagingData<SnWebArticle>> build(String feedId);
|
||||
}
|
||||
|
||||
/// Provider for web feed articles content
|
||||
///
|
||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
||||
@ProviderFor(MarketplaceWebFeedContentNotifier)
|
||||
const marketplaceWebFeedContentNotifierProvider =
|
||||
MarketplaceWebFeedContentNotifierFamily();
|
||||
|
||||
/// Provider for web feed articles content
|
||||
///
|
||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
||||
class MarketplaceWebFeedContentNotifierFamily
|
||||
extends Family<AsyncValue<CursorPagingData<SnWebArticle>>> {
|
||||
/// Provider for web feed articles content
|
||||
///
|
||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
||||
const MarketplaceWebFeedContentNotifierFamily();
|
||||
|
||||
/// Provider for web feed articles content
|
||||
///
|
||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
||||
MarketplaceWebFeedContentNotifierProvider call(String feedId) {
|
||||
return MarketplaceWebFeedContentNotifierProvider(feedId);
|
||||
}
|
||||
|
||||
@override
|
||||
MarketplaceWebFeedContentNotifierProvider getProviderOverride(
|
||||
covariant MarketplaceWebFeedContentNotifierProvider provider,
|
||||
) {
|
||||
return call(provider.feedId);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
||||
_allTransitiveDependencies;
|
||||
|
||||
@override
|
||||
String? get name => r'marketplaceWebFeedContentNotifierProvider';
|
||||
}
|
||||
|
||||
/// Provider for web feed articles content
|
||||
///
|
||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
||||
class MarketplaceWebFeedContentNotifierProvider
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderImpl<
|
||||
MarketplaceWebFeedContentNotifier,
|
||||
CursorPagingData<SnWebArticle>
|
||||
> {
|
||||
/// Provider for web feed articles content
|
||||
///
|
||||
/// Copied from [MarketplaceWebFeedContentNotifier].
|
||||
MarketplaceWebFeedContentNotifierProvider(String feedId)
|
||||
: this._internal(
|
||||
() => MarketplaceWebFeedContentNotifier()..feedId = feedId,
|
||||
from: marketplaceWebFeedContentNotifierProvider,
|
||||
name: r'marketplaceWebFeedContentNotifierProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$marketplaceWebFeedContentNotifierHash,
|
||||
dependencies: MarketplaceWebFeedContentNotifierFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
MarketplaceWebFeedContentNotifierFamily._allTransitiveDependencies,
|
||||
feedId: feedId,
|
||||
);
|
||||
|
||||
MarketplaceWebFeedContentNotifierProvider._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
|
||||
FutureOr<CursorPagingData<SnWebArticle>> runNotifierBuild(
|
||||
covariant MarketplaceWebFeedContentNotifier notifier,
|
||||
) {
|
||||
return notifier.build(feedId);
|
||||
}
|
||||
|
||||
@override
|
||||
Override overrideWith(MarketplaceWebFeedContentNotifier Function() create) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: MarketplaceWebFeedContentNotifierProvider._internal(
|
||||
() => create()..feedId = feedId,
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
debugGetCreateSourceHash: null,
|
||||
feedId: feedId,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeAsyncNotifierProviderElement<
|
||||
MarketplaceWebFeedContentNotifier,
|
||||
CursorPagingData<SnWebArticle>
|
||||
>
|
||||
createElement() {
|
||||
return _MarketplaceWebFeedContentNotifierProviderElement(this);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is MarketplaceWebFeedContentNotifierProvider &&
|
||||
other.feedId == feedId;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
||||
hash = _SystemHash.combine(hash, feedId.hashCode);
|
||||
|
||||
return _SystemHash.finish(hash);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
mixin MarketplaceWebFeedContentNotifierRef
|
||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnWebArticle>> {
|
||||
/// The parameter `feedId` of this provider.
|
||||
String get feedId;
|
||||
}
|
||||
|
||||
class _MarketplaceWebFeedContentNotifierProviderElement
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderElement<
|
||||
MarketplaceWebFeedContentNotifier,
|
||||
CursorPagingData<SnWebArticle>
|
||||
>
|
||||
with MarketplaceWebFeedContentNotifierRef {
|
||||
_MarketplaceWebFeedContentNotifierProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
String get feedId =>
|
||||
(origin as MarketplaceWebFeedContentNotifierProvider).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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
@@ -6,52 +7,44 @@ import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/webfeed.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/pods/paging.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
import 'package:island/widgets/paging/pagination_list.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
||||
final marketplaceWebFeedsNotifierProvider = AsyncNotifierProvider(
|
||||
MarketplaceWebFeedsNotifier.new,
|
||||
);
|
||||
|
||||
part 'feed_marketplace.g.dart';
|
||||
|
||||
@riverpod
|
||||
class MarketplaceWebFeedsNotifier extends _$MarketplaceWebFeedsNotifier
|
||||
with CursorPagingNotifierMixin<SnWebFeed> {
|
||||
String? _query;
|
||||
class MarketplaceWebFeedsNotifier extends AsyncNotifier<List<SnWebFeed>>
|
||||
with
|
||||
AsyncPaginationController<SnWebFeed>,
|
||||
AsyncPaginationFilter<String?, SnWebFeed> {
|
||||
@override
|
||||
String? currentFilter;
|
||||
|
||||
@override
|
||||
Future<CursorPagingData<SnWebFeed>> build({required String? query}) {
|
||||
_query = query;
|
||||
return fetch(cursor: null);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CursorPagingData<SnWebFeed>> fetch({required String? cursor}) async {
|
||||
Future<List<SnWebFeed>> fetch() async {
|
||||
final client = ref.read(apiClientProvider);
|
||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
||||
|
||||
final response = await client.get(
|
||||
'/sphere/feeds/explore',
|
||||
queryParameters: {
|
||||
'offset': offset,
|
||||
'offset': fetchedCount.toString(),
|
||||
'take': 20,
|
||||
if (_query != null && _query!.isNotEmpty) 'query': _query,
|
||||
if (currentFilter != null && currentFilter!.isNotEmpty)
|
||||
'query': currentFilter,
|
||||
},
|
||||
);
|
||||
|
||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
||||
final List<dynamic> data = response.data;
|
||||
final feeds = data.map((e) => SnWebFeed.fromJson(e)).toList();
|
||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||
final feeds =
|
||||
response.data
|
||||
.map((e) => SnWebFeed.fromJson(e))
|
||||
.cast<SnWebFeed>()
|
||||
.toList();
|
||||
|
||||
final hasMore = offset + feeds.length < total;
|
||||
final nextCursor = hasMore ? (offset + feeds.length).toString() : null;
|
||||
|
||||
return CursorPagingData(
|
||||
items: feeds,
|
||||
hasMore: hasMore,
|
||||
nextCursor: nextCursor,
|
||||
);
|
||||
return feeds;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,83 +79,70 @@ class MarketplaceWebFeedsScreen extends HookConsumerWidget {
|
||||
title: const Text('webFeeds').tr(),
|
||||
actions: const [Gap(8)],
|
||||
),
|
||||
body: PagingHelperView(
|
||||
provider: marketplaceWebFeedsNotifierProvider(query: query.value),
|
||||
futureRefreshable:
|
||||
marketplaceWebFeedsNotifierProvider(query: query.value).future,
|
||||
notifierRefreshable:
|
||||
marketplaceWebFeedsNotifierProvider(query: query.value).notifier,
|
||||
contentBuilder:
|
||||
(data, widgetCount, endItemView) => Column(
|
||||
children: [
|
||||
// Search bar above the list
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: SearchBar(
|
||||
elevation: WidgetStateProperty.all(4),
|
||||
controller: searchController,
|
||||
focusNode: focusNode,
|
||||
hintText: 'search'.tr(),
|
||||
leading: const Icon(Symbols.search),
|
||||
padding: WidgetStateProperty.all(
|
||||
const EdgeInsets.symmetric(horizontal: 24),
|
||||
),
|
||||
onTapOutside:
|
||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
trailing: [
|
||||
if (query.value != null && query.value!.isNotEmpty)
|
||||
IconButton(
|
||||
icon: const Icon(Symbols.close),
|
||||
onPressed: () {
|
||||
query.value = null;
|
||||
searchController.clear();
|
||||
focusNode.unfocus();
|
||||
},
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
// Debounce search to avoid excessive API calls
|
||||
debounceTimer.value?.cancel();
|
||||
debounceTimer.value = Timer(
|
||||
const Duration(milliseconds: 500),
|
||||
() {
|
||||
query.value = value.isEmpty ? null : value;
|
||||
},
|
||||
);
|
||||
},
|
||||
onSubmitted: (value) {
|
||||
query.value = value.isEmpty ? null : value;
|
||||
body: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: SearchBar(
|
||||
elevation: WidgetStateProperty.all(4),
|
||||
controller: searchController,
|
||||
focusNode: focusNode,
|
||||
hintText: 'search'.tr(),
|
||||
leading: const Icon(Symbols.search),
|
||||
padding: WidgetStateProperty.all(
|
||||
const EdgeInsets.symmetric(horizontal: 24),
|
||||
),
|
||||
onTapOutside:
|
||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
trailing: [
|
||||
if (query.value != null && query.value!.isNotEmpty)
|
||||
IconButton(
|
||||
icon: const Icon(Symbols.close),
|
||||
onPressed: () {
|
||||
query.value = null;
|
||||
searchController.clear();
|
||||
focusNode.unfocus();
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
itemCount: widgetCount,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == widgetCount - 1) {
|
||||
return endItemView;
|
||||
}
|
||||
|
||||
final feed = data.items[index];
|
||||
return ListTile(
|
||||
title: Text(feed.title),
|
||||
subtitle: Text(feed.description ?? ''),
|
||||
trailing: const Icon(Symbols.chevron_right),
|
||||
onTap: () {
|
||||
// Navigate to web feed detail page
|
||||
context.pushNamed(
|
||||
'webFeedDetail',
|
||||
pathParameters: {'feedId': feed.id},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
// Debounce search to avoid excessive API calls
|
||||
debounceTimer.value?.cancel();
|
||||
debounceTimer.value = Timer(
|
||||
const Duration(milliseconds: 500),
|
||||
() {
|
||||
query.value = value.isEmpty ? null : value;
|
||||
},
|
||||
);
|
||||
},
|
||||
onSubmitted: (value) {
|
||||
query.value = value.isEmpty ? null : value;
|
||||
focusNode.unfocus();
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: PaginationList(
|
||||
provider: marketplaceWebFeedsNotifierProvider,
|
||||
notifier: marketplaceWebFeedsNotifierProvider.notifier,
|
||||
padding: EdgeInsets.zero,
|
||||
itemBuilder: (context, index, feed) {
|
||||
return ListTile(
|
||||
title: Text(feed.title),
|
||||
subtitle: Text(feed.description ?? ''),
|
||||
trailing: const Icon(Symbols.chevron_right),
|
||||
onTap: () {
|
||||
// Navigate to web feed detail page
|
||||
context.pushNamed(
|
||||
'webFeedDetail',
|
||||
pathParameters: {'feedId': feed.id},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feed_marketplace.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$marketplaceWebFeedsNotifierHash() =>
|
||||
r'774b2985f2f7d61fe958f534f84e39f814327c4e';
|
||||
|
||||
/// 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 _$MarketplaceWebFeedsNotifier
|
||||
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnWebFeed>> {
|
||||
late final String? query;
|
||||
|
||||
FutureOr<CursorPagingData<SnWebFeed>> build({required String? query});
|
||||
}
|
||||
|
||||
/// See also [MarketplaceWebFeedsNotifier].
|
||||
@ProviderFor(MarketplaceWebFeedsNotifier)
|
||||
const marketplaceWebFeedsNotifierProvider = MarketplaceWebFeedsNotifierFamily();
|
||||
|
||||
/// See also [MarketplaceWebFeedsNotifier].
|
||||
class MarketplaceWebFeedsNotifierFamily
|
||||
extends Family<AsyncValue<CursorPagingData<SnWebFeed>>> {
|
||||
/// See also [MarketplaceWebFeedsNotifier].
|
||||
const MarketplaceWebFeedsNotifierFamily();
|
||||
|
||||
/// See also [MarketplaceWebFeedsNotifier].
|
||||
MarketplaceWebFeedsNotifierProvider call({required String? query}) {
|
||||
return MarketplaceWebFeedsNotifierProvider(query: query);
|
||||
}
|
||||
|
||||
@override
|
||||
MarketplaceWebFeedsNotifierProvider getProviderOverride(
|
||||
covariant MarketplaceWebFeedsNotifierProvider provider,
|
||||
) {
|
||||
return call(query: provider.query);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
||||
_allTransitiveDependencies;
|
||||
|
||||
@override
|
||||
String? get name => r'marketplaceWebFeedsNotifierProvider';
|
||||
}
|
||||
|
||||
/// See also [MarketplaceWebFeedsNotifier].
|
||||
class MarketplaceWebFeedsNotifierProvider
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderImpl<
|
||||
MarketplaceWebFeedsNotifier,
|
||||
CursorPagingData<SnWebFeed>
|
||||
> {
|
||||
/// See also [MarketplaceWebFeedsNotifier].
|
||||
MarketplaceWebFeedsNotifierProvider({required String? query})
|
||||
: this._internal(
|
||||
() => MarketplaceWebFeedsNotifier()..query = query,
|
||||
from: marketplaceWebFeedsNotifierProvider,
|
||||
name: r'marketplaceWebFeedsNotifierProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$marketplaceWebFeedsNotifierHash,
|
||||
dependencies: MarketplaceWebFeedsNotifierFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
MarketplaceWebFeedsNotifierFamily._allTransitiveDependencies,
|
||||
query: query,
|
||||
);
|
||||
|
||||
MarketplaceWebFeedsNotifierProvider._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
|
||||
FutureOr<CursorPagingData<SnWebFeed>> runNotifierBuild(
|
||||
covariant MarketplaceWebFeedsNotifier notifier,
|
||||
) {
|
||||
return notifier.build(query: query);
|
||||
}
|
||||
|
||||
@override
|
||||
Override overrideWith(MarketplaceWebFeedsNotifier Function() create) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: MarketplaceWebFeedsNotifierProvider._internal(
|
||||
() => create()..query = query,
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
debugGetCreateSourceHash: null,
|
||||
query: query,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeAsyncNotifierProviderElement<
|
||||
MarketplaceWebFeedsNotifier,
|
||||
CursorPagingData<SnWebFeed>
|
||||
>
|
||||
createElement() {
|
||||
return _MarketplaceWebFeedsNotifierProviderElement(this);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is MarketplaceWebFeedsNotifierProvider && other.query == query;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
||||
hash = _SystemHash.combine(hash, query.hashCode);
|
||||
|
||||
return _SystemHash.finish(hash);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
mixin MarketplaceWebFeedsNotifierRef
|
||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnWebFeed>> {
|
||||
/// The parameter `query` of this provider.
|
||||
String? get query;
|
||||
}
|
||||
|
||||
class _MarketplaceWebFeedsNotifierProviderElement
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderElement<
|
||||
MarketplaceWebFeedsNotifier,
|
||||
CursorPagingData<SnWebFeed>
|
||||
>
|
||||
with MarketplaceWebFeedsNotifierRef {
|
||||
_MarketplaceWebFeedsNotifierProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
String? get query => (origin as MarketplaceWebFeedsNotifierProvider).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
|
||||
Reference in New Issue
Block a user