♻️ Migrated to riverpod v3

This commit is contained in:
2025-12-06 13:00:30 +08:00
parent fd79c11d18
commit 9d03faf594
158 changed files with 6834 additions and 10357 deletions

View File

@@ -211,7 +211,7 @@ class IslandApp extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themeProvider); final theme = ref.watch(themeProvider);
final settings = ref.watch(appSettingsNotifierProvider); final settings = ref.watch(appSettingsProvider);
// Convert string theme mode to ThemeMode enum // Convert string theme mode to ThemeMode enum
ThemeMode getThemeMode() { ThemeMode getThemeMode() {

View File

@@ -330,13 +330,127 @@ class ServerState {
} }
} }
class ServerStateNotifier extends StateNotifier<ServerState> { class ServerStateNotifier extends Notifier<ServerState> {
final ActivityRpcServer server; late final ActivityRpcServer server;
final Dio apiClient; late final Dio apiClient;
Timer? _renewalTimer; Timer? _renewalTimer;
ServerStateNotifier(this.apiClient, this.server) @override
: super(ServerState(status: 'Server not started')); 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; String? get currentActivityManualId => state.currentActivityManualId;
@@ -408,119 +522,8 @@ class ServerStateNotifier extends StateNotifier<ServerState> {
const kPresenceActivityLease = 5; const kPresenceActivityLease = 5;
// Providers // Providers
final rpcServerStateProvider = StateNotifierProvider< final rpcServerStateProvider =
ServerStateNotifier, NotifierProvider<ServerStateNotifier, ServerState>(ServerStateNotifier.new);
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 rpcServerProvider = Provider<ActivityRpcServer>((ref) { final rpcServerProvider = Provider<ActivityRpcServer>((ref) {
final notifier = ref.watch(rpcServerStateProvider.notifier); final notifier = ref.watch(rpcServerStateProvider.notifier);

View File

@@ -6,152 +6,83 @@ part of 'activity_rpc.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$presenceActivitiesHash() => // GENERATED CODE - DO NOT MODIFY BY HAND
r'3bfaa638eeb961ecd62a32d6a7760a6a7e7bf6f2'; // 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) @ProviderFor(presenceActivities)
const presenceActivitiesProvider = PresenceActivitiesFamily(); const presenceActivitiesProvider = PresenceActivitiesFamily._();
/// See also [presenceActivities]. final class PresenceActivitiesProvider
class PresenceActivitiesFamily extends
extends Family<AsyncValue<List<SnPresenceActivity>>> { $FunctionalProvider<
/// See also [presenceActivities]. AsyncValue<List<SnPresenceActivity>>,
const PresenceActivitiesFamily(); List<SnPresenceActivity>,
FutureOr<List<SnPresenceActivity>>
/// See also [presenceActivities]. >
PresenceActivitiesProvider call(String uname) { with
return PresenceActivitiesProvider(uname); $FutureModifier<List<SnPresenceActivity>>,
} $FutureProvider<List<SnPresenceActivity>> {
const PresenceActivitiesProvider._({
@override required PresenceActivitiesFamily super.from,
PresenceActivitiesProvider getProviderOverride( required String super.argument,
covariant PresenceActivitiesProvider provider, }) : super(
) { retry: null,
return call(provider.uname);
}
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'presenceActivitiesProvider';
}
/// See also [presenceActivities].
class PresenceActivitiesProvider
extends AutoDisposeFutureProvider<List<SnPresenceActivity>> {
/// See also [presenceActivities].
PresenceActivitiesProvider(String uname)
: this._internal(
(ref) => presenceActivities(ref as PresenceActivitiesRef, uname),
from: presenceActivitiesProvider,
name: r'presenceActivitiesProvider', name: r'presenceActivitiesProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$presenceActivitiesHash();
FutureOr<List<SnPresenceActivity>> Function(PresenceActivitiesRef provider)
create, @override
) { String toString() {
return ProviderOverride( return r'presenceActivitiesProvider'
origin: this, ''
override: PresenceActivitiesProvider._internal( '($argument)';
(ref) => create(ref as PresenceActivitiesRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
uname: uname,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<SnPresenceActivity>> createElement() { $FutureProviderElement<List<SnPresenceActivity>> $createElement(
return _PresenceActivitiesProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnPresenceActivity>> create(Ref ref) {
final argument = this.argument as String;
return presenceActivities(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PresenceActivitiesProvider && other.uname == uname; return other is PresenceActivitiesProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, uname.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$presenceActivitiesHash() =>
// ignore: unused_element r'3bfaa638eeb961ecd62a32d6a7760a6a7e7bf6f2';
mixin PresenceActivitiesRef
on AutoDisposeFutureProviderRef<List<SnPresenceActivity>> {
/// The parameter `uname` of this provider.
String get uname;
}
class _PresenceActivitiesProviderElement final class PresenceActivitiesFamily extends $Family
extends AutoDisposeFutureProviderElement<List<SnPresenceActivity>> with $FunctionalFamilyOverride<FutureOr<List<SnPresenceActivity>>, String> {
with PresenceActivitiesRef { const PresenceActivitiesFamily._()
_PresenceActivitiesProviderElement(super.provider); : super(
retry: null,
name: r'presenceActivitiesProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
PresenceActivitiesProvider call(String uname) =>
PresenceActivitiesProvider._(argument: uname, from: this);
@override @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

View File

@@ -6,19 +6,58 @@ part of 'call.dart';
// RiverpodGenerator // 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<CallNotifier, CallState> {
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<CallState>(value),
);
}
}
String _$callNotifierHash() => r'ef4e3e9c9d411cf9dce1ceb456a3b866b2c87db3'; String _$callNotifierHash() => r'ef4e3e9c9d411cf9dce1ceb456a3b866b2c87db3';
/// See also [CallNotifier]. abstract class _$CallNotifier extends $Notifier<CallState> {
@ProviderFor(CallNotifier) CallState build();
final callNotifierProvider = NotifierProvider<CallNotifier, CallState>.internal( @$mustCallSuper
CallNotifier.new, @override
name: r'callNotifierProvider', void runBuild() {
debugGetCreateSourceHash: final created = build();
const bool.fromEnvironment('dart.vm.product') ? null : _$callNotifierHash, final ref = this.ref as $Ref<CallState, CallState>;
dependencies: null, final element =
allTransitiveDependencies: null, ref.element
); as $ClassProviderElement<
AnyNotifier<CallState, CallState>,
typedef _$CallNotifier = Notifier<CallState>; CallState,
// ignore_for_file: type=lint Object?,
// 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 Object?
>;
element.handleValue(ref, created);
}
}

View File

@@ -6,163 +6,97 @@ part of 'chat_online_count.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$chatOnlineCountNotifierHash() => // GENERATED CODE - DO NOT MODIFY BY HAND
r'19af8fd0e9f62c65e12a68215406776085235fa3'; // 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<int> {
late final String chatroomId;
FutureOr<int> build(String chatroomId);
}
/// See also [ChatOnlineCountNotifier].
@ProviderFor(ChatOnlineCountNotifier) @ProviderFor(ChatOnlineCountNotifier)
const chatOnlineCountNotifierProvider = ChatOnlineCountNotifierFamily(); const chatOnlineCountProvider = ChatOnlineCountNotifierFamily._();
/// See also [ChatOnlineCountNotifier]. final class ChatOnlineCountNotifierProvider
class ChatOnlineCountNotifierFamily extends Family<AsyncValue<int>> { extends $AsyncNotifierProvider<ChatOnlineCountNotifier, int> {
/// See also [ChatOnlineCountNotifier]. const ChatOnlineCountNotifierProvider._({
const ChatOnlineCountNotifierFamily(); required ChatOnlineCountNotifierFamily super.from,
required String super.argument,
/// See also [ChatOnlineCountNotifier]. }) : super(
ChatOnlineCountNotifierProvider call(String chatroomId) { retry: null,
return ChatOnlineCountNotifierProvider(chatroomId); name: r'chatOnlineCountProvider',
} isAutoDispose: true,
@override
ChatOnlineCountNotifierProvider getProviderOverride(
covariant ChatOnlineCountNotifierProvider provider,
) {
return call(provider.chatroomId);
}
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'chatOnlineCountNotifierProvider';
}
/// See also [ChatOnlineCountNotifier].
class ChatOnlineCountNotifierProvider
extends AutoDisposeAsyncNotifierProviderImpl<ChatOnlineCountNotifier, int> {
/// 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<int> 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, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
chatroomId: chatroomId,
),
); );
}
@override @override
AutoDisposeAsyncNotifierProviderElement<ChatOnlineCountNotifier, int> String debugGetCreateSourceHash() => _$chatOnlineCountNotifierHash();
createElement() {
return _ChatOnlineCountNotifierProviderElement(this); @override
String toString() {
return r'chatOnlineCountProvider'
''
'($argument)';
} }
@$internal
@override
ChatOnlineCountNotifier create() => ChatOnlineCountNotifier();
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is ChatOnlineCountNotifierProvider && return other is ChatOnlineCountNotifierProvider &&
other.chatroomId == chatroomId; other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, chatroomId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$chatOnlineCountNotifierHash() =>
// ignore: unused_element r'19af8fd0e9f62c65e12a68215406776085235fa3';
mixin ChatOnlineCountNotifierRef on AutoDisposeAsyncNotifierProviderRef<int> {
/// The parameter `chatroomId` of this provider.
String get chatroomId;
}
class _ChatOnlineCountNotifierProviderElement final class ChatOnlineCountNotifierFamily extends $Family
extends with
AutoDisposeAsyncNotifierProviderElement<ChatOnlineCountNotifier, int> $ClassFamilyOverride<
with ChatOnlineCountNotifierRef { ChatOnlineCountNotifier,
_ChatOnlineCountNotifierProviderElement(super.provider); AsyncValue<int>,
int,
FutureOr<int>,
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 @override
String get chatroomId => String toString() => r'chatOnlineCountProvider';
(origin as ChatOnlineCountNotifierProvider).chatroomId;
} }
// ignore_for_file: type=lint abstract class _$ChatOnlineCountNotifier extends $AsyncNotifier<int> {
// 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 late final _$args = ref.$arg as String;
String get chatroomId => _$args;
FutureOr<int> build(String chatroomId);
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref = this.ref as $Ref<AsyncValue<int>, int>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<AsyncValue<int>, int>,
AsyncValue<int>,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}

View File

@@ -11,9 +11,32 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'chat_room.g.dart'; part 'chat_room.g.dart';
final isSyncingProvider = StateProvider.autoDispose<bool>((ref) => false); final chatSyncingProvider = NotifierProvider<ChatSyncingNotifier, bool>(
ChatSyncingNotifier.new,
);
final flashingMessagesProvider = StateProvider<Set<String>>((ref) => {}); class ChatSyncingNotifier extends Notifier<bool> {
@override
bool build() => false;
void set(bool value) => state = value;
}
final flashingMessagesProvider =
NotifierProvider<FlashingMessagesNotifier, Set<String>>(
FlashingMessagesNotifier.new,
);
class FlashingMessagesNotifier extends Notifier<Set<String>> {
@override
Set<String> build() => {};
void update(Set<String> Function(Set<String>) cb) {
state = cb(state);
}
void clear() => state = {};
}
@riverpod @riverpod
class ChatRoomJoinedNotifier extends _$ChatRoomJoinedNotifier { class ChatRoomJoinedNotifier extends _$ChatRoomJoinedNotifier {

View File

@@ -6,350 +6,277 @@ part of 'chat_room.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$chatroomInvitesHash() => r'5cd6391b09c5517ede19bacce43b45c8d71dd087'; // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
/// See also [chatroomInvites]. @ProviderFor(ChatRoomJoinedNotifier)
@ProviderFor(chatroomInvites) const chatRoomJoinedProvider = ChatRoomJoinedNotifierProvider._();
final chatroomInvitesProvider =
AutoDisposeFutureProvider<List<SnChatMember>>.internal( final class ChatRoomJoinedNotifierProvider
chatroomInvites, extends $AsyncNotifierProvider<ChatRoomJoinedNotifier, List<SnChatRoom>> {
name: r'chatroomInvitesProvider', const ChatRoomJoinedNotifierProvider._()
debugGetCreateSourceHash: : super(
const bool.fromEnvironment('dart.vm.product') from: null,
? null argument: null,
: _$chatroomInvitesHash, retry: null,
name: r'chatRoomJoinedProvider',
isAutoDispose: true,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
); );
@Deprecated('Will be removed in 3.0. Use Ref instead') @override
// ignore: unused_element String debugGetCreateSourceHash() => _$chatRoomJoinedNotifierHash();
typedef ChatroomInvitesRef = AutoDisposeFutureProviderRef<List<SnChatMember>>;
@$internal
@override
ChatRoomJoinedNotifier create() => ChatRoomJoinedNotifier();
}
String _$chatRoomJoinedNotifierHash() => String _$chatRoomJoinedNotifierHash() =>
r'c8092225ba0d9c08b2b5bca6f800f1877303b4ff'; r'c8092225ba0d9c08b2b5bca6f800f1877303b4ff';
/// See also [ChatRoomJoinedNotifier]. abstract class _$ChatRoomJoinedNotifier
@ProviderFor(ChatRoomJoinedNotifier) extends $AsyncNotifier<List<SnChatRoom>> {
final chatRoomJoinedNotifierProvider = AutoDisposeAsyncNotifierProvider< FutureOr<List<SnChatRoom>> build();
ChatRoomJoinedNotifier, @$mustCallSuper
List<SnChatRoom> @override
>.internal( void runBuild() {
ChatRoomJoinedNotifier.new, final created = build();
name: r'chatRoomJoinedNotifierProvider', final ref =
debugGetCreateSourceHash: this.ref as $Ref<AsyncValue<List<SnChatRoom>>, List<SnChatRoom>>;
const bool.fromEnvironment('dart.vm.product') final element =
? null ref.element
: _$chatRoomJoinedNotifierHash, as $ClassProviderElement<
dependencies: null, AnyNotifier<AsyncValue<List<SnChatRoom>>, List<SnChatRoom>>,
allTransitiveDependencies: null, AsyncValue<List<SnChatRoom>>,
); Object?,
Object?
typedef _$ChatRoomJoinedNotifier = AutoDisposeAsyncNotifier<List<SnChatRoom>>; >;
String _$chatRoomNotifierHash() => r'1e6391e2ab4eeb114fa001aaa6b06ab2bd646f38'; element.handleValue(ref, created);
/// 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 _$ChatRoomNotifier
extends BuildlessAutoDisposeAsyncNotifier<SnChatRoom?> {
late final String? identifier;
FutureOr<SnChatRoom?> build(String? identifier);
}
/// See also [ChatRoomNotifier].
@ProviderFor(ChatRoomNotifier) @ProviderFor(ChatRoomNotifier)
const chatRoomNotifierProvider = ChatRoomNotifierFamily(); const chatRoomProvider = ChatRoomNotifierFamily._();
/// See also [ChatRoomNotifier]. final class ChatRoomNotifierProvider
class ChatRoomNotifierFamily extends Family<AsyncValue<SnChatRoom?>> { extends $AsyncNotifierProvider<ChatRoomNotifier, SnChatRoom?> {
/// See also [ChatRoomNotifier]. const ChatRoomNotifierProvider._({
const ChatRoomNotifierFamily(); required ChatRoomNotifierFamily super.from,
required String? super.argument,
/// See also [ChatRoomNotifier]. }) : super(
ChatRoomNotifierProvider call(String? identifier) { retry: null,
return ChatRoomNotifierProvider(identifier); name: r'chatRoomProvider',
} isAutoDispose: true,
@override
ChatRoomNotifierProvider getProviderOverride(
covariant ChatRoomNotifierProvider provider,
) {
return call(provider.identifier);
}
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'chatRoomNotifierProvider';
}
/// See also [ChatRoomNotifier].
class ChatRoomNotifierProvider
extends
AutoDisposeAsyncNotifierProviderImpl<ChatRoomNotifier, SnChatRoom?> {
/// 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<SnChatRoom?> 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, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
identifier: identifier,
),
); );
}
@override @override
AutoDisposeAsyncNotifierProviderElement<ChatRoomNotifier, SnChatRoom?> String debugGetCreateSourceHash() => _$chatRoomNotifierHash();
createElement() {
return _ChatRoomNotifierProviderElement(this); @override
String toString() {
return r'chatRoomProvider'
''
'($argument)';
} }
@$internal
@override
ChatRoomNotifier create() => ChatRoomNotifier();
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is ChatRoomNotifierProvider && other.identifier == identifier; return other is ChatRoomNotifierProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, identifier.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$chatRoomNotifierHash() => r'1e6391e2ab4eeb114fa001aaa6b06ab2bd646f38';
// ignore: unused_element
mixin ChatRoomNotifierRef on AutoDisposeAsyncNotifierProviderRef<SnChatRoom?> {
/// The parameter `identifier` of this provider.
String? get identifier;
}
class _ChatRoomNotifierProviderElement final class ChatRoomNotifierFamily extends $Family
extends with
AutoDisposeAsyncNotifierProviderElement<ChatRoomNotifier, SnChatRoom?> $ClassFamilyOverride<
with ChatRoomNotifierRef { ChatRoomNotifier,
_ChatRoomNotifierProviderElement(super.provider); AsyncValue<SnChatRoom?>,
SnChatRoom?,
FutureOr<SnChatRoom?>,
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 @override
String? get identifier => (origin as ChatRoomNotifierProvider).identifier; String toString() => r'chatRoomProvider';
}
abstract class _$ChatRoomNotifier extends $AsyncNotifier<SnChatRoom?> {
late final _$args = ref.$arg as String?;
String? get identifier => _$args;
FutureOr<SnChatRoom?> build(String? identifier);
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref = this.ref as $Ref<AsyncValue<SnChatRoom?>, SnChatRoom?>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<AsyncValue<SnChatRoom?>, SnChatRoom?>,
AsyncValue<SnChatRoom?>,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}
@ProviderFor(ChatRoomIdentityNotifier)
const chatRoomIdentityProvider = ChatRoomIdentityNotifierFamily._();
final class ChatRoomIdentityNotifierProvider
extends $AsyncNotifierProvider<ChatRoomIdentityNotifier, SnChatMember?> {
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() => String _$chatRoomIdentityNotifierHash() =>
r'27c17d55366d39be81d7209837e5c01f80a68a24'; r'27c17d55366d39be81d7209837e5c01f80a68a24';
final class ChatRoomIdentityNotifierFamily extends $Family
with
$ClassFamilyOverride<
ChatRoomIdentityNotifier,
AsyncValue<SnChatMember?>,
SnChatMember?,
FutureOr<SnChatMember?>,
String?
> {
const ChatRoomIdentityNotifierFamily._()
: super(
retry: null,
name: r'chatRoomIdentityProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
ChatRoomIdentityNotifierProvider call(String? identifier) =>
ChatRoomIdentityNotifierProvider._(argument: identifier, from: this);
@override
String toString() => r'chatRoomIdentityProvider';
}
abstract class _$ChatRoomIdentityNotifier abstract class _$ChatRoomIdentityNotifier
extends BuildlessAutoDisposeAsyncNotifier<SnChatMember?> { extends $AsyncNotifier<SnChatMember?> {
late final String? identifier; late final _$args = ref.$arg as String?;
String? get identifier => _$args;
FutureOr<SnChatMember?> build(String? identifier); FutureOr<SnChatMember?> build(String? identifier);
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref = this.ref as $Ref<AsyncValue<SnChatMember?>, SnChatMember?>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<AsyncValue<SnChatMember?>, SnChatMember?>,
AsyncValue<SnChatMember?>,
Object?,
Object?
>;
element.handleValue(ref, created);
}
} }
/// See also [ChatRoomIdentityNotifier]. @ProviderFor(chatroomInvites)
@ProviderFor(ChatRoomIdentityNotifier) const chatroomInvitesProvider = ChatroomInvitesProvider._();
const chatRoomIdentityNotifierProvider = ChatRoomIdentityNotifierFamily();
/// See also [ChatRoomIdentityNotifier]. final class ChatroomInvitesProvider
class ChatRoomIdentityNotifierFamily extends Family<AsyncValue<SnChatMember?>> {
/// 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<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'chatRoomIdentityNotifierProvider';
}
/// See also [ChatRoomIdentityNotifier].
class ChatRoomIdentityNotifierProvider
extends extends
AutoDisposeAsyncNotifierProviderImpl< $FunctionalProvider<
ChatRoomIdentityNotifier, AsyncValue<List<SnChatMember>>,
SnChatMember? List<SnChatMember>,
> { FutureOr<List<SnChatMember>>
/// See also [ChatRoomIdentityNotifier]. >
ChatRoomIdentityNotifierProvider(String? identifier) with
: this._internal( $FutureModifier<List<SnChatMember>>,
() => ChatRoomIdentityNotifier()..identifier = identifier, $FutureProvider<List<SnChatMember>> {
from: chatRoomIdentityNotifierProvider, const ChatroomInvitesProvider._()
name: r'chatRoomIdentityNotifierProvider', : super(
debugGetCreateSourceHash: from: null,
const bool.fromEnvironment('dart.vm.product') argument: null,
? null retry: null,
: _$chatRoomIdentityNotifierHash, name: r'chatroomInvitesProvider',
dependencies: ChatRoomIdentityNotifierFamily._dependencies, isAutoDispose: true,
allTransitiveDependencies:
ChatRoomIdentityNotifierFamily._allTransitiveDependencies,
identifier: identifier,
);
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;
@override
FutureOr<SnChatMember?> runNotifierBuild(
covariant ChatRoomIdentityNotifier notifier,
) {
return notifier.build(identifier);
}
@override
Override overrideWith(ChatRoomIdentityNotifier Function() create) {
return ProviderOverride(
origin: this,
override: ChatRoomIdentityNotifierProvider._internal(
() => create()..identifier = identifier,
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
identifier: identifier,
),
); );
}
@override @override
AutoDisposeAsyncNotifierProviderElement< String debugGetCreateSourceHash() => _$chatroomInvitesHash();
ChatRoomIdentityNotifier,
SnChatMember? @$internal
> @override
createElement() { $FutureProviderElement<List<SnChatMember>> $createElement(
return _ChatRoomIdentityNotifierProviderElement(this); $ProviderPointer pointer,
} ) => $FutureProviderElement(pointer);
@override @override
bool operator ==(Object other) { FutureOr<List<SnChatMember>> create(Ref ref) {
return other is ChatRoomIdentityNotifierProvider && return chatroomInvites(ref);
other.identifier == identifier;
}
@override
int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode);
hash = _SystemHash.combine(hash, identifier.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$chatroomInvitesHash() => r'5cd6391b09c5517ede19bacce43b45c8d71dd087';
// ignore: unused_element
mixin ChatRoomIdentityNotifierRef
on AutoDisposeAsyncNotifierProviderRef<SnChatMember?> {
/// The parameter `identifier` of this provider.
String? get identifier;
}
class _ChatRoomIdentityNotifierProviderElement
extends
AutoDisposeAsyncNotifierProviderElement<
ChatRoomIdentityNotifier,
SnChatMember?
>
with ChatRoomIdentityNotifierRef {
_ChatRoomIdentityNotifierProviderElement(super.provider);
@override
String? get identifier =>
(origin as ChatRoomIdentityNotifierProvider).identifier;
}
// 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

View File

@@ -12,7 +12,17 @@ import "package:riverpod_annotation/riverpod_annotation.dart";
part 'chat_subscribe.g.dart'; part 'chat_subscribe.g.dart';
final currentSubscribedChatIdProvider = StateProvider<String?>((ref) => null); final currentSubscribedChatIdProvider =
NotifierProvider<CurrentSubscribedChatIdNotifier, String?>(
CurrentSubscribedChatIdNotifier.new,
);
class CurrentSubscribedChatIdNotifier extends Notifier<String?> {
@override
String? build() => null;
void set(String? value) => state = value;
}
@riverpod @riverpod
class ChatSubscribeNotifier extends _$ChatSubscribeNotifier { class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
@@ -29,11 +39,9 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
@override @override
List<SnChatMember> build(String roomId) { List<SnChatMember> build(String roomId) {
final ws = ref.watch(websocketProvider); final ws = ref.watch(websocketProvider);
final chatRoomAsync = ref.watch(ChatRoomNotifierProvider(roomId)); final chatRoomAsync = ref.watch(chatRoomProvider(roomId));
final chatIdentityAsync = ref.watch( final chatIdentityAsync = ref.watch(chatRoomIdentityProvider(roomId));
ChatRoomIdentityNotifierProvider(roomId), _messagesNotifier = ref.watch(messagesProvider(roomId).notifier);
);
_messagesNotifier = ref.watch(messagesNotifierProvider(roomId).notifier);
if (chatRoomAsync.isLoading || chatIdentityAsync.isLoading) { if (chatRoomAsync.isLoading || chatIdentityAsync.isLoading) {
return []; return [];
@@ -59,7 +67,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
); );
Future.microtask( Future.microtask(
() => ref.read(currentSubscribedChatIdProvider.notifier).state = roomId, () => ref.read(currentSubscribedChatIdProvider.notifier).set(roomId),
); );
// Send initial read receipt // Send initial read receipt
@@ -130,7 +138,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
// Cleanup on dispose // Cleanup on dispose
ref.onDispose(() { ref.onDispose(() {
ref.read(currentSubscribedChatIdProvider.notifier).state = null; ref.read(currentSubscribedChatIdProvider.notifier).set(null);
wsState.sendMessage( wsState.sendMessage(
jsonEncode( jsonEncode(
WebSocketPacket( WebSocketPacket(

View File

@@ -6,171 +6,104 @@ part of 'chat_subscribe.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$chatSubscribeNotifierHash() => // GENERATED CODE - DO NOT MODIFY BY HAND
r'beec1ddf2e13f6d5af8a08c2c81eff740ae9b986'; // 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<List<SnChatMember>> {
late final String roomId;
List<SnChatMember> build(String roomId);
}
/// See also [ChatSubscribeNotifier].
@ProviderFor(ChatSubscribeNotifier) @ProviderFor(ChatSubscribeNotifier)
const chatSubscribeNotifierProvider = ChatSubscribeNotifierFamily(); const chatSubscribeProvider = ChatSubscribeNotifierFamily._();
/// See also [ChatSubscribeNotifier]. final class ChatSubscribeNotifierProvider
class ChatSubscribeNotifierFamily extends Family<List<SnChatMember>> { extends $NotifierProvider<ChatSubscribeNotifier, List<SnChatMember>> {
/// See also [ChatSubscribeNotifier]. const ChatSubscribeNotifierProvider._({
const ChatSubscribeNotifierFamily(); required ChatSubscribeNotifierFamily super.from,
required String super.argument,
/// See also [ChatSubscribeNotifier]. }) : super(
ChatSubscribeNotifierProvider call(String roomId) { retry: null,
return ChatSubscribeNotifierProvider(roomId); name: r'chatSubscribeProvider',
} isAutoDispose: true,
@override
ChatSubscribeNotifierProvider getProviderOverride(
covariant ChatSubscribeNotifierProvider provider,
) {
return call(provider.roomId);
}
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'chatSubscribeNotifierProvider';
}
/// See also [ChatSubscribeNotifier].
class ChatSubscribeNotifierProvider
extends
AutoDisposeNotifierProviderImpl<
ChatSubscribeNotifier,
List<SnChatMember>
> {
/// 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<SnChatMember> runNotifierBuild(
covariant ChatSubscribeNotifier notifier,
) {
return notifier.build(roomId);
}
@override
Override overrideWith(ChatSubscribeNotifier Function() create) {
return ProviderOverride(
origin: this,
override: ChatSubscribeNotifierProvider._internal(
() => create()..roomId = roomId,
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
roomId: roomId,
),
); );
}
@override @override
AutoDisposeNotifierProviderElement<ChatSubscribeNotifier, List<SnChatMember>> String debugGetCreateSourceHash() => _$chatSubscribeNotifierHash();
createElement() {
return _ChatSubscribeNotifierProviderElement(this); @override
String toString() {
return r'chatSubscribeProvider'
''
'($argument)';
}
@$internal
@override
ChatSubscribeNotifier create() => ChatSubscribeNotifier();
/// {@macro riverpod.override_with_value}
Override overrideWithValue(List<SnChatMember> value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<List<SnChatMember>>(value),
);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is ChatSubscribeNotifierProvider && other.roomId == roomId; return other is ChatSubscribeNotifierProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, roomId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$chatSubscribeNotifierHash() =>
// ignore: unused_element r'2b9fae96eb1f96a514a074985e5efa1c13d10aa4';
mixin ChatSubscribeNotifierRef
on AutoDisposeNotifierProviderRef<List<SnChatMember>> {
/// The parameter `roomId` of this provider.
String get roomId;
}
class _ChatSubscribeNotifierProviderElement final class ChatSubscribeNotifierFamily extends $Family
extends with
AutoDisposeNotifierProviderElement< $ClassFamilyOverride<
ChatSubscribeNotifier, ChatSubscribeNotifier,
List<SnChatMember> List<SnChatMember>,
> List<SnChatMember>,
with ChatSubscribeNotifierRef { List<SnChatMember>,
_ChatSubscribeNotifierProviderElement(super.provider); 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 @override
String get roomId => (origin as ChatSubscribeNotifierProvider).roomId; String toString() => r'chatSubscribeProvider';
} }
// ignore_for_file: type=lint abstract class _$ChatSubscribeNotifier extends $Notifier<List<SnChatMember>> {
// 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 late final _$args = ref.$arg as String;
String get roomId => _$args;
List<SnChatMember> build(String roomId);
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref = this.ref as $Ref<List<SnChatMember>, List<SnChatMember>>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<List<SnChatMember>, List<SnChatMember>>,
List<SnChatMember>,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}

View File

@@ -99,7 +99,7 @@ class ChatSummary extends _$ChatSummary {
final unreadToDecrement = summary.unreadCount; final unreadToDecrement = summary.unreadCount;
if (unreadToDecrement > 0) { if (unreadToDecrement > 0) {
ref ref
.read(chatUnreadCountNotifierProvider.notifier) .read(chatUnreadCountProvider.notifier)
.decrement(unreadToDecrement); .decrement(unreadToDecrement);
} }

View File

@@ -6,40 +6,105 @@ part of 'chat_summary.dart';
// RiverpodGenerator // 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<ChatUnreadCountNotifier, int> {
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() => String _$chatUnreadCountNotifierHash() =>
r'b8d93589dc37f772d4c3a07d9afd81c37026e57d'; r'b8d93589dc37f772d4c3a07d9afd81c37026e57d';
/// See also [ChatUnreadCountNotifier]. abstract class _$ChatUnreadCountNotifier extends $AsyncNotifier<int> {
@ProviderFor(ChatUnreadCountNotifier) FutureOr<int> build();
final chatUnreadCountNotifierProvider = @$mustCallSuper
AutoDisposeAsyncNotifierProvider<ChatUnreadCountNotifier, int>.internal( @override
ChatUnreadCountNotifier.new, void runBuild() {
name: r'chatUnreadCountNotifierProvider', final created = build();
debugGetCreateSourceHash: final ref = this.ref as $Ref<AsyncValue<int>, int>;
const bool.fromEnvironment('dart.vm.product') final element =
? null ref.element
: _$chatUnreadCountNotifierHash, as $ClassProviderElement<
dependencies: null, AnyNotifier<AsyncValue<int>, int>,
allTransitiveDependencies: null, AsyncValue<int>,
); Object?,
Object?
>;
element.handleValue(ref, created);
}
}
typedef _$ChatUnreadCountNotifier = AutoDisposeAsyncNotifier<int>;
String _$chatSummaryHash() => r'78d927d40cded9d7adbc20bd6f457fdf3c852632';
/// See also [ChatSummary].
@ProviderFor(ChatSummary) @ProviderFor(ChatSummary)
final chatSummaryProvider = const chatSummaryProvider = ChatSummaryProvider._();
AsyncNotifierProvider<ChatSummary, Map<String, SnChatSummary>>.internal(
ChatSummary.new, final class ChatSummaryProvider
extends $AsyncNotifierProvider<ChatSummary, Map<String, SnChatSummary>> {
const ChatSummaryProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'chatSummaryProvider', name: r'chatSummaryProvider',
debugGetCreateSourceHash: isAutoDispose: false,
const bool.fromEnvironment('dart.vm.product')
? null
: _$chatSummaryHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
); );
typedef _$ChatSummary = AsyncNotifier<Map<String, SnChatSummary>>; @override
// ignore_for_file: type=lint String debugGetCreateSourceHash() => _$chatSummaryHash();
// 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
@$internal
@override
ChatSummary create() => ChatSummary();
}
String _$chatSummaryHash() => r'dfa5e487586482ebdafef8d711f74db68ee86f84';
abstract class _$ChatSummary
extends $AsyncNotifier<Map<String, SnChatSummary>> {
FutureOr<Map<String, SnChatSummary>> build();
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref =
this.ref
as $Ref<
AsyncValue<Map<String, SnChatSummary>>,
Map<String, SnChatSummary>
>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<
AsyncValue<Map<String, SnChatSummary>>,
Map<String, SnChatSummary>
>,
AsyncValue<Map<String, SnChatSummary>>,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}

View File

@@ -52,10 +52,8 @@ class MessagesNotifier extends _$MessagesNotifier {
FutureOr<List<LocalChatMessage>> build(String roomId) async { FutureOr<List<LocalChatMessage>> build(String roomId) async {
_apiClient = ref.watch(apiClientProvider); _apiClient = ref.watch(apiClientProvider);
_database = ref.watch(databaseProvider); _database = ref.watch(databaseProvider);
final room = await ref.watch(ChatRoomNotifierProvider(roomId).future); final room = await ref.watch(chatRoomProvider(roomId).future);
final identity = await ref.watch( final identity = await ref.watch(chatRoomIdentityProvider(roomId).future);
ChatRoomIdentityNotifierProvider(roomId).future,
);
// Initialize fetch account method for corrupted data recovery // Initialize fetch account method for corrupted data recovery
_fetchAccount = (String accountId) async { _fetchAccount = (String accountId) async {
@@ -321,7 +319,7 @@ class MessagesNotifier extends _$MessagesNotifier {
_allRemoteMessagesFetched = false; _allRemoteMessagesFetched = false;
talker.log('Starting message sync'); talker.log('Starting message sync');
Future.microtask(() => ref.read(isSyncingProvider.notifier).state = true); Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true));
try { try {
final dbMessages = await _database.getMessagesForRoom( final dbMessages = await _database.getMessagesForRoom(
_room.id, _room.id,
@@ -397,9 +395,7 @@ class MessagesNotifier extends _$MessagesNotifier {
showErrorAlert(err); showErrorAlert(err);
} finally { } finally {
talker.log('Finished message sync'); talker.log('Finished message sync');
Future.microtask( Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false));
() => ref.read(isSyncingProvider.notifier).state = false,
);
_isSyncing = false; _isSyncing = false;
} }
} }
@@ -496,7 +492,7 @@ class MessagesNotifier extends _$MessagesNotifier {
if (!_hasMore || state is AsyncLoading) return; if (!_hasMore || state is AsyncLoading) return;
talker.log('Loading more messages'); talker.log('Loading more messages');
Future.microtask(() => ref.read(isSyncingProvider.notifier).state = true); Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true));
try { try {
final currentMessages = state.value ?? []; final currentMessages = state.value ?? [];
final offset = currentMessages.length; final offset = currentMessages.length;
@@ -519,9 +515,7 @@ class MessagesNotifier extends _$MessagesNotifier {
); );
showErrorAlert(err); showErrorAlert(err);
} finally { } finally {
Future.microtask( Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false));
() => ref.read(isSyncingProvider.notifier).state = false,
);
} }
} }

View File

@@ -6,174 +6,101 @@ part of 'messages_notifier.dart';
// RiverpodGenerator // 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<List<LocalChatMessage>> {
late final String roomId;
FutureOr<List<LocalChatMessage>> build(String roomId);
}
/// See also [MessagesNotifier].
@ProviderFor(MessagesNotifier) @ProviderFor(MessagesNotifier)
const messagesNotifierProvider = MessagesNotifierFamily(); const messagesProvider = MessagesNotifierFamily._();
/// See also [MessagesNotifier]. final class MessagesNotifierProvider
class MessagesNotifierFamily extends $AsyncNotifierProvider<MessagesNotifier, List<LocalChatMessage>> {
extends Family<AsyncValue<List<LocalChatMessage>>> { const MessagesNotifierProvider._({
/// See also [MessagesNotifier]. required MessagesNotifierFamily super.from,
const MessagesNotifierFamily(); required String super.argument,
}) : super(
/// See also [MessagesNotifier]. retry: null,
MessagesNotifierProvider call(String roomId) { name: r'messagesProvider',
return MessagesNotifierProvider(roomId); isAutoDispose: true,
}
@override
MessagesNotifierProvider getProviderOverride(
covariant MessagesNotifierProvider provider,
) {
return call(provider.roomId);
}
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'messagesNotifierProvider';
}
/// See also [MessagesNotifier].
class MessagesNotifierProvider
extends
AutoDisposeAsyncNotifierProviderImpl<
MessagesNotifier,
List<LocalChatMessage>
> {
/// 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<List<LocalChatMessage>> 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, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
roomId: roomId,
),
); );
}
@override @override
AutoDisposeAsyncNotifierProviderElement< String debugGetCreateSourceHash() => _$messagesNotifierHash();
MessagesNotifier,
List<LocalChatMessage> @override
> String toString() {
createElement() { return r'messagesProvider'
return _MessagesNotifierProviderElement(this); ''
'($argument)';
} }
@$internal
@override
MessagesNotifier create() => MessagesNotifier();
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is MessagesNotifierProvider && other.roomId == roomId; return other is MessagesNotifierProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, roomId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$messagesNotifierHash() => r'2f3f19cb99357184e82d66e74a31863fcfc48856';
// ignore: unused_element
mixin MessagesNotifierRef
on AutoDisposeAsyncNotifierProviderRef<List<LocalChatMessage>> {
/// The parameter `roomId` of this provider.
String get roomId;
}
class _MessagesNotifierProviderElement final class MessagesNotifierFamily extends $Family
extends with
AutoDisposeAsyncNotifierProviderElement< $ClassFamilyOverride<
MessagesNotifier, MessagesNotifier,
List<LocalChatMessage> AsyncValue<List<LocalChatMessage>>,
> List<LocalChatMessage>,
with MessagesNotifierRef { FutureOr<List<LocalChatMessage>>,
_MessagesNotifierProviderElement(super.provider); 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 @override
String get roomId => (origin as MessagesNotifierProvider).roomId; String toString() => r'messagesProvider';
} }
// ignore_for_file: type=lint abstract class _$MessagesNotifier
// 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 extends $AsyncNotifier<List<LocalChatMessage>> {
late final _$args = ref.$arg as String;
String get roomId => _$args;
FutureOr<List<LocalChatMessage>> build(String roomId);
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref =
this.ref
as $Ref<AsyncValue<List<LocalChatMessage>>, List<LocalChatMessage>>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<
AsyncValue<List<LocalChatMessage>>,
List<LocalChatMessage>
>,
AsyncValue<List<LocalChatMessage>>,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}

View File

@@ -294,12 +294,15 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
} }
final updateInfoProvider = final updateInfoProvider =
StateNotifierProvider<UpdateInfoNotifier, (String?, String?)>((ref) { NotifierProvider<UpdateInfoNotifier, (String?, String?)>(
return UpdateInfoNotifier(); UpdateInfoNotifier.new,
}); );
class UpdateInfoNotifier extends StateNotifier<(String?, String?)> { class UpdateInfoNotifier extends Notifier<(String?, String?)> {
UpdateInfoNotifier() : super((null, null)); @override
(String?, String?) build() {
return (null, null);
}
void setUpdate(String newVersion, String newChangelog) { void setUpdate(String newVersion, String newChangelog) {
state = (newVersion, newChangelog); state = (newVersion, newChangelog);

View File

@@ -29,23 +29,59 @@ Map<String, dynamic> _$ThemeColorsToJson(_ThemeColors instance) =>
// RiverpodGenerator // 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<AppSettingsNotifier, AppSettings> {
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<AppSettings>(value),
);
}
}
String _$appSettingsNotifierHash() => String _$appSettingsNotifierHash() =>
r'22b695f2023e3251db3296858acd701f7211d757'; r'22b695f2023e3251db3296858acd701f7211d757';
/// See also [AppSettingsNotifier]. abstract class _$AppSettingsNotifier extends $Notifier<AppSettings> {
@ProviderFor(AppSettingsNotifier) AppSettings build();
final appSettingsNotifierProvider = @$mustCallSuper
AutoDisposeNotifierProvider<AppSettingsNotifier, AppSettings>.internal( @override
AppSettingsNotifier.new, void runBuild() {
name: r'appSettingsNotifierProvider', final created = build();
debugGetCreateSourceHash: final ref = this.ref as $Ref<AppSettings, AppSettings>;
const bool.fromEnvironment('dart.vm.product') final element =
? null ref.element
: _$appSettingsNotifierHash, as $ClassProviderElement<
dependencies: null, AnyNotifier<AppSettings, AppSettings>,
allTransitiveDependencies: null, AppSettings,
); Object?,
Object?
typedef _$AppSettingsNotifier = AutoDisposeNotifier<AppSettings>; >;
// ignore_for_file: type=lint element.handleValue(ref, created);
// 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 }
}

View File

@@ -1,4 +1,3 @@
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/models/activity.dart'; import 'package:island/models/activity.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';

View File

@@ -6,169 +6,99 @@ part of 'event_calendar.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$eventCalendarHash() => r'3a33581c28bcd44bc5eb3abdb770171b4d275a5d'; // 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));
}
}
/// Provider for fetching event calendar data /// Provider for fetching event calendar data
/// This can be used anywhere in the app where calendar data is needed /// This can be used anywhere in the app where calendar data is needed
///
/// Copied from [eventCalendar].
@ProviderFor(eventCalendar) @ProviderFor(eventCalendar)
const eventCalendarProvider = EventCalendarFamily(); const eventCalendarProvider = EventCalendarFamily._();
/// Provider for fetching event calendar data /// Provider for fetching event calendar data
/// This can be used anywhere in the app where calendar data is needed /// This can be used anywhere in the app where calendar data is needed
///
/// Copied from [eventCalendar]. final class EventCalendarProvider
class EventCalendarFamily extends
extends Family<AsyncValue<List<SnEventCalendarEntry>>> { $FunctionalProvider<
AsyncValue<List<SnEventCalendarEntry>>,
List<SnEventCalendarEntry>,
FutureOr<List<SnEventCalendarEntry>>
>
with
$FutureModifier<List<SnEventCalendarEntry>>,
$FutureProvider<List<SnEventCalendarEntry>> {
/// Provider for fetching event calendar data /// Provider for fetching event calendar data
/// This can be used anywhere in the app where calendar data is needed /// This can be used anywhere in the app where calendar data is needed
/// const EventCalendarProvider._({
/// Copied from [eventCalendar]. required EventCalendarFamily super.from,
const EventCalendarFamily(); required EventCalendarQuery super.argument,
}) : super(
/// Provider for fetching event calendar data retry: null,
/// This can be used anywhere in the app where calendar data is needed
///
/// Copied from [eventCalendar].
EventCalendarProvider call(EventCalendarQuery query) {
return EventCalendarProvider(query);
}
@override
EventCalendarProvider getProviderOverride(
covariant EventCalendarProvider provider,
) {
return call(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'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<List<SnEventCalendarEntry>> {
/// 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', name: r'eventCalendarProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$eventCalendarHash();
FutureOr<List<SnEventCalendarEntry>> Function(EventCalendarRef provider)
create, @override
) { String toString() {
return ProviderOverride( return r'eventCalendarProvider'
origin: this, ''
override: EventCalendarProvider._internal( '($argument)';
(ref) => create(ref as EventCalendarRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
query: query,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<SnEventCalendarEntry>> createElement() { $FutureProviderElement<List<SnEventCalendarEntry>> $createElement(
return _EventCalendarProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnEventCalendarEntry>> create(Ref ref) {
final argument = this.argument as EventCalendarQuery;
return eventCalendar(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is EventCalendarProvider && other.query == query; return other is EventCalendarProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, query.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$eventCalendarHash() => r'3a33581c28bcd44bc5eb3abdb770171b4d275a5d';
// ignore: unused_element
mixin EventCalendarRef
on AutoDisposeFutureProviderRef<List<SnEventCalendarEntry>> {
/// The parameter `query` of this provider.
EventCalendarQuery get query;
}
class _EventCalendarProviderElement /// Provider for fetching event calendar data
extends AutoDisposeFutureProviderElement<List<SnEventCalendarEntry>> /// This can be used anywhere in the app where calendar data is needed
with EventCalendarRef {
_EventCalendarProviderElement(super.provider); final class EventCalendarFamily extends $Family
with
$FunctionalFamilyOverride<
FutureOr<List<SnEventCalendarEntry>>,
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 @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

View File

@@ -14,7 +14,7 @@ Future<Map<String, dynamic>?> billingUsage(Ref ref) async {
return response.data; return response.data;
} }
final indexedCloudFileListNotifierProvider = AsyncNotifierProvider( final indexedCloudFileListProvider = AsyncNotifierProvider(
IndexedCloudFileListNotifier.new, IndexedCloudFileListNotifier.new,
); );
@@ -92,7 +92,7 @@ class IndexedCloudFileListNotifier extends AsyncNotifier<List<FileListItem>>
} }
} }
final unindexedFileListNotifierProvider = AsyncNotifierProvider( final unindexedFileListProvider = AsyncNotifierProvider(
UnindexedFileListNotifier.new, UnindexedFileListNotifier.new,
); );

View File

@@ -6,43 +6,87 @@ part of 'file_list.dart';
// RiverpodGenerator // 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<String, dynamic>?>,
Map<String, dynamic>?,
FutureOr<Map<String, dynamic>?>
>
with
$FutureModifier<Map<String, dynamic>?>,
$FutureProvider<Map<String, dynamic>?> {
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<Map<String, dynamic>?> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<Map<String, dynamic>?> create(Ref ref) {
return billingUsage(ref);
}
}
String _$billingUsageHash() => r'58d8bc774868d60781574c85d6b25869a79c57aa'; String _$billingUsageHash() => r'58d8bc774868d60781574c85d6b25869a79c57aa';
/// See also [billingUsage].
@ProviderFor(billingUsage)
final billingUsageProvider =
AutoDisposeFutureProvider<Map<String, dynamic>?>.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<Map<String, dynamic>?>;
String _$billingQuotaHash() => r'4ec5d728e439015800abb2d0d673b5a7329cc654';
/// See also [billingQuota].
@ProviderFor(billingQuota) @ProviderFor(billingQuota)
final billingQuotaProvider = const billingQuotaProvider = BillingQuotaProvider._();
AutoDisposeFutureProvider<Map<String, dynamic>?>.internal(
billingQuota, final class BillingQuotaProvider
extends
$FunctionalProvider<
AsyncValue<Map<String, dynamic>?>,
Map<String, dynamic>?,
FutureOr<Map<String, dynamic>?>
>
with
$FutureModifier<Map<String, dynamic>?>,
$FutureProvider<Map<String, dynamic>?> {
const BillingQuotaProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'billingQuotaProvider', name: r'billingQuotaProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product')
? null
: _$billingQuotaHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
); );
@Deprecated('Will be removed in 3.0. Use Ref instead') @override
// ignore: unused_element String debugGetCreateSourceHash() => _$billingQuotaHash();
typedef BillingQuotaRef = AutoDisposeFutureProviderRef<Map<String, dynamic>?>;
// ignore_for_file: type=lint @$internal
// 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 @override
$FutureProviderElement<Map<String, dynamic>?> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<Map<String, dynamic>?> create(Ref ref) {
return billingQuota(ref);
}
}
String _$billingQuotaHash() => r'4ec5d728e439015800abb2d0d673b5a7329cc654';

View File

@@ -13,7 +13,7 @@ final poolsProvider = FutureProvider<List<SnFilePool>>((ref) async {
}); });
String? resolveDefaultPoolId(WidgetRef ref, List<SnFilePool> pools) { String? resolveDefaultPoolId(WidgetRef ref, List<SnFilePool> pools) {
final settings = ref.watch(appSettingsNotifierProvider); final settings = ref.watch(appSettingsProvider);
final configuredId = settings.defaultPoolId; final configuredId = settings.defaultPoolId;
if (configuredId != null && pools.any((p) => p.id == configuredId)) { if (configuredId != null && pools.any((p) => p.id == configuredId)) {

View File

@@ -1,4 +1,3 @@
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:island/models/reference.dart'; import 'package:island/models/reference.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';

View File

@@ -6,148 +6,80 @@ part of 'file_references.dart';
// RiverpodGenerator // 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) @ProviderFor(fileReferences)
const fileReferencesProvider = FileReferencesFamily(); const fileReferencesProvider = FileReferencesFamily._();
/// See also [fileReferences]. final class FileReferencesProvider
class FileReferencesFamily extends Family<AsyncValue<List<Reference>>> { extends
/// See also [fileReferences]. $FunctionalProvider<
const FileReferencesFamily(); AsyncValue<List<Reference>>,
List<Reference>,
/// See also [fileReferences]. FutureOr<List<Reference>>
FileReferencesProvider call(String fileId) { >
return FileReferencesProvider(fileId); with $FutureModifier<List<Reference>>, $FutureProvider<List<Reference>> {
} const FileReferencesProvider._({
required FileReferencesFamily super.from,
@override required String super.argument,
FileReferencesProvider getProviderOverride( }) : super(
covariant FileReferencesProvider provider, retry: null,
) {
return call(provider.fileId);
}
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'fileReferencesProvider';
}
/// See also [fileReferences].
class FileReferencesProvider
extends AutoDisposeFutureProvider<List<Reference>> {
/// See also [fileReferences].
FileReferencesProvider(String fileId)
: this._internal(
(ref) => fileReferences(ref as FileReferencesRef, fileId),
from: fileReferencesProvider,
name: r'fileReferencesProvider', name: r'fileReferencesProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$fileReferencesHash();
FutureOr<List<Reference>> Function(FileReferencesRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'fileReferencesProvider'
override: FileReferencesProvider._internal( ''
(ref) => create(ref as FileReferencesRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
fileId: fileId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<Reference>> createElement() { $FutureProviderElement<List<Reference>> $createElement(
return _FileReferencesProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<Reference>> create(Ref ref) {
final argument = this.argument as String;
return fileReferences(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is FileReferencesProvider && other.fileId == fileId; return other is FileReferencesProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, fileId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$fileReferencesHash() => r'd66c678c221f61978bdb242b98e6dbe31d0c204b';
// ignore: unused_element
mixin FileReferencesRef on AutoDisposeFutureProviderRef<List<Reference>> {
/// The parameter `fileId` of this provider.
String get fileId;
}
class _FileReferencesProviderElement final class FileReferencesFamily extends $Family
extends AutoDisposeFutureProviderElement<List<Reference>> with $FunctionalFamilyOverride<FutureOr<List<Reference>>, String> {
with FileReferencesRef { const FileReferencesFamily._()
_FileReferencesProviderElement(super.provider); : super(
retry: null,
name: r'fileReferencesProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
FileReferencesProvider call(String fileId) =>
FileReferencesProvider._(argument: fileId, from: this);
@override @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

View File

@@ -6,159 +6,95 @@ part of 'link_preview.dart';
// RiverpodGenerator // 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<SnScrappedLink?> {
late final String url;
FutureOr<SnScrappedLink?> build(String url);
}
/// See also [LinkPreview].
@ProviderFor(LinkPreview) @ProviderFor(LinkPreview)
const linkPreviewProvider = LinkPreviewFamily(); const linkPreviewProvider = LinkPreviewFamily._();
/// See also [LinkPreview]. final class LinkPreviewProvider
class LinkPreviewFamily extends Family<AsyncValue<SnScrappedLink?>> { extends $AsyncNotifierProvider<LinkPreview, SnScrappedLink?> {
/// See also [LinkPreview]. const LinkPreviewProvider._({
const LinkPreviewFamily(); required LinkPreviewFamily super.from,
required String super.argument,
/// See also [LinkPreview]. }) : super(
LinkPreviewProvider call(String url) { retry: null,
return LinkPreviewProvider(url);
}
@override
LinkPreviewProvider getProviderOverride(
covariant LinkPreviewProvider provider,
) {
return call(provider.url);
}
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'linkPreviewProvider';
}
/// See also [LinkPreview].
class LinkPreviewProvider
extends AutoDisposeAsyncNotifierProviderImpl<LinkPreview, SnScrappedLink?> {
/// See also [LinkPreview].
LinkPreviewProvider(String url)
: this._internal(
() => LinkPreview()..url = url,
from: linkPreviewProvider,
name: r'linkPreviewProvider', name: r'linkPreviewProvider',
debugGetCreateSourceHash: isAutoDispose: true,
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<SnScrappedLink?> 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, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
url: url,
),
); );
}
@override @override
AutoDisposeAsyncNotifierProviderElement<LinkPreview, SnScrappedLink?> String debugGetCreateSourceHash() => _$linkPreviewHash();
createElement() {
return _LinkPreviewProviderElement(this); @override
String toString() {
return r'linkPreviewProvider'
''
'($argument)';
} }
@$internal
@override
LinkPreview create() => LinkPreview();
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is LinkPreviewProvider && other.url == url; return other is LinkPreviewProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, url.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$linkPreviewHash() => r'5130593d3066155cb958d20714ee577df1f940d7';
// ignore: unused_element
mixin LinkPreviewRef on AutoDisposeAsyncNotifierProviderRef<SnScrappedLink?> {
/// The parameter `url` of this provider.
String get url;
}
class _LinkPreviewProviderElement final class LinkPreviewFamily extends $Family
extends with
AutoDisposeAsyncNotifierProviderElement<LinkPreview, SnScrappedLink?> $ClassFamilyOverride<
with LinkPreviewRef { LinkPreview,
_LinkPreviewProviderElement(super.provider); AsyncValue<SnScrappedLink?>,
SnScrappedLink?,
FutureOr<SnScrappedLink?>,
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 @override
String get url => (origin as LinkPreviewProvider).url; String toString() => r'linkPreviewProvider';
} }
// ignore_for_file: type=lint abstract class _$LinkPreview extends $AsyncNotifier<SnScrappedLink?> {
// 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 late final _$args = ref.$arg as String;
String get url => _$args;
FutureOr<SnScrappedLink?> build(String url);
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref = this.ref as $Ref<AsyncValue<SnScrappedLink?>, SnScrappedLink?>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<AsyncValue<SnScrappedLink?>, SnScrappedLink?>,
AsyncValue<SnScrappedLink?>,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}

View File

@@ -54,89 +54,7 @@ mixin AsyncPaginationController<T> on AsyncNotifier<List<T>>
final newState = await AsyncValue.guard<List<T>>(() async { final newState = await AsyncValue.guard<List<T>>(() async {
final elements = await fetch(); final elements = await fetch();
return [...?state.valueOrNull, ...elements]; return [...?state.value, ...elements];
});
state = newState;
}
}
mixin AutoDisposeAsyncPaginationController<T>
on AutoDisposeAsyncNotifier<List<T>>
implements PaginationController<T> {
@override
int? totalCount;
@override
int get fetchedCount => state.value?.length ?? 0;
@override
bool get fetchedAll => totalCount != null && fetchedCount >= totalCount!;
@override
FutureOr<List<T>> build() async => fetch();
@override
Future<void> refresh() async {
totalCount = null;
state = AsyncData<List<T>>([]);
final newState = await AsyncValue.guard<List<T>>(() async {
return await fetch();
});
state = newState;
}
@override
Future<void> fetchFurther() async {
if (fetchedAll) return;
state = AsyncLoading<List<T>>();
final newState = await AsyncValue.guard<List<T>>(() async {
final elements = await fetch();
return [...?state.valueOrNull, ...elements];
});
state = newState;
}
}
mixin FamilyAsyncPaginationController<T, Arg>
on AutoDisposeFamilyAsyncNotifier<List<T>, Arg>
implements PaginationController<T> {
@override
int? totalCount;
@override
int get fetchedCount => state.value?.length ?? 0;
@override
bool get fetchedAll => totalCount != null && fetchedCount >= totalCount!;
@override
FutureOr<List<T>> build(Arg arg) async => fetch();
@override
Future<void> refresh() async {
totalCount = null;
state = AsyncData<List<T>>([]);
final newState = await AsyncValue.guard<List<T>>(() async {
return await fetch();
});
state = newState;
}
@override
Future<void> fetchFurther() async {
if (fetchedAll) return;
state = AsyncLoading<List<T>>();
final newState = await AsyncValue.guard<List<T>>(() async {
final elements = await fetch();
return [...?state.valueOrNull, ...elements];
}); });
state = newState; state = newState;

View File

@@ -55,16 +55,12 @@ Future<String> siteFileContentRaw(
return resp.data is String ? resp.data : resp.data['content'] as String; return resp.data is String ? resp.data : resp.data['content'] as String;
} }
class SiteFilesNotifier class SiteFilesNotifier extends AsyncNotifier<List<SnSiteFileEntry>> {
extends final ({String siteId, String? path}) arg;
AutoDisposeFamilyAsyncNotifier< SiteFilesNotifier(this.arg);
List<SnSiteFileEntry>,
({String siteId, String? path})
> {
@override @override
Future<List<SnSiteFileEntry>> build( Future<List<SnSiteFileEntry>> build() async {
({String siteId, String? path}) arg,
) async {
return fetchFiles(); return fetchFiles();
} }
@@ -152,8 +148,6 @@ class SiteFilesNotifier
} }
} }
final siteFilesNotifierProvider = AsyncNotifierProvider.autoDispose.family< final siteFilesNotifierProvider = AsyncNotifierProvider.autoDispose.family(
SiteFilesNotifier, SiteFilesNotifier.new,
List<SnSiteFileEntry>, );
({String siteId, String? path})
>(SiteFilesNotifier.new);

View File

@@ -6,446 +6,257 @@ part of 'site_files.dart';
// RiverpodGenerator // 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) @ProviderFor(siteFiles)
const siteFilesProvider = SiteFilesFamily(); const siteFilesProvider = SiteFilesFamily._();
/// See also [siteFiles]. final class SiteFilesProvider
class SiteFilesFamily extends Family<AsyncValue<List<SnSiteFileEntry>>> { extends
/// See also [siteFiles]. $FunctionalProvider<
const SiteFilesFamily(); AsyncValue<List<SnSiteFileEntry>>,
List<SnSiteFileEntry>,
/// See also [siteFiles]. FutureOr<List<SnSiteFileEntry>>
SiteFilesProvider call({required String siteId, String? path}) { >
return SiteFilesProvider(siteId: siteId, path: path); with
} $FutureModifier<List<SnSiteFileEntry>>,
$FutureProvider<List<SnSiteFileEntry>> {
@override const SiteFilesProvider._({
SiteFilesProvider getProviderOverride(covariant SiteFilesProvider provider) { required SiteFilesFamily super.from,
return call(siteId: provider.siteId, path: provider.path); required ({String siteId, String? path}) super.argument,
} }) : super(
retry: null,
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'siteFilesProvider';
}
/// See also [siteFiles].
class SiteFilesProvider
extends AutoDisposeFutureProvider<List<SnSiteFileEntry>> {
/// 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', name: r'siteFilesProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$siteFilesHash();
FutureOr<List<SnSiteFileEntry>> Function(SiteFilesRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'siteFilesProvider'
override: SiteFilesProvider._internal( ''
(ref) => create(ref as SiteFilesRef), '$argument';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
siteId: siteId,
path: path,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<SnSiteFileEntry>> createElement() { $FutureProviderElement<List<SnSiteFileEntry>> $createElement(
return _SiteFilesProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnSiteFileEntry>> create(Ref ref) {
final argument = this.argument as ({String siteId, String? path});
return siteFiles(ref, siteId: argument.siteId, path: argument.path);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is SiteFilesProvider && return other is SiteFilesProvider && other.argument == argument;
other.siteId == siteId &&
other.path == path;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, siteId.hashCode);
hash = _SystemHash.combine(hash, path.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$siteFilesHash() => r'd4029e6c160edcd454eb39ef1c19427b7f95a8d8';
// ignore: unused_element
mixin SiteFilesRef on AutoDisposeFutureProviderRef<List<SnSiteFileEntry>> {
/// The parameter `siteId` of this provider.
String get siteId;
/// The parameter `path` of this provider. final class SiteFilesFamily extends $Family
String? get path; with
$FunctionalFamilyOverride<
FutureOr<List<SnSiteFileEntry>>,
({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 @ProviderFor(siteFileContent)
extends AutoDisposeFutureProviderElement<List<SnSiteFileEntry>> const siteFileContentProvider = SiteFileContentFamily._();
with SiteFilesRef {
_SiteFilesProviderElement(super.provider); final class SiteFileContentProvider
extends
$FunctionalProvider<
AsyncValue<SnFileContent>,
SnFileContent,
FutureOr<SnFileContent>
>
with $FutureModifier<SnFileContent>, $FutureProvider<SnFileContent> {
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 @override
String get siteId => (origin as SiteFilesProvider).siteId; String debugGetCreateSourceHash() => _$siteFileContentHash();
@override @override
String? get path => (origin as SiteFilesProvider).path; String toString() {
return r'siteFileContentProvider'
''
'$argument';
}
@$internal
@override
$FutureProviderElement<SnFileContent> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnFileContent> 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'; String _$siteFileContentHash() => r'b594ad4f8c54555e742ece94ee001092cb2f83d1';
/// See also [siteFileContent]. final class SiteFileContentFamily extends $Family
@ProviderFor(siteFileContent) with
const siteFileContentProvider = SiteFileContentFamily(); $FunctionalFamilyOverride<
FutureOr<SnFileContent>,
({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<AsyncValue<SnFileContent>> {
/// See also [siteFileContent].
const SiteFileContentFamily();
/// See also [siteFileContent].
SiteFileContentProvider call({ SiteFileContentProvider call({
required String siteId, required String siteId,
required String relativePath, required String relativePath,
}) { }) => SiteFileContentProvider._(
return SiteFileContentProvider(siteId: siteId, relativePath: relativePath); argument: (siteId: siteId, relativePath: relativePath),
} from: this,
);
@override @override
SiteFileContentProvider getProviderOverride( String toString() => r'siteFileContentProvider';
covariant SiteFileContentProvider provider,
) {
return call(siteId: provider.siteId, relativePath: provider.relativePath);
}
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'siteFileContentProvider';
} }
/// See also [siteFileContent]. @ProviderFor(siteFileContentRaw)
class SiteFileContentProvider extends AutoDisposeFutureProvider<SnFileContent> { const siteFileContentRawProvider = SiteFileContentRawFamily._();
/// See also [siteFileContent].
SiteFileContentProvider({ final class SiteFileContentRawProvider
required String siteId, extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
required String relativePath, with $FutureModifier<String>, $FutureProvider<String> {
}) : this._internal( const SiteFileContentRawProvider._({
(ref) => siteFileContent( required SiteFileContentRawFamily super.from,
ref as SiteFileContentRef, required ({String siteId, String relativePath}) super.argument,
siteId: siteId, }) : super(
relativePath: relativePath, retry: null,
), name: r'siteFileContentRawProvider',
from: siteFileContentProvider, isAutoDispose: true,
name: r'siteFileContentProvider', dependencies: null,
debugGetCreateSourceHash: $allTransitiveDependencies: null,
const bool.fromEnvironment('dart.vm.product')
? null
: _$siteFileContentHash,
dependencies: SiteFileContentFamily._dependencies,
allTransitiveDependencies:
SiteFileContentFamily._allTransitiveDependencies,
siteId: siteId,
relativePath: relativePath,
); );
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 @override
Override overrideWith( String debugGetCreateSourceHash() => _$siteFileContentRawHash();
FutureOr<SnFileContent> Function(SiteFileContentRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'siteFileContentRawProvider'
override: SiteFileContentProvider._internal( ''
(ref) => create(ref as SiteFileContentRef), '$argument';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
siteId: siteId,
relativePath: relativePath,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnFileContent> createElement() { $FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
return _SiteFileContentProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<String> create(Ref ref) {
final argument = this.argument as ({String siteId, String relativePath});
return siteFileContentRaw(
ref,
siteId: argument.siteId,
relativePath: argument.relativePath,
);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is SiteFileContentProvider && return other is SiteFileContentRawProvider && other.argument == argument;
other.siteId == siteId &&
other.relativePath == relativePath;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.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 SiteFileContentRef on AutoDisposeFutureProviderRef<SnFileContent> {
/// The parameter `siteId` of this provider.
String get siteId;
/// The parameter `relativePath` of this provider.
String get relativePath;
}
class _SiteFileContentProviderElement
extends AutoDisposeFutureProviderElement<SnFileContent>
with SiteFileContentRef {
_SiteFileContentProviderElement(super.provider);
@override
String get siteId => (origin as SiteFileContentProvider).siteId;
@override
String get relativePath => (origin as SiteFileContentProvider).relativePath;
}
String _$siteFileContentRawHash() => String _$siteFileContentRawHash() =>
r'd0331c30698a9f4b90fe9b79273ff5914fa46616'; r'd0331c30698a9f4b90fe9b79273ff5914fa46616';
/// See also [siteFileContentRaw]. final class SiteFileContentRawFamily extends $Family
@ProviderFor(siteFileContentRaw) with
const siteFileContentRawProvider = SiteFileContentRawFamily(); $FunctionalFamilyOverride<
FutureOr<String>,
({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<AsyncValue<String>> {
/// See also [siteFileContentRaw].
const SiteFileContentRawFamily();
/// See also [siteFileContentRaw].
SiteFileContentRawProvider call({ SiteFileContentRawProvider call({
required String siteId, required String siteId,
required String relativePath, required String relativePath,
}) { }) => SiteFileContentRawProvider._(
return SiteFileContentRawProvider( argument: (siteId: siteId, relativePath: relativePath),
siteId: siteId, from: this,
relativePath: relativePath,
);
}
@override
SiteFileContentRawProvider getProviderOverride(
covariant SiteFileContentRawProvider provider,
) {
return call(siteId: provider.siteId, relativePath: provider.relativePath);
}
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'siteFileContentRawProvider';
}
/// See also [siteFileContentRaw].
class SiteFileContentRawProvider extends AutoDisposeFutureProvider<String> {
/// 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
Override overrideWith( String toString() => r'siteFileContentRawProvider';
FutureOr<String> 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<String> 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<String> {
/// The parameter `siteId` of this provider.
String get siteId;
/// The parameter `relativePath` of this provider.
String get relativePath;
}
class _SiteFileContentRawProviderElement
extends AutoDisposeFutureProviderElement<String>
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

View File

@@ -25,16 +25,12 @@ Future<SnPublicationPage> sitePage(Ref ref, String pageId) async {
return SnPublicationPage.fromJson(resp.data); return SnPublicationPage.fromJson(resp.data);
} }
class SitePagesNotifier class SitePagesNotifier extends AsyncNotifier<List<SnPublicationPage>> {
extends final ({String pubName, String siteSlug}) arg;
AutoDisposeFamilyAsyncNotifier< SitePagesNotifier(this.arg);
List<SnPublicationPage>,
({String pubName, String siteSlug})
> {
@override @override
Future<List<SnPublicationPage>> build( Future<List<SnPublicationPage>> build() async {
({String pubName, String siteSlug}) arg,
) async {
return fetchPages(); return fetchPages();
} }

View File

@@ -6,275 +6,163 @@ part of 'site_pages.dart';
// RiverpodGenerator // 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) @ProviderFor(sitePages)
const sitePagesProvider = SitePagesFamily(); const sitePagesProvider = SitePagesFamily._();
/// See also [sitePages]. final class SitePagesProvider
class SitePagesFamily extends Family<AsyncValue<List<SnPublicationPage>>> { extends
/// See also [sitePages]. $FunctionalProvider<
const SitePagesFamily(); AsyncValue<List<SnPublicationPage>>,
List<SnPublicationPage>,
/// See also [sitePages]. FutureOr<List<SnPublicationPage>>
SitePagesProvider call(String pubName, String siteSlug) { >
return SitePagesProvider(pubName, siteSlug); with
} $FutureModifier<List<SnPublicationPage>>,
$FutureProvider<List<SnPublicationPage>> {
@override const SitePagesProvider._({
SitePagesProvider getProviderOverride(covariant SitePagesProvider provider) { required SitePagesFamily super.from,
return call(provider.pubName, provider.siteSlug); required (String, String) super.argument,
} }) : super(
retry: null,
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'sitePagesProvider';
}
/// See also [sitePages].
class SitePagesProvider
extends AutoDisposeFutureProvider<List<SnPublicationPage>> {
/// See also [sitePages].
SitePagesProvider(String pubName, String siteSlug)
: this._internal(
(ref) => sitePages(ref as SitePagesRef, pubName, siteSlug),
from: sitePagesProvider,
name: r'sitePagesProvider', name: r'sitePagesProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$sitePagesHash();
FutureOr<List<SnPublicationPage>> Function(SitePagesRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'sitePagesProvider'
override: SitePagesProvider._internal( ''
(ref) => create(ref as SitePagesRef), '$argument';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
pubName: pubName,
siteSlug: siteSlug,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<SnPublicationPage>> createElement() { $FutureProviderElement<List<SnPublicationPage>> $createElement(
return _SitePagesProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnPublicationPage>> create(Ref ref) {
final argument = this.argument as (String, String);
return sitePages(ref, argument.$1, argument.$2);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is SitePagesProvider && return other is SitePagesProvider && other.argument == argument;
other.pubName == pubName &&
other.siteSlug == siteSlug;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, pubName.hashCode);
hash = _SystemHash.combine(hash, siteSlug.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$sitePagesHash() => r'5e084e9694ad665e9b238c6a747c6c6e99c5eb03';
// ignore: unused_element
mixin SitePagesRef on AutoDisposeFutureProviderRef<List<SnPublicationPage>> {
/// The parameter `pubName` of this provider.
String get pubName;
/// The parameter `siteSlug` of this provider. final class SitePagesFamily extends $Family
String get siteSlug; with
$FunctionalFamilyOverride<
FutureOr<List<SnPublicationPage>>,
(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 @ProviderFor(sitePage)
extends AutoDisposeFutureProviderElement<List<SnPublicationPage>> const sitePageProvider = SitePageFamily._();
with SitePagesRef {
_SitePagesProviderElement(super.provider); final class SitePageProvider
extends
$FunctionalProvider<
AsyncValue<SnPublicationPage>,
SnPublicationPage,
FutureOr<SnPublicationPage>
>
with
$FutureModifier<SnPublicationPage>,
$FutureProvider<SnPublicationPage> {
const SitePageProvider._({
required SitePageFamily super.from,
required String super.argument,
}) : super(
retry: null,
name: r'sitePageProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override @override
String get pubName => (origin as SitePagesProvider).pubName; String debugGetCreateSourceHash() => _$sitePageHash();
@override @override
String get siteSlug => (origin as SitePagesProvider).siteSlug; String toString() {
return r'sitePageProvider'
''
'($argument)';
}
@$internal
@override
$FutureProviderElement<SnPublicationPage> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnPublicationPage> 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'; String _$sitePageHash() => r'542f70c5b103fe34d7cf7eb0821d52f017022efc';
/// See also [sitePage]. final class SitePageFamily extends $Family
@ProviderFor(sitePage) with $FunctionalFamilyOverride<FutureOr<SnPublicationPage>, String> {
const sitePageProvider = SitePageFamily(); const SitePageFamily._()
: super(
/// See also [sitePage]. retry: null,
class SitePageFamily extends Family<AsyncValue<SnPublicationPage>> {
/// 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<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'sitePageProvider';
}
/// See also [sitePage].
class SitePageProvider extends AutoDisposeFutureProvider<SnPublicationPage> {
/// See also [sitePage].
SitePageProvider(String pageId)
: this._internal(
(ref) => sitePage(ref as SitePageRef, pageId),
from: sitePageProvider,
name: r'sitePageProvider', name: r'sitePageProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$sitePageHash,
dependencies: SitePageFamily._dependencies,
allTransitiveDependencies: SitePageFamily._allTransitiveDependencies,
pageId: pageId,
);
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;
@override
Override overrideWith(
FutureOr<SnPublicationPage> Function(SitePageRef provider) create,
) {
return ProviderOverride(
origin: this,
override: SitePageProvider._internal(
(ref) => create(ref as SitePageRef),
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
pageId: pageId,
),
); );
}
SitePageProvider call(String pageId) =>
SitePageProvider._(argument: pageId, from: this);
@override @override
AutoDisposeFutureProviderElement<SnPublicationPage> createElement() { String toString() => r'sitePageProvider';
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);
}
} }
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin SitePageRef on AutoDisposeFutureProviderRef<SnPublicationPage> {
/// The parameter `pageId` of this provider.
String get pageId;
}
class _SitePageProviderElement
extends AutoDisposeFutureProviderElement<SnPublicationPage>
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

View File

@@ -4,16 +4,12 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:island/models/publication_site.dart'; import 'package:island/models/publication_site.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
class SiteNotifier class SiteNotifier extends AsyncNotifier<SnPublicationSite> {
extends final ({String pubName, String? siteId}) arg;
AutoDisposeFamilyAsyncNotifier< SiteNotifier(this.arg);
SnPublicationSite,
({String pubName, String? siteId})
> {
@override @override
FutureOr<SnPublicationSite> build( FutureOr<SnPublicationSite> build() async {
({String pubName, String? siteId}) arg,
) async {
if (arg.siteId == null || arg.siteId!.isEmpty) { if (arg.siteId == null || arg.siteId!.isEmpty) {
return SnPublicationSite( return SnPublicationSite(
id: '', id: '',

View File

@@ -1,13 +1,12 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:island/pods/config.dart'; import 'package:island/pods/config.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'theme.g.dart'; part 'theme.g.dart';
@riverpod @riverpod
ThemeSet theme(Ref ref) { ThemeSet theme(Ref ref) {
final settings = ref.watch(appSettingsNotifierProvider); final settings = ref.watch(appSettingsProvider);
return createAppThemeSet(settings); return createAppThemeSet(settings);
} }

View File

@@ -6,21 +6,46 @@ part of 'theme.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$themeHash() => r'a12dbf8b83d75713b7ae4c68e9cdd1a1cc3a35f0'; // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
/// See also [theme].
@ProviderFor(theme) @ProviderFor(theme)
final themeProvider = AutoDisposeProvider<ThemeSet>.internal( const themeProvider = ThemeProvider._();
theme,
name: r'themeProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$themeHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead') final class ThemeProvider
// ignore: unused_element extends $FunctionalProvider<ThemeSet, ThemeSet, ThemeSet>
typedef ThemeRef = AutoDisposeProviderRef<ThemeSet>; with $Provider<ThemeSet> {
// ignore_for_file: type=lint const ThemeProvider._()
// 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 : super(
from: null,
argument: null,
retry: null,
name: r'themeProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$themeHash();
@$internal
@override
$ProviderElement<ThemeSet> $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<ThemeSet>(value),
);
}
}
String _$themeHash() => r'5b41b68e2fc59431bb195ff75f63383982f7730f';

View File

@@ -4,7 +4,7 @@ import 'package:island/models/activity.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
import 'package:island/pods/paging.dart'; import 'package:island/pods/paging.dart';
final activityListNotifierProvider = final activityListProvider =
AsyncNotifierProvider<ActivityListNotifier, List<SnTimelineEvent>>( AsyncNotifierProvider<ActivityListNotifier, List<SnTimelineEvent>>(
ActivityListNotifier.new, ActivityListNotifier.new,
); );
@@ -22,8 +22,7 @@ class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
Future<List<SnTimelineEvent>> fetch() async { Future<List<SnTimelineEvent>> fetch() async {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);
final cursor = final cursor = state.value?.lastOrNull?.createdAt.toUtc().toIso8601String();
state.valueOrNull?.lastOrNull?.createdAt.toUtc().toIso8601String();
final queryParameters = { final queryParameters = {
if (cursor != null) 'cursor': cursor, if (cursor != null) 'cursor': cursor,
@@ -46,15 +45,13 @@ class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
final hasMore = (items.firstOrNull?.type ?? 'empty') != 'empty'; final hasMore = (items.firstOrNull?.type ?? 'empty') != 'empty';
totalCount = totalCount =
(state.valueOrNull?.length ?? 0) + (state.value?.length ?? 0) + items.length + (hasMore ? pageSize : 0);
items.length +
(hasMore ? pageSize : 0);
return items; return items;
} }
void updateOne(int index, SnTimelineEvent activity) { void updateOne(int index, SnTimelineEvent activity) {
final currentState = state.valueOrNull; final currentState = state.value;
if (currentState == null) return; if (currentState == null) return;
final updatedItems = [...currentState]; final updatedItems = [...currentState];

View File

@@ -1,7 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';

View File

@@ -6,269 +6,152 @@ part of 'translate.dart';
// RiverpodGenerator // 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) @ProviderFor(translateString)
const translateStringProvider = TranslateStringFamily(); const translateStringProvider = TranslateStringFamily._();
/// See also [translateString]. final class TranslateStringProvider
class TranslateStringFamily extends Family<AsyncValue<String>> { extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
/// See also [translateString]. with $FutureModifier<String>, $FutureProvider<String> {
const TranslateStringFamily(); const TranslateStringProvider._({
required TranslateStringFamily super.from,
/// See also [translateString]. required TranslateQuery super.argument,
TranslateStringProvider call(TranslateQuery query) { }) : super(
return TranslateStringProvider(query); retry: null,
}
@override
TranslateStringProvider getProviderOverride(
covariant TranslateStringProvider provider,
) {
return call(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'translateStringProvider';
}
/// See also [translateString].
class TranslateStringProvider extends AutoDisposeFutureProvider<String> {
/// See also [translateString].
TranslateStringProvider(TranslateQuery query)
: this._internal(
(ref) => translateString(ref as TranslateStringRef, query),
from: translateStringProvider,
name: r'translateStringProvider', name: r'translateStringProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$translateStringHash();
FutureOr<String> Function(TranslateStringRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'translateStringProvider'
override: TranslateStringProvider._internal( ''
(ref) => create(ref as TranslateStringRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
query: query,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<String> createElement() { $FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
return _TranslateStringProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<String> create(Ref ref) {
final argument = this.argument as TranslateQuery;
return translateString(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is TranslateStringProvider && other.query == query; return other is TranslateStringProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, query.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$translateStringHash() => r'51d638cf07cbf3ffa9469298f5bd9c667bc0ccb7';
// ignore: unused_element
mixin TranslateStringRef on AutoDisposeFutureProviderRef<String> {
/// The parameter `query` of this provider.
TranslateQuery get query;
}
class _TranslateStringProviderElement final class TranslateStringFamily extends $Family
extends AutoDisposeFutureProviderElement<String> with $FunctionalFamilyOverride<FutureOr<String>, TranslateQuery> {
with TranslateStringRef { const TranslateStringFamily._()
_TranslateStringProviderElement(super.provider); : super(
retry: null,
name: r'translateStringProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
TranslateStringProvider call(TranslateQuery query) =>
TranslateStringProvider._(argument: query, from: this);
@override @override
TranslateQuery get query => (origin as TranslateStringProvider).query; String toString() => r'translateStringProvider';
}
@ProviderFor(detectStringLanguage)
const detectStringLanguageProvider = DetectStringLanguageFamily._();
final class DetectStringLanguageProvider
extends $FunctionalProvider<String?, String?, String?>
with $Provider<String?> {
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<String?> $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<String?>(value),
);
}
@override
bool operator ==(Object other) {
return other is DetectStringLanguageProvider && other.argument == argument;
}
@override
int get hashCode {
return argument.hashCode;
}
} }
String _$detectStringLanguageHash() => String _$detectStringLanguageHash() =>
r'24fbf52edbbffcc8dc4f09f7206f82d69728e703'; r'24fbf52edbbffcc8dc4f09f7206f82d69728e703';
/// See also [detectStringLanguage]. final class DetectStringLanguageFamily extends $Family
@ProviderFor(detectStringLanguage) with $FunctionalFamilyOverride<String?, String> {
const detectStringLanguageProvider = DetectStringLanguageFamily(); const DetectStringLanguageFamily._()
: super(
/// See also [detectStringLanguage]. retry: null,
class DetectStringLanguageFamily extends Family<String?> {
/// 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<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'detectStringLanguageProvider';
}
/// See also [detectStringLanguage].
class DetectStringLanguageProvider extends AutoDisposeProvider<String?> {
/// See also [detectStringLanguage].
DetectStringLanguageProvider(String text)
: this._internal(
(ref) => detectStringLanguage(ref as DetectStringLanguageRef, text),
from: detectStringLanguageProvider,
name: r'detectStringLanguageProvider', name: r'detectStringLanguageProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$detectStringLanguageHash,
dependencies: DetectStringLanguageFamily._dependencies,
allTransitiveDependencies:
DetectStringLanguageFamily._allTransitiveDependencies,
text: text,
);
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;
@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, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
text: text,
),
); );
}
DetectStringLanguageProvider call(String text) =>
DetectStringLanguageProvider._(argument: text, from: this);
@override @override
AutoDisposeProviderElement<String?> createElement() { String toString() => r'detectStringLanguageProvider';
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);
}
} }
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin DetectStringLanguageRef on AutoDisposeProviderRef<String?> {
/// The parameter `text` of this provider.
String get text;
}
class _DetectStringLanguageProviderElement
extends AutoDisposeProviderElement<String?>
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

View File

@@ -9,18 +9,16 @@ import 'package:island/pods/websocket.dart';
import 'package:island/services/file_uploader.dart'; import 'package:island/services/file_uploader.dart';
import 'package:island/talker.dart'; import 'package:island/talker.dart';
final uploadTasksProvider = final uploadTasksProvider = NotifierProvider(UploadTasksNotifier.new);
StateNotifierProvider<UploadTasksNotifier, List<DriveTask>>(
(ref) => UploadTasksNotifier(ref),
);
class UploadTasksNotifier extends StateNotifier<List<DriveTask>> { class UploadTasksNotifier extends Notifier<List<DriveTask>> {
final Ref ref;
StreamSubscription? _websocketSubscription; StreamSubscription? _websocketSubscription;
final Map<String, Map<String, dynamic>> _pendingUploads = {}; final Map<String, Map<String, dynamic>> _pendingUploads = {};
UploadTasksNotifier(this.ref) : super([]) { @override
List<DriveTask> build() {
_listenToWebSocket(); _listenToWebSocket();
return [];
} }
void _listenToWebSocket() { void _listenToWebSocket() {
@@ -334,10 +332,8 @@ class UploadTasksNotifier extends StateNotifier<List<DriveTask>> {
return taskId; return taskId;
} }
@override
void dispose() { void dispose() {
_websocketSubscription?.cancel(); _websocketSubscription?.cancel();
super.dispose();
} }
} }

View File

@@ -14,26 +14,27 @@ import 'package:island/pods/config.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
import 'package:island/talker.dart'; import 'package:island/talker.dart';
class UserInfoNotifier extends StateNotifier<AsyncValue<SnAccount?>> { class UserInfoNotifier extends AsyncNotifier<SnAccount?> {
final Ref _ref; @override
Future<SnAccount?> build() async {
UserInfoNotifier(this._ref) : super(const AsyncValue.data(null)); final token = ref.watch(tokenProvider);
Future<void> fetchUser() async {
final token = _ref.watch(tokenProvider);
if (token == null) { if (token == null) {
talker.info('[UserInfo] No token found, not going to fetch...'); talker.info('[UserInfo] No token found, not going to fetch...');
return; return null;
} }
return _fetchUser();
}
Future<SnAccount?> _fetchUser() async {
try { try {
final client = _ref.read(apiClientProvider); final client = ref.read(apiClientProvider);
final response = await client.get('/pass/accounts/me'); final response = await client.get('/pass/accounts/me');
final user = SnAccount.fromJson(response.data); final user = SnAccount.fromJson(response.data);
state = AsyncValue.data(user);
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) { if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
FirebaseAnalytics.instance.setUserId(id: user.id); FirebaseAnalytics.instance.setUserId(id: user.id);
} }
return user;
} catch (error, stackTrace) { } catch (error, stackTrace) {
if (!kIsWeb) { if (!kIsWeb) {
if (error is DioException) { if (error is DioException) {
@@ -69,10 +70,10 @@ class UserInfoNotifier extends StateNotifier<AsyncValue<SnAccount?>> {
), ),
).then((value) { ).then((value) {
if (value == true) { if (value == true) {
fetchUser(); ref.invalidateSelf();
} }
}); });
} } else {
showOverlayDialog<bool>( showOverlayDialog<bool>(
builder: builder:
(context, close) => AlertDialog( (context, close) => AlertDialog(
@@ -96,31 +97,36 @@ class UserInfoNotifier extends StateNotifier<AsyncValue<SnAccount?>> {
), ),
).then((value) { ).then((value) {
if (value == true) { if (value == true) {
fetchUser(); ref.invalidateSelf();
} }
}); });
} }
}
talker.error( talker.error(
"[UserInfo] Failed to fetch user info...", "[UserInfo] Failed to fetch user info...",
error, error,
stackTrace, stackTrace,
); );
state = AsyncValue.data(null); return null;
} }
} }
Future<void> fetchUser() async {
ref.invalidateSelf();
await future;
}
Future<void> logOut() async { Future<void> logOut() async {
state = const AsyncValue.data(null); state = const AsyncValue.data(null);
final prefs = _ref.read(sharedPreferencesProvider); final prefs = ref.read(sharedPreferencesProvider);
await prefs.remove(kTokenPairStoreKey); await prefs.remove(kTokenPairStoreKey);
_ref.invalidate(tokenProvider); ref.invalidate(tokenProvider);
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) { if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
FirebaseAnalytics.instance.setUserId(id: null); FirebaseAnalytics.instance.setUserId(id: null);
} }
} }
} }
final userInfoProvider = final userInfoProvider = AsyncNotifierProvider<UserInfoNotifier, SnAccount?>(
StateNotifierProvider<UserInfoNotifier, AsyncValue<SnAccount?>>( UserInfoNotifier.new,
(ref) => UserInfoNotifier(ref), );
);

View File

@@ -22,10 +22,14 @@ class WebAuthServerState {
} }
} }
class WebAuthServerNotifier extends StateNotifier<WebAuthServerState> { class WebAuthServerNotifier extends Notifier<WebAuthServerState> {
final WebAuthServer _server; late final WebAuthServer _server;
WebAuthServerNotifier(this._server) : super(WebAuthServerState()); @override
WebAuthServerState build() {
_server = ref.watch(webAuthServerProvider);
return WebAuthServerState();
}
Future<void> start() async { Future<void> start() async {
try { try {
@@ -47,7 +51,6 @@ final webAuthServerProvider = Provider<WebAuthServer>((ref) {
}); });
final webAuthServerStateProvider = final webAuthServerStateProvider =
StateNotifierProvider<WebAuthServerNotifier, WebAuthServerState>((ref) { NotifierProvider<WebAuthServerNotifier, WebAuthServerState>(
final server = ref.watch(webAuthServerProvider); WebAuthServerNotifier.new,
return WebAuthServerNotifier(server); );
});

View File

@@ -16,14 +16,12 @@ final webFeedListProvider = FutureProvider.family<List<SnWebFeed>, String>((
.toList(); .toList();
}); });
class WebFeedNotifier class WebFeedNotifier extends AsyncNotifier<SnWebFeed> {
extends final ({String pubName, String? feedId}) arg;
AutoDisposeFamilyAsyncNotifier< WebFeedNotifier(this.arg);
SnWebFeed,
({String pubName, String? feedId})
> {
@override @override
FutureOr<SnWebFeed> build(({String pubName, String? feedId}) arg) async { FutureOr<SnWebFeed> build() async {
if (arg.feedId == null || arg.feedId!.isEmpty) { if (arg.feedId == null || arg.feedId!.isEmpty) {
return SnWebFeed( return SnWebFeed(
id: '', id: '',

View File

@@ -100,12 +100,16 @@ class WebSocketService {
} }
}, },
onDone: () { onDone: () {
talker.info('[WebSocket] Connection closed, attempting to reconnect...'); talker.info(
'[WebSocket] Connection closed, attempting to reconnect...',
);
_scheduleReconnect(); _scheduleReconnect();
_statusStreamController.sink.add(WebSocketState.disconnected()); _statusStreamController.sink.add(WebSocketState.disconnected());
}, },
onError: (error) { onError: (error) {
talker.error('[WebSocket] Error occurred: $error, attempting to reconnect...'); talker.error(
'[WebSocket] Error occurred: $error, attempting to reconnect...',
);
_scheduleReconnect(); _scheduleReconnect();
_statusStreamController.sink.add( _statusStreamController.sink.add(
WebSocketState.error(error.toString()), WebSocketState.error(error.toString()),
@@ -152,15 +156,20 @@ class WebSocketService {
} }
final websocketStateProvider = final websocketStateProvider =
StateNotifierProvider<WebSocketStateNotifier, WebSocketState>( NotifierProvider<WebSocketStateNotifier, WebSocketState>(
(ref) => WebSocketStateNotifier(ref), WebSocketStateNotifier.new,
); );
class WebSocketStateNotifier extends StateNotifier<WebSocketState> { class WebSocketStateNotifier extends Notifier<WebSocketState> {
final Ref ref;
Timer? _reconnectTimer; Timer? _reconnectTimer;
WebSocketStateNotifier(this.ref) : super(const WebSocketState.disconnected()); @override
WebSocketState build() {
ref.onDispose(() {
_reconnectTimer?.cancel();
});
return const WebSocketState.disconnected();
}
Future<void> connect() async { Future<void> connect() async {
state = const WebSocketState.connecting(); state = const WebSocketState.connecting();
@@ -169,7 +178,7 @@ class WebSocketStateNotifier extends StateNotifier<WebSocketState> {
await service.connect(ref); await service.connect(ref);
state = const WebSocketState.connected(); state = const WebSocketState.connected();
service.statusStream.listen((event) { service.statusStream.listen((event) {
if (mounted) state = event; state = event;
}); });
} catch (err) { } catch (err) {
state = WebSocketState.error('Failed to connect: $err'); state = WebSocketState.error('Failed to connect: $err');

View File

@@ -57,9 +57,7 @@ class AccountScreen extends HookConsumerWidget {
} }
final user = ref.watch(userInfoProvider); final user = ref.watch(userInfoProvider);
final notificationUnreadCount = ref.watch( final notificationUnreadCount = ref.watch(notificationUnreadCountProvider);
notificationUnreadCountNotifierProvider,
);
if (user.value == null || user.value == null) { if (user.value == null || user.value == null) {
return _UnauthorizedAccountScreen(); return _UnauthorizedAccountScreen();

View File

@@ -6,23 +6,38 @@ part of 'credits.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$socialCreditsHash() => r'a0284583e94bc97285c689ac2bc018536932da69'; // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
/// See also [socialCredits].
@ProviderFor(socialCredits) @ProviderFor(socialCredits)
final socialCreditsProvider = AutoDisposeFutureProvider<double>.internal( const socialCreditsProvider = SocialCreditsProvider._();
socialCredits,
name: r'socialCreditsProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$socialCreditsHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead') final class SocialCreditsProvider
// ignore: unused_element extends $FunctionalProvider<AsyncValue<double>, double, FutureOr<double>>
typedef SocialCreditsRef = AutoDisposeFutureProviderRef<double>; with $FutureModifier<double>, $FutureProvider<double> {
// ignore_for_file: type=lint const SocialCreditsProvider._()
// 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 : super(
from: null,
argument: null,
retry: null,
name: r'socialCreditsProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$socialCreditsHash();
@$internal
@override
$FutureProviderElement<double> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<double> create(Ref ref) {
return socialCredits(ref);
}
}
String _$socialCreditsHash() => r'a0284583e94bc97285c689ac2bc018536932da69';

View File

@@ -6,64 +6,129 @@ part of 'account_settings.dart';
// RiverpodGenerator // 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<SnAuthFactor>>,
List<SnAuthFactor>,
FutureOr<List<SnAuthFactor>>
>
with
$FutureModifier<List<SnAuthFactor>>,
$FutureProvider<List<SnAuthFactor>> {
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<List<SnAuthFactor>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnAuthFactor>> create(Ref ref) {
return authFactors(ref);
}
}
String _$authFactorsHash() => r'ed87d7dbd421fef0a5620416727c3dc598c97ef5'; String _$authFactorsHash() => r'ed87d7dbd421fef0a5620416727c3dc598c97ef5';
/// See also [authFactors]. @ProviderFor(contactMethods)
@ProviderFor(authFactors) const contactMethodsProvider = ContactMethodsProvider._();
final authFactorsProvider =
AutoDisposeFutureProvider<List<SnAuthFactor>>.internal( final class ContactMethodsProvider
authFactors, extends
name: r'authFactorsProvider', $FunctionalProvider<
debugGetCreateSourceHash: AsyncValue<List<SnContactMethod>>,
const bool.fromEnvironment('dart.vm.product') List<SnContactMethod>,
? null FutureOr<List<SnContactMethod>>
: _$authFactorsHash, >
with
$FutureModifier<List<SnContactMethod>>,
$FutureProvider<List<SnContactMethod>> {
const ContactMethodsProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'contactMethodsProvider',
isAutoDispose: true,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
); );
@Deprecated('Will be removed in 3.0. Use Ref instead') @override
// ignore: unused_element String debugGetCreateSourceHash() => _$contactMethodsHash();
typedef AuthFactorsRef = AutoDisposeFutureProviderRef<List<SnAuthFactor>>;
@$internal
@override
$FutureProviderElement<List<SnContactMethod>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnContactMethod>> create(Ref ref) {
return contactMethods(ref);
}
}
String _$contactMethodsHash() => r'1d3d03e9ffbf36126236558ead22cb7d88bb9cb2'; String _$contactMethodsHash() => r'1d3d03e9ffbf36126236558ead22cb7d88bb9cb2';
/// See also [contactMethods]. @ProviderFor(accountConnections)
@ProviderFor(contactMethods) const accountConnectionsProvider = AccountConnectionsProvider._();
final contactMethodsProvider =
AutoDisposeFutureProvider<List<SnContactMethod>>.internal( final class AccountConnectionsProvider
contactMethods, extends
name: r'contactMethodsProvider', $FunctionalProvider<
debugGetCreateSourceHash: AsyncValue<List<SnAccountConnection>>,
const bool.fromEnvironment('dart.vm.product') List<SnAccountConnection>,
? null FutureOr<List<SnAccountConnection>>
: _$contactMethodsHash, >
with
$FutureModifier<List<SnAccountConnection>>,
$FutureProvider<List<SnAccountConnection>> {
const AccountConnectionsProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'accountConnectionsProvider',
isAutoDispose: true,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
); );
@Deprecated('Will be removed in 3.0. Use Ref instead') @override
// ignore: unused_element String debugGetCreateSourceHash() => _$accountConnectionsHash();
typedef ContactMethodsRef = AutoDisposeFutureProviderRef<List<SnContactMethod>>;
@$internal
@override
$FutureProviderElement<List<SnAccountConnection>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnAccountConnection>> create(Ref ref) {
return accountConnections(ref);
}
}
String _$accountConnectionsHash() => String _$accountConnectionsHash() =>
r'33c10b98962ede6c428d4028c0d5f2f12ff0eb22'; r'33c10b98962ede6c428d4028c0d5f2f12ff0eb22';
/// See also [accountConnections].
@ProviderFor(accountConnections)
final accountConnectionsProvider =
AutoDisposeFutureProvider<List<SnAccountConnection>>.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<List<SnAccountConnection>>;
// 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

File diff suppressed because it is too large Load Diff

View File

@@ -6,25 +6,46 @@ part of 'relationship.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$sentFriendRequestHash() => r'0c52813eb6f86c05f6e0b1e4e840d0d9c350aa9e'; // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
/// See also [sentFriendRequest].
@ProviderFor(sentFriendRequest) @ProviderFor(sentFriendRequest)
final sentFriendRequestProvider = const sentFriendRequestProvider = SentFriendRequestProvider._();
AutoDisposeFutureProvider<List<SnRelationship>>.internal(
sentFriendRequest, final class SentFriendRequestProvider
extends
$FunctionalProvider<
AsyncValue<List<SnRelationship>>,
List<SnRelationship>,
FutureOr<List<SnRelationship>>
>
with
$FutureModifier<List<SnRelationship>>,
$FutureProvider<List<SnRelationship>> {
const SentFriendRequestProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'sentFriendRequestProvider', name: r'sentFriendRequestProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product')
? null
: _$sentFriendRequestHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
); );
@Deprecated('Will be removed in 3.0. Use Ref instead') @override
// ignore: unused_element String debugGetCreateSourceHash() => _$sentFriendRequestHash();
typedef SentFriendRequestRef =
AutoDisposeFutureProviderRef<List<SnRelationship>>; @$internal
// ignore_for_file: type=lint @override
// 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 $FutureProviderElement<List<SnRelationship>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnRelationship>> create(Ref ref) {
return sentFriendRequest(ref);
}
}
String _$sentFriendRequestHash() => r'0c52813eb6f86c05f6e0b1e4e840d0d9c350aa9e';

View File

@@ -1,4 +1,3 @@
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';

View File

@@ -6,21 +6,38 @@ part of 'captcha.config.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$captchaUrlHash() => r'5d59de4f26a0544bf4fbd5209943f0b111959ce6'; // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
/// See also [captchaUrl].
@ProviderFor(captchaUrl) @ProviderFor(captchaUrl)
final captchaUrlProvider = AutoDisposeFutureProvider<String>.internal( const captchaUrlProvider = CaptchaUrlProvider._();
captchaUrl,
name: r'captchaUrlProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$captchaUrlHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead') final class CaptchaUrlProvider
// ignore: unused_element extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
typedef CaptchaUrlRef = AutoDisposeFutureProviderRef<String>; with $FutureModifier<String>, $FutureProvider<String> {
// ignore_for_file: type=lint const CaptchaUrlProvider._()
// 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 : super(
from: null,
argument: null,
retry: null,
name: r'captchaUrlProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$captchaUrlHash();
@$internal
@override
$FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<String> create(Ref ref) {
return captchaUrl(ref);
}
}
String _$captchaUrlHash() => r'5d59de4f26a0544bf4fbd5209943f0b111959ce6';

View File

@@ -22,8 +22,8 @@ class CallScreen extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final ongoingCall = ref.watch(ongoingCallProvider(room.id)); final ongoingCall = ref.watch(ongoingCallProvider(room.id));
final callState = ref.watch(callNotifierProvider); final callState = ref.watch(callProvider);
final callNotifier = ref.watch(callNotifierProvider.notifier); final callNotifier = ref.watch(callProvider.notifier);
useEffect(() { useEffect(() {
talker.info('[Call] Joining the call...'); talker.info('[Call] Joining the call...');

View File

@@ -191,7 +191,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final chats = ref.watch(chatRoomJoinedNotifierProvider); final chats = ref.watch(chatRoomJoinedProvider);
Widget bodyWidget = Column( Widget bodyWidget = Column(
children: [ children: [
@@ -214,7 +214,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
(items) => RefreshIndicator( (items) => RefreshIndicator(
onRefresh: onRefresh:
() => Future.sync(() { () => Future.sync(() {
ref.invalidate(chatRoomJoinedNotifierProvider); ref.invalidate(chatRoomJoinedProvider);
}), }),
child: SuperListView.builder( child: SuperListView.builder(
padding: EdgeInsets.only(bottom: 96), padding: EdgeInsets.only(bottom: 96),
@@ -264,7 +264,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
(error, stack) => ResponseErrorWidget( (error, stack) => ResponseErrorWidget(
error: error, error: error,
onRetry: () { onRetry: () {
ref.invalidate(chatRoomJoinedNotifierProvider); ref.invalidate(chatRoomJoinedProvider);
}, },
), ),
), ),
@@ -341,7 +341,7 @@ class ChatListScreen extends HookConsumerWidget {
// Listen for chat rooms refresh events // Listen for chat rooms refresh events
final subscription = eventBus.on<ChatRoomsRefreshEvent>().listen((event) { final subscription = eventBus.on<ChatRoomsRefreshEvent>().listen((event) {
ref.invalidate(chatRoomJoinedNotifierProvider); ref.invalidate(chatRoomJoinedProvider);
}); });
return () { return () {
@@ -353,13 +353,14 @@ class ChatListScreen extends HookConsumerWidget {
// Set FAB type to chat // Set FAB type to chat
final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier); final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier);
Future(() { Future(() {
fabMenuNotifier.state = FabMenuType.chat; fabMenuNotifier.setMenuType(FabMenuType.chat);
}); });
return () { return () {
// Clean up: reset FAB type to main // Clean up: reset FAB type to main
final fabMenu = ref.read(fabMenuTypeProvider);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (fabMenuNotifier.state == FabMenuType.chat) { if (fabMenu == FabMenuType.chat) {
fabMenuNotifier.state = FabMenuType.main; fabMenuNotifier.setMenuType(FabMenuType.main);
} }
}); });
}; };
@@ -521,7 +522,7 @@ class _ChatInvitesSheet extends HookConsumerWidget {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);
await client.post('/sphere/chat/invites/${invite.chatRoom!.id}/accept'); await client.post('/sphere/chat/invites/${invite.chatRoom!.id}/accept');
ref.invalidate(chatroomInvitesProvider); ref.invalidate(chatroomInvitesProvider);
ref.invalidate(chatRoomJoinedNotifierProvider); ref.invalidate(chatRoomJoinedProvider);
} catch (err) { } catch (err) {
showErrorAlert(err); showErrorAlert(err);
} }

View File

@@ -47,7 +47,7 @@ class EditChatScreen extends HookConsumerWidget {
final isPublic = useState(true); final isPublic = useState(true);
final isCommunity = useState(false); final isCommunity = useState(false);
final chat = ref.watch(ChatRoomNotifierProvider(id)); final chat = ref.watch(chatRoomProvider(id));
final joinedRealms = ref.watch(realmsJoinedProvider); final joinedRealms = ref.watch(realmsJoinedProvider);
final currentRealm = useState<SnRealm?>(null); final currentRealm = useState<SnRealm?>(null);

View File

@@ -27,8 +27,8 @@ class PublicRoomPreview extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final messages = ref.watch(messagesNotifierProvider(id)); final messages = ref.watch(messagesProvider(id));
final messagesNotifier = ref.read(messagesNotifierProvider(id).notifier); final messagesNotifier = ref.read(messagesProvider(id).notifier);
final scrollController = useScrollController(); final scrollController = useScrollController();
final listController = useMemoized(() => ListController(), []); final listController = useMemoized(() => ListController(), []);
@@ -203,7 +203,7 @@ class PublicRoomPreview extends HookConsumerWidget {
showLoadingModal(context); showLoadingModal(context);
final apiClient = ref.read(apiClientProvider); final apiClient = ref.read(apiClientProvider);
await apiClient.post('/sphere/chat/${room.id}/members/me'); await apiClient.post('/sphere/chat/${room.id}/members/me');
ref.invalidate(ChatRoomIdentityNotifierProvider(id)); ref.invalidate(chatRoomIdentityProvider(id));
} catch (err) { } catch (err) {
showErrorAlert(err); showErrorAlert(err);
} finally { } finally {

View File

@@ -48,11 +48,11 @@ class ChatRoomScreen extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final chatRoom = ref.watch(ChatRoomNotifierProvider(id)); final chatRoom = ref.watch(chatRoomProvider(id));
final chatIdentity = ref.watch(ChatRoomIdentityNotifierProvider(id)); final chatIdentity = ref.watch(chatRoomIdentityProvider(id));
final isSyncing = ref.watch(isSyncingProvider); final isSyncing = ref.watch(chatSyncingProvider);
final onlineCount = ref.watch(chatOnlineCountNotifierProvider(id)); final onlineCount = ref.watch(chatOnlineCountProvider(id));
final settings = ref.watch(appSettingsNotifierProvider); final settings = ref.watch(appSettingsProvider);
if (chatIdentity.isLoading || chatRoom.isLoading) { if (chatIdentity.isLoading || chatRoom.isLoading) {
return AppScaffold( return AppScaffold(
@@ -100,9 +100,7 @@ class ChatRoomScreen extends HookConsumerWidget {
await apiClient.post( await apiClient.post(
'/sphere/chat/${room.id}/members/me', '/sphere/chat/${room.id}/members/me',
); );
ref.invalidate( ref.invalidate(chatRoomIdentityProvider(id));
ChatRoomIdentityNotifierProvider(id),
);
} catch (err) { } catch (err) {
showErrorAlert(err); showErrorAlert(err);
} finally { } finally {
@@ -131,17 +129,15 @@ class ChatRoomScreen extends HookConsumerWidget {
appBar: AppBar(leading: const PageBackButton()), appBar: AppBar(leading: const PageBackButton()),
body: ResponseErrorWidget( body: ResponseErrorWidget(
error: error, error: error,
onRetry: () => ref.refresh(ChatRoomNotifierProvider(id)), onRetry: () => ref.refresh(chatRoomProvider(id)),
), ),
), ),
); );
} }
final messages = ref.watch(messagesNotifierProvider(id)); final messages = ref.watch(messagesProvider(id));
final messagesNotifier = ref.read(messagesNotifierProvider(id).notifier); final messagesNotifier = ref.read(messagesProvider(id).notifier);
final chatSubscribeNotifier = ref.read( final chatSubscribeNotifier = ref.read(chatSubscribeProvider(id).notifier);
chatSubscribeNotifierProvider(id).notifier,
);
final messageController = useTextEditingController(); final messageController = useTextEditingController();
final scrollController = useScrollController(); final scrollController = useScrollController();
@@ -384,7 +380,7 @@ class ChatRoomScreen extends HookConsumerWidget {
// Convert selected message IDs to message data // Convert selected message IDs to message data
final selectedMessageData = final selectedMessageData =
messages.valueOrNull messages.value
?.where((msg) => selectedMessages.value.contains(msg.id)) ?.where((msg) => selectedMessages.value.contains(msg.id))
.map( .map(
(msg) => { (msg) => {
@@ -773,8 +769,7 @@ class ChatRoomScreen extends HookConsumerWidget {
'chatDetail', 'chatDetail',
pathParameters: {'id': id}, pathParameters: {'id': id},
); );
if (result is SearchMessagesResult && if (result is SearchMessagesResult && messages.value != null) {
messages.valueOrNull != null) {
final messageId = result.messageId; final messageId = result.messageId;
// Jump to the message and trigger flash effect // Jump to the message and trigger flash effect

View File

@@ -1,8 +1,6 @@
import 'package:dio/dio.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
@@ -40,8 +38,8 @@ class ChatDetailScreen extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final roomState = ref.watch(ChatRoomNotifierProvider(id)); final roomState = ref.watch(chatRoomProvider(id));
final roomIdentity = ref.watch(ChatRoomIdentityNotifierProvider(id)); final roomIdentity = ref.watch(chatRoomIdentityProvider(id));
final totalMessages = ref.watch(totalMessagesCountProvider(id)); final totalMessages = ref.watch(totalMessagesCountProvider(id));
const kNotifyLevelText = [ const kNotifyLevelText = [
@@ -57,7 +55,7 @@ class ChatDetailScreen extends HookConsumerWidget {
'/sphere/chat/$id/members/me/notify', '/sphere/chat/$id/members/me/notify',
data: {'notify_level': level}, data: {'notify_level': level},
); );
ref.invalidate(ChatRoomIdentityNotifierProvider(id)); ref.invalidate(chatRoomIdentityProvider(id));
if (context.mounted) { if (context.mounted) {
showSnackBar( showSnackBar(
'chatNotifyLevelUpdated'.tr(args: [kNotifyLevelText[level].tr()]), 'chatNotifyLevelUpdated'.tr(args: [kNotifyLevelText[level].tr()]),
@@ -75,7 +73,7 @@ class ChatDetailScreen extends HookConsumerWidget {
'/sphere/chat/$id/members/me/notify', '/sphere/chat/$id/members/me/notify',
data: {'break_until': until.toUtc().toIso8601String()}, data: {'break_until': until.toUtc().toIso8601String()},
); );
ref.invalidate(ChatRoomNotifierProvider(id)); ref.invalidate(chatRoomIdentityProvider(id));
} catch (err) { } catch (err) {
showErrorAlert(err); showErrorAlert(err);
} }
@@ -440,8 +438,8 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final chatIdentity = ref.watch(ChatRoomIdentityNotifierProvider(id)); final chatIdentity = ref.watch(chatRoomIdentityProvider(id));
final chatRoom = ref.watch(ChatRoomNotifierProvider(id)); final chatRoom = ref.watch(chatRoomProvider(id));
final isManagable = final isManagable =
chatIdentity.value?.accountId == chatRoom.value?.accountId || chatIdentity.value?.accountId == chatRoom.value?.accountId ||
@@ -462,7 +460,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
).then((value) { ).then((value) {
if (value != null) { if (value != null) {
// Invalidate to refresh room data after edit // 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) { if (confirm) {
final client = ref.watch(apiClientProvider); final client = ref.watch(apiClientProvider);
await client.delete('/sphere/chat/$id'); await client.delete('/sphere/chat/$id');
ref.invalidate(chatRoomJoinedNotifierProvider); ref.invalidate(chatRoomJoinedProvider);
if (context.mounted) { if (context.mounted) {
context.pop(); context.pop();
} }
@@ -531,7 +529,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
if (confirm) { if (confirm) {
final client = ref.watch(apiClientProvider); final client = ref.watch(apiClientProvider);
await client.delete('/sphere/chat/$id/members/me'); await client.delete('/sphere/chat/$id/members/me');
ref.invalidate(chatRoomJoinedNotifierProvider); ref.invalidate(chatRoomJoinedProvider);
if (context.mounted) { if (context.mounted) {
context.pop(); context.pop();
} }
@@ -554,63 +552,17 @@ sealed class ChatRoomMemberState with _$ChatRoomMemberState {
}) = _ChatRoomMemberState; }) = _ChatRoomMemberState;
} }
final chatMemberStateProvider = StateNotifierProvider.family< final chatMemberListProvider = AsyncNotifierProvider.autoDispose.family(
ChatMemberNotifier,
ChatRoomMemberState,
String
>((ref, roomId) {
final apiClient = ref.watch(apiClientProvider);
return ChatMemberNotifier(apiClient, roomId);
});
class ChatMemberNotifier extends StateNotifier<ChatRoomMemberState> {
final String roomId;
final Dio _apiClient;
ChatMemberNotifier(this._apiClient, this.roomId)
: super(const ChatRoomMemberState(members: [], isLoading: false, total: 0));
Future<void> 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<dynamic> 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<ChatMemberListNotifier, List<SnChatMember>, String>(
ChatMemberListNotifier.new, ChatMemberListNotifier.new,
); );
class ChatMemberListNotifier class ChatMemberListNotifier extends AsyncNotifier<List<SnChatMember>>
extends AutoDisposeFamilyAsyncNotifier<List<SnChatMember>, String> with AsyncPaginationController<SnChatMember> {
with FamilyAsyncPaginationController<SnChatMember, String> {
static const pageSize = 20; static const pageSize = 20;
final String arg;
ChatMemberListNotifier(this.arg);
@override @override
Future<List<SnChatMember>> fetch() async { Future<List<SnChatMember>> fetch() async {
final apiClient = ref.watch(apiClientProvider); final apiClient = ref.watch(apiClientProvider);
@@ -640,26 +592,15 @@ class _ChatMemberListSheet extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { 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 roomIdentity = ref.watch(chatRoomIdentityProvider(roomId));
final memberState = ref.watch(chatMemberStateProvider(roomId)); final chatRoom = ref.watch(chatRoomProvider(roomId));
final memberNotifier = ref.read(chatMemberStateProvider(roomId).notifier);
final roomIdentity = ref.watch(ChatRoomIdentityNotifierProvider(roomId));
final chatRoom = ref.watch(ChatRoomNotifierProvider(roomId));
final isManagable = final isManagable =
chatRoom.value?.accountId == roomIdentity.value?.accountId || chatRoom.value?.accountId == roomIdentity.value?.accountId ||
chatRoom.value?.type == 1; chatRoom.value?.type == 1;
useEffect(() {
Future(() {
memberNotifier.loadMore();
});
return null;
}, []);
Future<void> invitePerson() async { Future<void> invitePerson() async {
final result = await showModalBottomSheet( final result = await showModalBottomSheet(
context: context, context: context,
@@ -674,10 +615,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
'/sphere/chat/invites/$roomId', '/sphere/chat/invites/$roomId',
data: {'related_user_id': result.id, 'role': 0}, data: {'related_user_id': result.id, 'role': 0},
); );
// Refresh both providers memberNotifier.refresh();
memberNotifier.reset();
await memberNotifier.loadMore();
ref.invalidate(memberListProvider);
} catch (err) { } catch (err) {
showErrorAlert(err); showErrorAlert(err);
} }
@@ -694,7 +632,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
child: Row( child: Row(
children: [ children: [
Text( Text(
'members'.plural(memberState.total), 'members'.plural(memberNotifier.totalCount ?? 0),
style: Theme.of(context).textTheme.headlineSmall?.copyWith( style: Theme.of(context).textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.5, letterSpacing: -0.5,
@@ -709,10 +647,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
IconButton( IconButton(
icon: const Icon(Symbols.refresh), icon: const Icon(Symbols.refresh),
onPressed: () { onPressed: () {
// Refresh both providers memberNotifier.refresh();
memberNotifier.reset();
memberNotifier.loadMore();
ref.invalidate(memberListProvider);
}, },
), ),
IconButton( IconButton(
@@ -726,8 +661,8 @@ class _ChatMemberListSheet extends HookConsumerWidget {
const Divider(height: 1), const Divider(height: 1),
Expanded( Expanded(
child: PaginationList( child: PaginationList(
provider: memberListProvider, provider: chatMemberListProvider(roomId),
notifier: memberListProvider.notifier, notifier: chatMemberListProvider(roomId).notifier,
itemBuilder: (context, idx, member) { itemBuilder: (context, idx, member) {
return ListTile( return ListTile(
contentPadding: EdgeInsets.only(left: 16, right: 12), contentPadding: EdgeInsets.only(left: 16, right: 12),
@@ -770,9 +705,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
'/sphere/chat/$roomId/members/${member.accountId}', '/sphere/chat/$roomId/members/${member.accountId}',
); );
// Refresh both providers // Refresh both providers
memberNotifier.reset(); memberNotifier.refresh();
memberNotifier.loadMore();
ref.invalidate(memberListProvider);
} catch (err) { } catch (err) {
showErrorAlert(err); showErrorAlert(err);
} }

View File

@@ -6,148 +6,75 @@ part of 'room_detail.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$totalMessagesCountHash() => // GENERATED CODE - DO NOT MODIFY BY HAND
r'd55f1507aba2acdce5e468c1c2e15dba7640c571'; // 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) @ProviderFor(totalMessagesCount)
const totalMessagesCountProvider = TotalMessagesCountFamily(); const totalMessagesCountProvider = TotalMessagesCountFamily._();
/// See also [totalMessagesCount]. final class TotalMessagesCountProvider
class TotalMessagesCountFamily extends Family<AsyncValue<int>> { extends $FunctionalProvider<AsyncValue<int>, int, FutureOr<int>>
/// See also [totalMessagesCount]. with $FutureModifier<int>, $FutureProvider<int> {
const TotalMessagesCountFamily(); const TotalMessagesCountProvider._({
required TotalMessagesCountFamily super.from,
/// See also [totalMessagesCount]. required String super.argument,
TotalMessagesCountProvider call(String roomId) { }) : super(
return TotalMessagesCountProvider(roomId); retry: null,
}
@override
TotalMessagesCountProvider getProviderOverride(
covariant TotalMessagesCountProvider provider,
) {
return call(provider.roomId);
}
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'totalMessagesCountProvider';
}
/// See also [totalMessagesCount].
class TotalMessagesCountProvider extends AutoDisposeFutureProvider<int> {
/// See also [totalMessagesCount].
TotalMessagesCountProvider(String roomId)
: this._internal(
(ref) => totalMessagesCount(ref as TotalMessagesCountRef, roomId),
from: totalMessagesCountProvider,
name: r'totalMessagesCountProvider', name: r'totalMessagesCountProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$totalMessagesCountHash();
FutureOr<int> Function(TotalMessagesCountRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'totalMessagesCountProvider'
override: TotalMessagesCountProvider._internal( ''
(ref) => create(ref as TotalMessagesCountRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
roomId: roomId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<int> createElement() { $FutureProviderElement<int> $createElement($ProviderPointer pointer) =>
return _TotalMessagesCountProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<int> create(Ref ref) {
final argument = this.argument as String;
return totalMessagesCount(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is TotalMessagesCountProvider && other.roomId == roomId; return other is TotalMessagesCountProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, roomId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$totalMessagesCountHash() =>
// ignore: unused_element r'd55f1507aba2acdce5e468c1c2e15dba7640c571';
mixin TotalMessagesCountRef on AutoDisposeFutureProviderRef<int> {
/// The parameter `roomId` of this provider.
String get roomId;
}
class _TotalMessagesCountProviderElement final class TotalMessagesCountFamily extends $Family
extends AutoDisposeFutureProviderElement<int> with $FunctionalFamilyOverride<FutureOr<int>, String> {
with TotalMessagesCountRef { const TotalMessagesCountFamily._()
_TotalMessagesCountProviderElement(super.provider); : super(
retry: null,
name: r'totalMessagesCountProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
TotalMessagesCountProvider call(String roomId) =>
TotalMessagesCountProvider._(argument: roomId, from: this);
@override @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

View File

@@ -124,9 +124,7 @@ class SearchMessagesScreen extends HookConsumerWidget {
// Debounce timer for search optimization // Debounce timer for search optimization
final debounceTimer = useRef<Timer?>(null); final debounceTimer = useRef<Timer?>(null);
final messagesNotifier = ref.read( final messagesNotifier = ref.read(messagesProvider(roomId).notifier);
messagesNotifierProvider(roomId).notifier,
);
// Optimized search function with debouncing // Optimized search function with debouncing
void performSearch(String query) async { void performSearch(String query) async {
@@ -180,7 +178,7 @@ class SearchMessagesScreen extends HookConsumerWidget {
useEffect(() { useEffect(() {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
// Clear flashing messages when entering search screen // Clear flashing messages when entering search screen
ref.read(flashingMessagesProvider.notifier).state = {}; ref.read(flashingMessagesProvider.notifier).clear();
}); });
return null; return null;
}, []); }, []);

View File

@@ -1,14 +1,28 @@
import 'package:flutter/material.dart'; 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/database/message.dart';
import 'package:island/models/chat.dart'; import 'package:island/models/chat.dart';
import 'package:island/widgets/chat/message_item.dart'; import 'package:island/widgets/chat/message_item.dart';
// Provider to track animated messages to prevent replay // Provider to track animated messages to prevent replay
final animatedMessagesProvider = StateProvider<Set<String>>((ref) => {}); final animatedMessagesProvider =
NotifierProvider<AnimatedMessagesNotifier, Set<String>>(
AnimatedMessagesNotifier.new,
);
class MessageItemWrapper extends HookConsumerWidget { class AnimatedMessagesNotifier extends Notifier<Set<String>> {
@override
Set<String> build() {
return {};
}
void addMessage(String messageId) {
state = {...state, messageId};
}
}
class MessageItemWrapper extends ConsumerWidget {
final LocalChatMessage message; final LocalChatMessage message;
final int index; final int index;
final bool isLastInGroup; final bool isLastInGroup;
@@ -78,9 +92,7 @@ class MessageItemWrapper extends HookConsumerWidget {
onEnd: () { onEnd: () {
// Mark as animated // Mark as animated
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
ref ref.read(animatedMessagesProvider.notifier).addMessage(message.id);
.read(animatedMessagesProvider.notifier)
.update((state) => {...state, message.id});
}); });
}, },
child: child, child: child,

View File

@@ -81,11 +81,13 @@ Future<List<SnPublisherMember>> publisherInvites(Ref ref) async {
final publisherMemberListNotifierProvider = AsyncNotifierProvider.family final publisherMemberListNotifierProvider = AsyncNotifierProvider.family
.autoDispose(PublisherMemberListNotifier.new); .autoDispose(PublisherMemberListNotifier.new);
class PublisherMemberListNotifier class PublisherMemberListNotifier extends AsyncNotifier<List<SnPublisherMember>>
extends AutoDisposeFamilyAsyncNotifier<List<SnPublisherMember>, String> with AsyncPaginationController<SnPublisherMember> {
with FamilyAsyncPaginationController<SnPublisherMember, String> {
static const int pageSize = 20; static const int pageSize = 20;
final String arg;
PublisherMemberListNotifier(this.arg);
@override @override
Future<List<SnPublisherMember>> fetch() async { Future<List<SnPublisherMember>> fetch() async {
final apiClient = ref.read(apiClientProvider); 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<PublisherMemberState> {
final String publisherUname;
final Dio _apiClient;
PublisherMemberNotifier(this._apiClient, this.publisherUname)
: super(
const PublisherMemberState(members: [], isLoading: false, total: 0),
);
Future<void> 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<dynamic> 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 { class _PublisherMemberListSheet extends HookConsumerWidget {
final String publisherUname; final String publisherUname;
const _PublisherMemberListSheet({required this.publisherUname}); const _PublisherMemberListSheet({required this.publisherUname});
@@ -820,18 +773,10 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
final memberListProvider = publisherMemberListNotifierProvider( final memberListProvider = publisherMemberListNotifierProvider(
publisherUname, publisherUname,
); );
final memberState = ref.watch(publisherMemberStateProvider(publisherUname));
final memberNotifier = ref.read( final memberNotifier = ref.read(
publisherMemberStateProvider(publisherUname).notifier, publisherMemberListNotifierProvider(publisherUname).notifier,
); );
useEffect(() {
Future(() {
memberNotifier.loadMore();
});
return null;
}, []);
Future<void> invitePerson() async { Future<void> invitePerson() async {
final result = await showModalBottomSheet( final result = await showModalBottomSheet(
useRootNavigator: true, useRootNavigator: true,
@@ -846,10 +791,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
'/sphere/publishers/invites/$publisherUname', '/sphere/publishers/invites/$publisherUname',
data: {'related_user_id': result.id, 'role': 0}, data: {'related_user_id': result.id, 'role': 0},
); );
// Refresh both providers memberNotifier.refresh();
memberNotifier.reset();
await memberNotifier.loadMore();
ref.invalidate(memberListProvider);
} catch (err) { } catch (err) {
showErrorAlert(err); showErrorAlert(err);
} }
@@ -866,7 +808,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
child: Row( child: Row(
children: [ children: [
Text( Text(
'members'.plural(memberState.total), 'members'.plural(memberNotifier.totalCount ?? 0),
style: Theme.of(context).textTheme.headlineSmall?.copyWith( style: Theme.of(context).textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.5, letterSpacing: -0.5,
@@ -881,9 +823,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
IconButton( IconButton(
icon: const Icon(Symbols.refresh), icon: const Icon(Symbols.refresh),
onPressed: () { onPressed: () {
memberNotifier.reset(); memberNotifier.refresh();
memberNotifier.loadMore();
ref.invalidate(memberListProvider);
}, },
), ),
IconButton( IconButton(
@@ -943,10 +883,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
), ),
).then((value) { ).then((value) {
if (value != null) { if (value != null) {
// Refresh both providers memberNotifier.refresh();
memberNotifier.reset();
memberNotifier.loadMore();
ref.invalidate(memberListProvider);
} }
}); });
}, },
@@ -965,10 +902,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
await apiClient.delete( await apiClient.delete(
'/sphere/publishers/$publisherUname/members/${member.accountId}', '/sphere/publishers/$publisherUname/members/${member.accountId}',
); );
// Refresh both providers memberNotifier.refresh();
memberNotifier.reset();
memberNotifier.loadMore();
ref.invalidate(memberListProvider);
} catch (err) { } catch (err) {
showErrorAlert(err); showErrorAlert(err);
} }

View File

@@ -6,533 +6,351 @@ part of 'hub.dart';
// RiverpodGenerator // 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) @ProviderFor(publisherStats)
const publisherStatsProvider = PublisherStatsFamily(); const publisherStatsProvider = PublisherStatsFamily._();
/// See also [publisherStats]. final class PublisherStatsProvider
class PublisherStatsFamily extends Family<AsyncValue<SnPublisherStats?>> { extends
/// See also [publisherStats]. $FunctionalProvider<
const PublisherStatsFamily(); AsyncValue<SnPublisherStats?>,
SnPublisherStats?,
/// See also [publisherStats]. FutureOr<SnPublisherStats?>
PublisherStatsProvider call(String? uname) { >
return PublisherStatsProvider(uname); with
} $FutureModifier<SnPublisherStats?>,
$FutureProvider<SnPublisherStats?> {
@override const PublisherStatsProvider._({
PublisherStatsProvider getProviderOverride( required PublisherStatsFamily super.from,
covariant PublisherStatsProvider provider, required String? super.argument,
) { }) : super(
return call(provider.uname); retry: null,
}
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'publisherStatsProvider';
}
/// See also [publisherStats].
class PublisherStatsProvider
extends AutoDisposeFutureProvider<SnPublisherStats?> {
/// See also [publisherStats].
PublisherStatsProvider(String? uname)
: this._internal(
(ref) => publisherStats(ref as PublisherStatsRef, uname),
from: publisherStatsProvider,
name: r'publisherStatsProvider', name: r'publisherStatsProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$publisherStatsHash();
FutureOr<SnPublisherStats?> Function(PublisherStatsRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'publisherStatsProvider'
override: PublisherStatsProvider._internal( ''
(ref) => create(ref as PublisherStatsRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
uname: uname,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnPublisherStats?> createElement() { $FutureProviderElement<SnPublisherStats?> $createElement(
return _PublisherStatsProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnPublisherStats?> create(Ref ref) {
final argument = this.argument as String?;
return publisherStats(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PublisherStatsProvider && other.uname == uname; return other is PublisherStatsProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, uname.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$publisherStatsHash() => r'eea4ed98bf165cc785874f83b912bb7e23d1f7bc';
// ignore: unused_element
mixin PublisherStatsRef on AutoDisposeFutureProviderRef<SnPublisherStats?> {
/// The parameter `uname` of this provider.
String? get uname;
}
class _PublisherStatsProviderElement final class PublisherStatsFamily extends $Family
extends AutoDisposeFutureProviderElement<SnPublisherStats?> with $FunctionalFamilyOverride<FutureOr<SnPublisherStats?>, String?> {
with PublisherStatsRef { const PublisherStatsFamily._()
_PublisherStatsProviderElement(super.provider); : super(
retry: null,
name: r'publisherStatsProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
PublisherStatsProvider call(String? uname) =>
PublisherStatsProvider._(argument: uname, from: this);
@override @override
String? get uname => (origin as PublisherStatsProvider).uname; String toString() => r'publisherStatsProvider';
}
@ProviderFor(publisherHeatmap)
const publisherHeatmapProvider = PublisherHeatmapFamily._();
final class PublisherHeatmapProvider
extends
$FunctionalProvider<
AsyncValue<SnHeatmap?>,
SnHeatmap?,
FutureOr<SnHeatmap?>
>
with $FutureModifier<SnHeatmap?>, $FutureProvider<SnHeatmap?> {
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<SnHeatmap?> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<SnHeatmap?> 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'; String _$publisherHeatmapHash() => r'5f70c55e14629ec8628445a317888e02fccd9af2';
/// See also [publisherHeatmap]. final class PublisherHeatmapFamily extends $Family
@ProviderFor(publisherHeatmap) with $FunctionalFamilyOverride<FutureOr<SnHeatmap?>, String?> {
const publisherHeatmapProvider = PublisherHeatmapFamily(); const PublisherHeatmapFamily._()
: super(
retry: null,
name: r'publisherHeatmapProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
/// See also [publisherHeatmap]. PublisherHeatmapProvider call(String? uname) =>
class PublisherHeatmapFamily extends Family<AsyncValue<SnHeatmap?>> { PublisherHeatmapProvider._(argument: uname, from: this);
/// See also [publisherHeatmap].
const PublisherHeatmapFamily();
/// See also [publisherHeatmap].
PublisherHeatmapProvider call(String? uname) {
return PublisherHeatmapProvider(uname);
}
@override @override
PublisherHeatmapProvider getProviderOverride( String toString() => r'publisherHeatmapProvider';
covariant PublisherHeatmapProvider provider,
) {
return call(provider.uname);
}
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'publisherHeatmapProvider';
} }
/// See also [publisherHeatmap]. @ProviderFor(publisherIdentity)
class PublisherHeatmapProvider extends AutoDisposeFutureProvider<SnHeatmap?> { const publisherIdentityProvider = PublisherIdentityFamily._();
/// See also [publisherHeatmap].
PublisherHeatmapProvider(String? uname) final class PublisherIdentityProvider
: this._internal( extends
(ref) => publisherHeatmap(ref as PublisherHeatmapRef, uname), $FunctionalProvider<
from: publisherHeatmapProvider, AsyncValue<SnPublisherMember?>,
name: r'publisherHeatmapProvider', SnPublisherMember?,
debugGetCreateSourceHash: FutureOr<SnPublisherMember?>
const bool.fromEnvironment('dart.vm.product') >
? null with
: _$publisherHeatmapHash, $FutureModifier<SnPublisherMember?>,
dependencies: PublisherHeatmapFamily._dependencies, $FutureProvider<SnPublisherMember?> {
allTransitiveDependencies: const PublisherIdentityProvider._({
PublisherHeatmapFamily._allTransitiveDependencies, required PublisherIdentityFamily super.from,
uname: uname, required String super.argument,
}) : super(
retry: null,
name: r'publisherIdentityProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
); );
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;
@override @override
Override overrideWith( String debugGetCreateSourceHash() => _$publisherIdentityHash();
FutureOr<SnHeatmap?> Function(PublisherHeatmapRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'publisherIdentityProvider'
override: PublisherHeatmapProvider._internal( ''
(ref) => create(ref as PublisherHeatmapRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
uname: uname,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnHeatmap?> createElement() { $FutureProviderElement<SnPublisherMember?> $createElement(
return _PublisherHeatmapProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnPublisherMember?> create(Ref ref) {
final argument = this.argument as String;
return publisherIdentity(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PublisherHeatmapProvider && other.uname == uname; return other is PublisherIdentityProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.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 PublisherHeatmapRef on AutoDisposeFutureProviderRef<SnHeatmap?> {
/// The parameter `uname` of this provider.
String? get uname;
}
class _PublisherHeatmapProviderElement
extends AutoDisposeFutureProviderElement<SnHeatmap?>
with PublisherHeatmapRef {
_PublisherHeatmapProviderElement(super.provider);
@override
String? get uname => (origin as PublisherHeatmapProvider).uname;
}
String _$publisherIdentityHash() => r'299372f25fa4b2bf8e11a8ba2d645100fc38e76f'; String _$publisherIdentityHash() => r'299372f25fa4b2bf8e11a8ba2d645100fc38e76f';
/// See also [publisherIdentity]. final class PublisherIdentityFamily extends $Family
@ProviderFor(publisherIdentity) with $FunctionalFamilyOverride<FutureOr<SnPublisherMember?>, String> {
const publisherIdentityProvider = PublisherIdentityFamily(); const PublisherIdentityFamily._()
: super(
retry: null,
name: r'publisherIdentityProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
/// See also [publisherIdentity]. PublisherIdentityProvider call(String uname) =>
class PublisherIdentityFamily extends Family<AsyncValue<SnPublisherMember?>> { PublisherIdentityProvider._(argument: uname, from: this);
/// See also [publisherIdentity].
const PublisherIdentityFamily();
/// See also [publisherIdentity].
PublisherIdentityProvider call(String uname) {
return PublisherIdentityProvider(uname);
}
@override @override
PublisherIdentityProvider getProviderOverride( String toString() => r'publisherIdentityProvider';
covariant PublisherIdentityProvider provider,
) {
return call(provider.uname);
}
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'publisherIdentityProvider';
} }
/// See also [publisherIdentity]. @ProviderFor(publisherFeatures)
class PublisherIdentityProvider const publisherFeaturesProvider = PublisherFeaturesFamily._();
extends AutoDisposeFutureProvider<SnPublisherMember?> {
/// See also [publisherIdentity]. final class PublisherFeaturesProvider
PublisherIdentityProvider(String uname) extends
: this._internal( $FunctionalProvider<
(ref) => publisherIdentity(ref as PublisherIdentityRef, uname), AsyncValue<Map<String, bool>>,
from: publisherIdentityProvider, Map<String, bool>,
name: r'publisherIdentityProvider', FutureOr<Map<String, bool>>
debugGetCreateSourceHash: >
const bool.fromEnvironment('dart.vm.product') with
? null $FutureModifier<Map<String, bool>>,
: _$publisherIdentityHash, $FutureProvider<Map<String, bool>> {
dependencies: PublisherIdentityFamily._dependencies, const PublisherFeaturesProvider._({
allTransitiveDependencies: required PublisherFeaturesFamily super.from,
PublisherIdentityFamily._allTransitiveDependencies, required String? super.argument,
uname: uname, }) : super(
retry: null,
name: r'publisherFeaturesProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
); );
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;
@override @override
Override overrideWith( String debugGetCreateSourceHash() => _$publisherFeaturesHash();
FutureOr<SnPublisherMember?> Function(PublisherIdentityRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'publisherFeaturesProvider'
override: PublisherIdentityProvider._internal( ''
(ref) => create(ref as PublisherIdentityRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
uname: uname,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnPublisherMember?> createElement() { $FutureProviderElement<Map<String, bool>> $createElement(
return _PublisherIdentityProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<Map<String, bool>> create(Ref ref) {
final argument = this.argument as String?;
return publisherFeatures(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PublisherIdentityProvider && other.uname == uname; return other is PublisherFeaturesProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.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 PublisherIdentityRef on AutoDisposeFutureProviderRef<SnPublisherMember?> {
/// The parameter `uname` of this provider.
String get uname;
}
class _PublisherIdentityProviderElement
extends AutoDisposeFutureProviderElement<SnPublisherMember?>
with PublisherIdentityRef {
_PublisherIdentityProviderElement(super.provider);
@override
String get uname => (origin as PublisherIdentityProvider).uname;
}
String _$publisherFeaturesHash() => r'08bace2d9a3da227ecec0cbf8709e55ee0646ca2'; String _$publisherFeaturesHash() => r'08bace2d9a3da227ecec0cbf8709e55ee0646ca2';
/// See also [publisherFeatures]. final class PublisherFeaturesFamily extends $Family
@ProviderFor(publisherFeatures) with $FunctionalFamilyOverride<FutureOr<Map<String, bool>>, String?> {
const publisherFeaturesProvider = PublisherFeaturesFamily(); const PublisherFeaturesFamily._()
: super(
/// See also [publisherFeatures]. retry: null,
class PublisherFeaturesFamily extends Family<AsyncValue<Map<String, bool>>> {
/// 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<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'publisherFeaturesProvider';
}
/// See also [publisherFeatures].
class PublisherFeaturesProvider
extends AutoDisposeFutureProvider<Map<String, bool>> {
/// See also [publisherFeatures].
PublisherFeaturesProvider(String? uname)
: this._internal(
(ref) => publisherFeatures(ref as PublisherFeaturesRef, uname),
from: publisherFeaturesProvider,
name: r'publisherFeaturesProvider', name: r'publisherFeaturesProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$publisherFeaturesHash,
dependencies: PublisherFeaturesFamily._dependencies,
allTransitiveDependencies:
PublisherFeaturesFamily._allTransitiveDependencies,
uname: uname,
);
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;
@override
Override overrideWith(
FutureOr<Map<String, bool>> Function(PublisherFeaturesRef provider) create,
) {
return ProviderOverride(
origin: this,
override: PublisherFeaturesProvider._internal(
(ref) => create(ref as PublisherFeaturesRef),
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
uname: uname,
),
); );
}
PublisherFeaturesProvider call(String? uname) =>
PublisherFeaturesProvider._(argument: uname, from: this);
@override @override
AutoDisposeFutureProviderElement<Map<String, bool>> createElement() { String toString() => r'publisherFeaturesProvider';
return _PublisherFeaturesProviderElement(this);
}
@override
bool operator ==(Object other) {
return other is PublisherFeaturesProvider && other.uname == uname;
}
@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') @ProviderFor(publisherInvites)
// ignore: unused_element const publisherInvitesProvider = PublisherInvitesProvider._();
mixin PublisherFeaturesRef on AutoDisposeFutureProviderRef<Map<String, bool>> {
/// The parameter `uname` of this provider.
String? get uname;
}
class _PublisherFeaturesProviderElement final class PublisherInvitesProvider
extends AutoDisposeFutureProviderElement<Map<String, bool>> extends
with PublisherFeaturesRef { $FunctionalProvider<
_PublisherFeaturesProviderElement(super.provider); AsyncValue<List<SnPublisherMember>>,
List<SnPublisherMember>,
FutureOr<List<SnPublisherMember>>
>
with
$FutureModifier<List<SnPublisherMember>>,
$FutureProvider<List<SnPublisherMember>> {
const PublisherInvitesProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'publisherInvitesProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override @override
String? get uname => (origin as PublisherFeaturesProvider).uname; String debugGetCreateSourceHash() => _$publisherInvitesHash();
@$internal
@override
$FutureProviderElement<List<SnPublisherMember>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnPublisherMember>> create(Ref ref) {
return publisherInvites(ref);
}
} }
String _$publisherInvitesHash() => r'93aafc2f02af0a7a055ec1770b3999363dfaabdc'; String _$publisherInvitesHash() => r'93aafc2f02af0a7a055ec1770b3999363dfaabdc';
/// See also [publisherInvites].
@ProviderFor(publisherInvites)
final publisherInvitesProvider =
AutoDisposeFutureProvider<List<SnPublisherMember>>.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<List<SnPublisherMember>>;
// 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

View File

@@ -21,11 +21,13 @@ final pollListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
PollListNotifier.new, PollListNotifier.new,
); );
class PollListNotifier class PollListNotifier extends AsyncNotifier<List<SnPollWithStats>>
extends AutoDisposeFamilyAsyncNotifier<List<SnPollWithStats>, String?> with AsyncPaginationController<SnPollWithStats> {
with FamilyAsyncPaginationController<SnPollWithStats, String?> {
static const int pageSize = 20; static const int pageSize = 20;
final String? arg;
PollListNotifier(this.arg);
@override @override
Future<List<SnPollWithStats>> fetch() async { Future<List<SnPollWithStats>> fetch() async {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);

View File

@@ -6,147 +6,80 @@ part of 'poll_list.dart';
// RiverpodGenerator // 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) @ProviderFor(pollWithStats)
const pollWithStatsProvider = PollWithStatsFamily(); const pollWithStatsProvider = PollWithStatsFamily._();
/// See also [pollWithStats]. final class PollWithStatsProvider
class PollWithStatsFamily extends Family<AsyncValue<SnPollWithStats>> { extends
/// See also [pollWithStats]. $FunctionalProvider<
const PollWithStatsFamily(); AsyncValue<SnPollWithStats>,
SnPollWithStats,
/// See also [pollWithStats]. FutureOr<SnPollWithStats>
PollWithStatsProvider call(String id) { >
return PollWithStatsProvider(id); with $FutureModifier<SnPollWithStats>, $FutureProvider<SnPollWithStats> {
} const PollWithStatsProvider._({
required PollWithStatsFamily super.from,
@override required String super.argument,
PollWithStatsProvider getProviderOverride( }) : super(
covariant PollWithStatsProvider provider, retry: null,
) {
return call(provider.id);
}
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'pollWithStatsProvider';
}
/// See also [pollWithStats].
class PollWithStatsProvider extends AutoDisposeFutureProvider<SnPollWithStats> {
/// See also [pollWithStats].
PollWithStatsProvider(String id)
: this._internal(
(ref) => pollWithStats(ref as PollWithStatsRef, id),
from: pollWithStatsProvider,
name: r'pollWithStatsProvider', name: r'pollWithStatsProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$pollWithStatsHash();
FutureOr<SnPollWithStats> Function(PollWithStatsRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'pollWithStatsProvider'
override: PollWithStatsProvider._internal( ''
(ref) => create(ref as PollWithStatsRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
id: id,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnPollWithStats> createElement() { $FutureProviderElement<SnPollWithStats> $createElement(
return _PollWithStatsProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnPollWithStats> create(Ref ref) {
final argument = this.argument as String;
return pollWithStats(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PollWithStatsProvider && other.id == id; return other is PollWithStatsProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, id.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$pollWithStatsHash() => r'6bb910046ce1e09368f9922dbec52fdc2cc86740';
// ignore: unused_element
mixin PollWithStatsRef on AutoDisposeFutureProviderRef<SnPollWithStats> {
/// The parameter `id` of this provider.
String get id;
}
class _PollWithStatsProviderElement final class PollWithStatsFamily extends $Family
extends AutoDisposeFutureProviderElement<SnPollWithStats> with $FunctionalFamilyOverride<FutureOr<SnPollWithStats>, String> {
with PollWithStatsRef { const PollWithStatsFamily._()
_PollWithStatsProviderElement(super.provider); : super(
retry: null,
name: r'pollWithStatsProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
PollWithStatsProvider call(String id) =>
PollWithStatsProvider._(argument: id, from: this);
@override @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

View File

@@ -6,163 +6,121 @@ part of 'publishers_form.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
@ProviderFor(publishersManaged)
const publishersManagedProvider = PublishersManagedProvider._();
final class PublishersManagedProvider
extends
$FunctionalProvider<
AsyncValue<List<SnPublisher>>,
List<SnPublisher>,
FutureOr<List<SnPublisher>>
>
with
$FutureModifier<List<SnPublisher>>,
$FutureProvider<List<SnPublisher>> {
const PublishersManagedProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'publishersManagedProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$publishersManagedHash();
@$internal
@override
$FutureProviderElement<List<SnPublisher>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnPublisher>> create(Ref ref) {
return publishersManaged(ref);
}
}
String _$publishersManagedHash() => r'ea83759fed9bd5119738b4d09f12b4476959e0a3'; String _$publishersManagedHash() => r'ea83759fed9bd5119738b4d09f12b4476959e0a3';
/// See also [publishersManaged].
@ProviderFor(publishersManaged)
final publishersManagedProvider =
AutoDisposeFutureProvider<List<SnPublisher>>.internal(
publishersManaged,
name: r'publishersManagedProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$publishersManagedHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef PublishersManagedRef = AutoDisposeFutureProviderRef<List<SnPublisher>>;
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) @ProviderFor(publisher)
const publisherProvider = PublisherFamily(); const publisherProvider = PublisherFamily._();
/// See also [publisher]. final class PublisherProvider
class PublisherFamily extends Family<AsyncValue<SnPublisher?>> { extends
/// See also [publisher]. $FunctionalProvider<
const PublisherFamily(); AsyncValue<SnPublisher?>,
SnPublisher?,
/// See also [publisher]. FutureOr<SnPublisher?>
PublisherProvider call(String? identifier) { >
return PublisherProvider(identifier); with $FutureModifier<SnPublisher?>, $FutureProvider<SnPublisher?> {
} const PublisherProvider._({
required PublisherFamily super.from,
@override required String? super.argument,
PublisherProvider getProviderOverride(covariant PublisherProvider provider) { }) : super(
return call(provider.identifier); retry: null,
}
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'publisherProvider';
}
/// See also [publisher].
class PublisherProvider extends AutoDisposeFutureProvider<SnPublisher?> {
/// See also [publisher].
PublisherProvider(String? identifier)
: this._internal(
(ref) => publisher(ref as PublisherRef, identifier),
from: publisherProvider,
name: r'publisherProvider', name: r'publisherProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: null,
: _$publisherHash,
dependencies: PublisherFamily._dependencies,
allTransitiveDependencies: PublisherFamily._allTransitiveDependencies,
identifier: identifier,
); );
PublisherProvider._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 @override
Override overrideWith( String debugGetCreateSourceHash() => _$publisherHash();
FutureOr<SnPublisher?> Function(PublisherRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'publisherProvider'
override: PublisherProvider._internal( ''
(ref) => create(ref as PublisherRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
identifier: identifier,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnPublisher?> createElement() { $FutureProviderElement<SnPublisher?> $createElement(
return _PublisherProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnPublisher?> create(Ref ref) {
final argument = this.argument as String?;
return publisher(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PublisherProvider && other.identifier == identifier; return other is PublisherProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, identifier.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$publisherHash() => r'18fb5c6b3d79dd8af4fbee108dec1a0e8a034038';
// ignore: unused_element
mixin PublisherRef on AutoDisposeFutureProviderRef<SnPublisher?> {
/// The parameter `identifier` of this provider.
String? get identifier;
}
class _PublisherProviderElement final class PublisherFamily extends $Family
extends AutoDisposeFutureProviderElement<SnPublisher?> with $FunctionalFamilyOverride<FutureOr<SnPublisher?>, String?> {
with PublisherRef { const PublisherFamily._()
_PublisherProviderElement(super.provider); : super(
retry: null,
name: r'publisherProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
PublisherProvider call(String? identifier) =>
PublisherProvider._(argument: identifier, from: this);
@override @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

View File

@@ -6,168 +6,90 @@ part of 'site_detail.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$publicationSiteDetailHash() => // GENERATED CODE - DO NOT MODIFY BY HAND
r'e5d259ea39c4ba47e92d37e644fc3d84984927a9'; // 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) @ProviderFor(publicationSiteDetail)
const publicationSiteDetailProvider = PublicationSiteDetailFamily(); const publicationSiteDetailProvider = PublicationSiteDetailFamily._();
/// See also [publicationSiteDetail]. final class PublicationSiteDetailProvider
class PublicationSiteDetailFamily extends
extends Family<AsyncValue<SnPublicationSite>> { $FunctionalProvider<
/// See also [publicationSiteDetail]. AsyncValue<SnPublicationSite>,
const PublicationSiteDetailFamily(); SnPublicationSite,
FutureOr<SnPublicationSite>
/// See also [publicationSiteDetail]. >
PublicationSiteDetailProvider call(String pubName, String siteSlug) { with
return PublicationSiteDetailProvider(pubName, siteSlug); $FutureModifier<SnPublicationSite>,
} $FutureProvider<SnPublicationSite> {
const PublicationSiteDetailProvider._({
@override required PublicationSiteDetailFamily super.from,
PublicationSiteDetailProvider getProviderOverride( required (String, String) super.argument,
covariant PublicationSiteDetailProvider provider, }) : super(
) { retry: null,
return call(provider.pubName, provider.siteSlug);
}
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'publicationSiteDetailProvider';
}
/// See also [publicationSiteDetail].
class PublicationSiteDetailProvider
extends AutoDisposeFutureProvider<SnPublicationSite> {
/// See also [publicationSiteDetail].
PublicationSiteDetailProvider(String pubName, String siteSlug)
: this._internal(
(ref) => publicationSiteDetail(
ref as PublicationSiteDetailRef,
pubName,
siteSlug,
),
from: publicationSiteDetailProvider,
name: r'publicationSiteDetailProvider', name: r'publicationSiteDetailProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$publicationSiteDetailHash();
FutureOr<SnPublicationSite> Function(PublicationSiteDetailRef provider)
create, @override
) { String toString() {
return ProviderOverride( return r'publicationSiteDetailProvider'
origin: this, ''
override: PublicationSiteDetailProvider._internal( '$argument';
(ref) => create(ref as PublicationSiteDetailRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
pubName: pubName,
siteSlug: siteSlug,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnPublicationSite> createElement() { $FutureProviderElement<SnPublicationSite> $createElement(
return _PublicationSiteDetailProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnPublicationSite> create(Ref ref) {
final argument = this.argument as (String, String);
return publicationSiteDetail(ref, argument.$1, argument.$2);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PublicationSiteDetailProvider && return other is PublicationSiteDetailProvider && other.argument == argument;
other.pubName == pubName &&
other.siteSlug == siteSlug;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, pubName.hashCode);
hash = _SystemHash.combine(hash, siteSlug.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$publicationSiteDetailHash() =>
// ignore: unused_element r'e5d259ea39c4ba47e92d37e644fc3d84984927a9';
mixin PublicationSiteDetailRef
on AutoDisposeFutureProviderRef<SnPublicationSite> {
/// The parameter `pubName` of this provider.
String get pubName;
/// The parameter `siteSlug` of this provider. final class PublicationSiteDetailFamily extends $Family
String get siteSlug; with
} $FunctionalFamilyOverride<
FutureOr<SnPublicationSite>,
(String, String)
> {
const PublicationSiteDetailFamily._()
: super(
retry: null,
name: r'publicationSiteDetailProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
class _PublicationSiteDetailProviderElement PublicationSiteDetailProvider call(String pubName, String siteSlug) =>
extends AutoDisposeFutureProviderElement<SnPublicationSite> PublicationSiteDetailProvider._(
with PublicationSiteDetailRef { argument: (pubName, siteSlug),
_PublicationSiteDetailProviderElement(super.provider); from: this,
);
@override @override
String get pubName => (origin as PublicationSiteDetailProvider).pubName; String toString() => r'publicationSiteDetailProvider';
@override
String get siteSlug => (origin as PublicationSiteDetailProvider).siteSlug;
} }
// 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

View File

@@ -19,11 +19,13 @@ final siteListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
SiteListNotifier.new, SiteListNotifier.new,
); );
class SiteListNotifier class SiteListNotifier extends AsyncNotifier<List<SnPublicationSite>>
extends AutoDisposeFamilyAsyncNotifier<List<SnPublicationSite>, String> with AsyncPaginationController<SnPublicationSite> {
with FamilyAsyncPaginationController<SnPublicationSite, String> {
static const int pageSize = 20; static const int pageSize = 20;
final String arg;
SiteListNotifier(this.arg);
@override @override
Future<List<SnPublicationSite>> fetch() async { Future<List<SnPublicationSite>> fetch() async {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);

View File

@@ -293,7 +293,7 @@ class StickerPackActionMenu extends HookConsumerWidget {
if (confirm) { if (confirm) {
final client = ref.watch(apiClientProvider); final client = ref.watch(apiClientProvider);
client.delete('/sphere/stickers/$packId'); client.delete('/sphere/stickers/$packId');
ref.invalidate(stickerPacksNotifierProvider); ref.invalidate(stickerPacksProvider);
if (context.mounted) context.pop(true); if (context.mounted) context.pop(true);
} }
}); });

View File

@@ -6,272 +6,157 @@ part of 'pack_detail.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$stickerPackContentHash() => // GENERATED CODE - DO NOT MODIFY BY HAND
r'42d74f51022e67e35cb601c2f30f4f02e1f2be9d'; // 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) @ProviderFor(stickerPackContent)
const stickerPackContentProvider = StickerPackContentFamily(); const stickerPackContentProvider = StickerPackContentFamily._();
/// See also [stickerPackContent]. final class StickerPackContentProvider
class StickerPackContentFamily extends Family<AsyncValue<List<SnSticker>>> { extends
/// See also [stickerPackContent]. $FunctionalProvider<
const StickerPackContentFamily(); AsyncValue<List<SnSticker>>,
List<SnSticker>,
/// See also [stickerPackContent]. FutureOr<List<SnSticker>>
StickerPackContentProvider call(String packId) { >
return StickerPackContentProvider(packId); with $FutureModifier<List<SnSticker>>, $FutureProvider<List<SnSticker>> {
} const StickerPackContentProvider._({
required StickerPackContentFamily super.from,
@override required String super.argument,
StickerPackContentProvider getProviderOverride( }) : super(
covariant StickerPackContentProvider provider, retry: null,
) {
return call(provider.packId);
}
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'stickerPackContentProvider';
}
/// See also [stickerPackContent].
class StickerPackContentProvider
extends AutoDisposeFutureProvider<List<SnSticker>> {
/// See also [stickerPackContent].
StickerPackContentProvider(String packId)
: this._internal(
(ref) => stickerPackContent(ref as StickerPackContentRef, packId),
from: stickerPackContentProvider,
name: r'stickerPackContentProvider', name: r'stickerPackContentProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$stickerPackContentHash();
FutureOr<List<SnSticker>> Function(StickerPackContentRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'stickerPackContentProvider'
override: StickerPackContentProvider._internal( ''
(ref) => create(ref as StickerPackContentRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
packId: packId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<SnSticker>> createElement() { $FutureProviderElement<List<SnSticker>> $createElement(
return _StickerPackContentProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnSticker>> create(Ref ref) {
final argument = this.argument as String;
return stickerPackContent(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is StickerPackContentProvider && other.packId == packId; return other is StickerPackContentProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, packId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$stickerPackContentHash() =>
// ignore: unused_element r'42d74f51022e67e35cb601c2f30f4f02e1f2be9d';
mixin StickerPackContentRef on AutoDisposeFutureProviderRef<List<SnSticker>> {
/// The parameter `packId` of this provider.
String get packId;
}
class _StickerPackContentProviderElement final class StickerPackContentFamily extends $Family
extends AutoDisposeFutureProviderElement<List<SnSticker>> with $FunctionalFamilyOverride<FutureOr<List<SnSticker>>, String> {
with StickerPackContentRef { const StickerPackContentFamily._()
_StickerPackContentProviderElement(super.provider); : super(
retry: null,
name: r'stickerPackContentProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
StickerPackContentProvider call(String packId) =>
StickerPackContentProvider._(argument: packId, from: this);
@override @override
String get packId => (origin as StickerPackContentProvider).packId; String toString() => r'stickerPackContentProvider';
}
@ProviderFor(stickerPackSticker)
const stickerPackStickerProvider = StickerPackStickerFamily._();
final class StickerPackStickerProvider
extends
$FunctionalProvider<
AsyncValue<SnSticker?>,
SnSticker?,
FutureOr<SnSticker?>
>
with $FutureModifier<SnSticker?>, $FutureProvider<SnSticker?> {
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<SnSticker?> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<SnSticker?> 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() => String _$stickerPackStickerHash() =>
r'5c553666b3a63530bdebae4b7cd52f303c5ab3a0'; r'5c553666b3a63530bdebae4b7cd52f303c5ab3a0';
/// See also [stickerPackSticker]. final class StickerPackStickerFamily extends $Family
@ProviderFor(stickerPackSticker) with
const stickerPackStickerProvider = StickerPackStickerFamily(); $FunctionalFamilyOverride<FutureOr<SnSticker?>, StickerWithPackQuery?> {
const StickerPackStickerFamily._()
/// See also [stickerPackSticker]. : super(
class StickerPackStickerFamily extends Family<AsyncValue<SnSticker?>> { retry: null,
/// 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<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'stickerPackStickerProvider';
}
/// See also [stickerPackSticker].
class StickerPackStickerProvider extends AutoDisposeFutureProvider<SnSticker?> {
/// See also [stickerPackSticker].
StickerPackStickerProvider(StickerWithPackQuery? query)
: this._internal(
(ref) => stickerPackSticker(ref as StickerPackStickerRef, query),
from: stickerPackStickerProvider,
name: r'stickerPackStickerProvider', name: r'stickerPackStickerProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$stickerPackStickerHash,
dependencies: StickerPackStickerFamily._dependencies,
allTransitiveDependencies:
StickerPackStickerFamily._allTransitiveDependencies,
query: query,
);
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;
@override
Override overrideWith(
FutureOr<SnSticker?> Function(StickerPackStickerRef provider) create,
) {
return ProviderOverride(
origin: this,
override: StickerPackStickerProvider._internal(
(ref) => create(ref as StickerPackStickerRef),
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
query: query,
),
); );
}
StickerPackStickerProvider call(StickerWithPackQuery? query) =>
StickerPackStickerProvider._(argument: query, from: this);
@override @override
AutoDisposeFutureProviderElement<SnSticker?> createElement() { String toString() => r'stickerPackStickerProvider';
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);
}
} }
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin StickerPackStickerRef on AutoDisposeFutureProviderRef<SnSticker?> {
/// The parameter `query` of this provider.
StickerWithPackQuery? get query;
}
class _StickerPackStickerProviderElement
extends AutoDisposeFutureProviderElement<SnSticker?>
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

View File

@@ -48,7 +48,7 @@ class StickersScreen extends HookConsumerWidget {
), ),
).then((value) { ).then((value) {
if (value != null) { if (value != null) {
ref.invalidate(stickerPacksNotifierProvider(pubName)); ref.invalidate(stickerPacksProvider(pubName));
} }
}); });
}, },
@@ -83,8 +83,8 @@ class SliverStickerPacksList extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return PaginationList( return PaginationList(
provider: stickerPacksNotifierProvider(pubName), provider: stickerPacksProvider(pubName),
notifier: stickerPacksNotifierProvider(pubName).notifier, notifier: stickerPacksProvider(pubName).notifier,
itemBuilder: (context, index, sticker) { itemBuilder: (context, index, sticker) {
return ListTile( return ListTile(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@@ -139,15 +139,17 @@ class SliverStickerPacksList extends HookConsumerWidget {
} }
} }
final stickerPacksNotifierProvider = AsyncNotifierProvider.family.autoDispose( final stickerPacksProvider = AsyncNotifierProvider.family.autoDispose(
StickerPacksNotifier.new, StickerPacksNotifier.new,
); );
class StickerPacksNotifier class StickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
extends AutoDisposeFamilyAsyncNotifier<List<SnStickerPack>, String> with AsyncPaginationController<SnStickerPack> {
with FamilyAsyncPaginationController<SnStickerPack, String> {
static const int pageSize = 20; static const int pageSize = 20;
final String arg;
StickerPacksNotifier(this.arg);
@override @override
Future<List<SnStickerPack>> fetch() async { Future<List<SnStickerPack>> fetch() async {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);

View File

@@ -6,146 +6,80 @@ part of 'stickers.dart';
// RiverpodGenerator // 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) @ProviderFor(stickerPack)
const stickerPackProvider = StickerPackFamily(); const stickerPackProvider = StickerPackFamily._();
/// See also [stickerPack]. final class StickerPackProvider
class StickerPackFamily extends Family<AsyncValue<SnStickerPack?>> { extends
/// See also [stickerPack]. $FunctionalProvider<
const StickerPackFamily(); AsyncValue<SnStickerPack?>,
SnStickerPack?,
/// See also [stickerPack]. FutureOr<SnStickerPack?>
StickerPackProvider call(String? packId) { >
return StickerPackProvider(packId); with $FutureModifier<SnStickerPack?>, $FutureProvider<SnStickerPack?> {
} const StickerPackProvider._({
required StickerPackFamily super.from,
@override required String? super.argument,
StickerPackProvider getProviderOverride( }) : super(
covariant StickerPackProvider provider, retry: null,
) {
return call(provider.packId);
}
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'stickerPackProvider';
}
/// See also [stickerPack].
class StickerPackProvider extends AutoDisposeFutureProvider<SnStickerPack?> {
/// See also [stickerPack].
StickerPackProvider(String? packId)
: this._internal(
(ref) => stickerPack(ref as StickerPackRef, packId),
from: stickerPackProvider,
name: r'stickerPackProvider', name: r'stickerPackProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$stickerPackHash();
FutureOr<SnStickerPack?> Function(StickerPackRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'stickerPackProvider'
override: StickerPackProvider._internal( ''
(ref) => create(ref as StickerPackRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
packId: packId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnStickerPack?> createElement() { $FutureProviderElement<SnStickerPack?> $createElement(
return _StickerPackProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnStickerPack?> create(Ref ref) {
final argument = this.argument as String?;
return stickerPack(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is StickerPackProvider && other.packId == packId; return other is StickerPackProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, packId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$stickerPackHash() => r'71ef84471237c8191918095094bdfc87d3920e77';
// ignore: unused_element
mixin StickerPackRef on AutoDisposeFutureProviderRef<SnStickerPack?> {
/// The parameter `packId` of this provider.
String? get packId;
}
class _StickerPackProviderElement final class StickerPackFamily extends $Family
extends AutoDisposeFutureProviderElement<SnStickerPack?> with $FunctionalFamilyOverride<FutureOr<SnStickerPack?>, String?> {
with StickerPackRef { const StickerPackFamily._()
_StickerPackProviderElement(super.provider); : super(
retry: null,
name: r'stickerPackProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
StickerPackProvider call(String? packId) =>
StickerPackProvider._(argument: packId, from: this);
@override @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

View File

@@ -6,183 +6,92 @@ part of 'app_secrets.dart';
// RiverpodGenerator // 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) @ProviderFor(customAppSecrets)
const customAppSecretsProvider = CustomAppSecretsFamily(); const customAppSecretsProvider = CustomAppSecretsFamily._();
/// See also [customAppSecrets]. final class CustomAppSecretsProvider
class CustomAppSecretsFamily extends Family<AsyncValue<List<CustomAppSecret>>> { extends
/// See also [customAppSecrets]. $FunctionalProvider<
const CustomAppSecretsFamily(); AsyncValue<List<CustomAppSecret>>,
List<CustomAppSecret>,
/// See also [customAppSecrets]. FutureOr<List<CustomAppSecret>>
CustomAppSecretsProvider call( >
String publisherName, with
String projectId, $FutureModifier<List<CustomAppSecret>>,
String appId, $FutureProvider<List<CustomAppSecret>> {
) { const CustomAppSecretsProvider._({
return CustomAppSecretsProvider(publisherName, projectId, appId); required CustomAppSecretsFamily super.from,
} required (String, String, String) super.argument,
}) : super(
@override retry: null,
CustomAppSecretsProvider getProviderOverride(
covariant CustomAppSecretsProvider provider,
) {
return call(provider.publisherName, provider.projectId, provider.appId);
}
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'customAppSecretsProvider';
}
/// See also [customAppSecrets].
class CustomAppSecretsProvider
extends AutoDisposeFutureProvider<List<CustomAppSecret>> {
/// 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', name: r'customAppSecretsProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$customAppSecretsHash();
FutureOr<List<CustomAppSecret>> Function(CustomAppSecretsRef provider)
create, @override
) { String toString() {
return ProviderOverride( return r'customAppSecretsProvider'
origin: this, ''
override: CustomAppSecretsProvider._internal( '$argument';
(ref) => create(ref as CustomAppSecretsRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
publisherName: publisherName,
projectId: projectId,
appId: appId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<CustomAppSecret>> createElement() { $FutureProviderElement<List<CustomAppSecret>> $createElement(
return _CustomAppSecretsProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<CustomAppSecret>> create(Ref ref) {
final argument = this.argument as (String, String, String);
return customAppSecrets(ref, argument.$1, argument.$2, argument.$3);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is CustomAppSecretsProvider && return other is CustomAppSecretsProvider && other.argument == argument;
other.publisherName == publisherName &&
other.projectId == projectId &&
other.appId == appId;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, publisherName.hashCode);
hash = _SystemHash.combine(hash, projectId.hashCode);
hash = _SystemHash.combine(hash, appId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$customAppSecretsHash() => r'1bc62ad812487883ce739793b22a76168d656752';
// ignore: unused_element
mixin CustomAppSecretsRef
on AutoDisposeFutureProviderRef<List<CustomAppSecret>> {
/// The parameter `publisherName` of this provider.
String get publisherName;
/// The parameter `projectId` of this provider. final class CustomAppSecretsFamily extends $Family
String get projectId; with
$FunctionalFamilyOverride<
FutureOr<List<CustomAppSecret>>,
(String, String, String)
> {
const CustomAppSecretsFamily._()
: super(
retry: null,
name: r'customAppSecretsProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
/// The parameter `appId` of this provider. CustomAppSecretsProvider call(
String get appId; String publisherName,
String projectId,
String appId,
) => CustomAppSecretsProvider._(
argument: (publisherName, projectId, appId),
from: this,
);
@override
String toString() => r'customAppSecretsProvider';
} }
class _CustomAppSecretsProviderElement
extends AutoDisposeFutureProviderElement<List<CustomAppSecret>>
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

View File

@@ -6,300 +6,165 @@ part of 'apps.dart';
// RiverpodGenerator // 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) @ProviderFor(customApp)
const customAppProvider = CustomAppFamily(); const customAppProvider = CustomAppFamily._();
/// See also [customApp]. final class CustomAppProvider
class CustomAppFamily extends Family<AsyncValue<CustomApp>> { extends
/// See also [customApp]. $FunctionalProvider<
const CustomAppFamily(); AsyncValue<CustomApp>,
CustomApp,
/// See also [customApp]. FutureOr<CustomApp>
CustomAppProvider call(String publisherName, String projectId, String appId) { >
return CustomAppProvider(publisherName, projectId, appId); with $FutureModifier<CustomApp>, $FutureProvider<CustomApp> {
} const CustomAppProvider._({
required CustomAppFamily super.from,
@override required (String, String, String) super.argument,
CustomAppProvider getProviderOverride(covariant CustomAppProvider provider) { }) : super(
return call(provider.publisherName, provider.projectId, provider.appId); retry: null,
}
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'customAppProvider';
}
/// See also [customApp].
class CustomAppProvider extends AutoDisposeFutureProvider<CustomApp> {
/// 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', name: r'customAppProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$customAppHash();
FutureOr<CustomApp> Function(CustomAppRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'customAppProvider'
override: CustomAppProvider._internal( ''
(ref) => create(ref as CustomAppRef), '$argument';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
publisherName: publisherName,
projectId: projectId,
appId: appId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<CustomApp> createElement() { $FutureProviderElement<CustomApp> $createElement($ProviderPointer pointer) =>
return _CustomAppProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<CustomApp> create(Ref ref) {
final argument = this.argument as (String, String, String);
return customApp(ref, argument.$1, argument.$2, argument.$3);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is CustomAppProvider && return other is CustomAppProvider && other.argument == argument;
other.publisherName == publisherName &&
other.projectId == projectId &&
other.appId == appId;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, publisherName.hashCode);
hash = _SystemHash.combine(hash, projectId.hashCode);
hash = _SystemHash.combine(hash, appId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$customAppHash() => r'be05431ba8bf06fd20ee988a61c3663a68e15fc9';
// ignore: unused_element
mixin CustomAppRef on AutoDisposeFutureProviderRef<CustomApp> {
/// The parameter `publisherName` of this provider.
String get publisherName;
/// The parameter `projectId` of this provider. final class CustomAppFamily extends $Family
String get projectId; with
$FunctionalFamilyOverride<
FutureOr<CustomApp>,
(String, String, String)
> {
const CustomAppFamily._()
: super(
retry: null,
name: r'customAppProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
/// The parameter `appId` of this provider. CustomAppProvider call(
String get appId; String publisherName,
String projectId,
String appId,
) => CustomAppProvider._(
argument: (publisherName, projectId, appId),
from: this,
);
@override
String toString() => r'customAppProvider';
} }
class _CustomAppProviderElement @ProviderFor(customApps)
extends AutoDisposeFutureProviderElement<CustomApp> const customAppsProvider = CustomAppsFamily._();
with CustomAppRef {
_CustomAppProviderElement(super.provider); final class CustomAppsProvider
extends
$FunctionalProvider<
AsyncValue<List<CustomApp>>,
List<CustomApp>,
FutureOr<List<CustomApp>>
>
with $FutureModifier<List<CustomApp>>, $FutureProvider<List<CustomApp>> {
const CustomAppsProvider._({
required CustomAppsFamily super.from,
required (String, String) super.argument,
}) : super(
retry: null,
name: r'customAppsProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override @override
String get publisherName => (origin as CustomAppProvider).publisherName; String debugGetCreateSourceHash() => _$customAppsHash();
@override @override
String get projectId => (origin as CustomAppProvider).projectId; String toString() {
return r'customAppsProvider'
''
'$argument';
}
@$internal
@override @override
String get appId => (origin as CustomAppProvider).appId; $FutureProviderElement<List<CustomApp>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<CustomApp>> 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'; String _$customAppsHash() => r'450bedaf4220b8963cb44afeb14d4c0e80f01b11';
/// See also [customApps]. final class CustomAppsFamily extends $Family
@ProviderFor(customApps) with
const customAppsProvider = CustomAppsFamily(); $FunctionalFamilyOverride<FutureOr<List<CustomApp>>, (String, String)> {
const CustomAppsFamily._()
/// See also [customApps]. : super(
class CustomAppsFamily extends Family<AsyncValue<List<CustomApp>>> { retry: null,
/// 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<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'customAppsProvider';
}
/// See also [customApps].
class CustomAppsProvider extends AutoDisposeFutureProvider<List<CustomApp>> {
/// See also [customApps].
CustomAppsProvider(String publisherName, String projectId)
: this._internal(
(ref) => customApps(ref as CustomAppsRef, publisherName, projectId),
from: customAppsProvider,
name: r'customAppsProvider', name: r'customAppsProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$customAppsHash,
dependencies: CustomAppsFamily._dependencies,
allTransitiveDependencies: CustomAppsFamily._allTransitiveDependencies,
publisherName: publisherName,
projectId: projectId,
);
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;
@override
Override overrideWith(
FutureOr<List<CustomApp>> Function(CustomAppsRef provider) create,
) {
return ProviderOverride(
origin: this,
override: CustomAppsProvider._internal(
(ref) => create(ref as CustomAppsRef),
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
publisherName: publisherName,
projectId: projectId,
),
); );
}
CustomAppsProvider call(String publisherName, String projectId) =>
CustomAppsProvider._(argument: (publisherName, projectId), from: this);
@override @override
AutoDisposeFutureProviderElement<List<CustomApp>> createElement() { String toString() => r'customAppsProvider';
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);
}
} }
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin CustomAppsRef on AutoDisposeFutureProviderRef<List<CustomApp>> {
/// The parameter `publisherName` of this provider.
String get publisherName;
/// The parameter `projectId` of this provider.
String get projectId;
}
class _CustomAppsProviderElement
extends AutoDisposeFutureProviderElement<List<CustomApp>>
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

View File

@@ -6,167 +6,89 @@ part of 'bot_keys.dart';
// RiverpodGenerator // 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) @ProviderFor(botKeys)
const botKeysProvider = BotKeysFamily(); const botKeysProvider = BotKeysFamily._();
/// See also [botKeys]. final class BotKeysProvider
class BotKeysFamily extends Family<AsyncValue<List<SnAccountApiKey>>> { extends
/// See also [botKeys]. $FunctionalProvider<
const BotKeysFamily(); AsyncValue<List<SnAccountApiKey>>,
List<SnAccountApiKey>,
/// See also [botKeys]. FutureOr<List<SnAccountApiKey>>
BotKeysProvider call(String publisherName, String projectId, String botId) { >
return BotKeysProvider(publisherName, projectId, botId); with
} $FutureModifier<List<SnAccountApiKey>>,
$FutureProvider<List<SnAccountApiKey>> {
@override const BotKeysProvider._({
BotKeysProvider getProviderOverride(covariant BotKeysProvider provider) { required BotKeysFamily super.from,
return call(provider.publisherName, provider.projectId, provider.botId); required (String, String, String) super.argument,
} }) : super(
retry: null,
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'botKeysProvider';
}
/// See also [botKeys].
class BotKeysProvider extends AutoDisposeFutureProvider<List<SnAccountApiKey>> {
/// 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', name: r'botKeysProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$botKeysHash();
FutureOr<List<SnAccountApiKey>> Function(BotKeysRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'botKeysProvider'
override: BotKeysProvider._internal( ''
(ref) => create(ref as BotKeysRef), '$argument';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
publisherName: publisherName,
projectId: projectId,
botId: botId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<SnAccountApiKey>> createElement() { $FutureProviderElement<List<SnAccountApiKey>> $createElement(
return _BotKeysProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnAccountApiKey>> create(Ref ref) {
final argument = this.argument as (String, String, String);
return botKeys(ref, argument.$1, argument.$2, argument.$3);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is BotKeysProvider && return other is BotKeysProvider && other.argument == argument;
other.publisherName == publisherName &&
other.projectId == projectId &&
other.botId == botId;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, publisherName.hashCode);
hash = _SystemHash.combine(hash, projectId.hashCode);
hash = _SystemHash.combine(hash, botId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$botKeysHash() => r'f7d1121833dc3da0cbd84b6171c2b2539edeb785';
// ignore: unused_element
mixin BotKeysRef on AutoDisposeFutureProviderRef<List<SnAccountApiKey>> {
/// The parameter `publisherName` of this provider.
String get publisherName;
/// The parameter `projectId` of this provider. final class BotKeysFamily extends $Family
String get projectId; with
$FunctionalFamilyOverride<
FutureOr<List<SnAccountApiKey>>,
(String, String, String)
> {
const BotKeysFamily._()
: super(
retry: null,
name: r'botKeysProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
/// The parameter `botId` of this provider. BotKeysProvider call(String publisherName, String projectId, String botId) =>
String get botId; BotKeysProvider._(
argument: (publisherName, projectId, botId),
from: this,
);
@override
String toString() => r'botKeysProvider';
} }
class _BotKeysProviderElement
extends AutoDisposeFutureProviderElement<List<SnAccountApiKey>>
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

View File

@@ -6,151 +6,79 @@ part of 'bots.dart';
// RiverpodGenerator // 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) @ProviderFor(bots)
const botsProvider = BotsFamily(); const botsProvider = BotsFamily._();
/// See also [bots]. final class BotsProvider
class BotsFamily extends Family<AsyncValue<List<Bot>>> { extends
/// See also [bots]. $FunctionalProvider<
const BotsFamily(); AsyncValue<List<Bot>>,
List<Bot>,
/// See also [bots]. FutureOr<List<Bot>>
BotsProvider call(String publisherName, String projectId) { >
return BotsProvider(publisherName, projectId); with $FutureModifier<List<Bot>>, $FutureProvider<List<Bot>> {
} const BotsProvider._({
required BotsFamily super.from,
@override required (String, String) super.argument,
BotsProvider getProviderOverride(covariant BotsProvider provider) { }) : super(
return call(provider.publisherName, provider.projectId); retry: null,
}
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'botsProvider';
}
/// See also [bots].
class BotsProvider extends AutoDisposeFutureProvider<List<Bot>> {
/// See also [bots].
BotsProvider(String publisherName, String projectId)
: this._internal(
(ref) => bots(ref as BotsRef, publisherName, projectId),
from: botsProvider,
name: r'botsProvider', name: r'botsProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') ? null : _$botsHash, dependencies: null,
dependencies: BotsFamily._dependencies, $allTransitiveDependencies: null,
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
Override overrideWith(FutureOr<List<Bot>> Function(BotsRef provider) create) { String debugGetCreateSourceHash() => _$botsHash();
return ProviderOverride(
origin: this, @override
override: BotsProvider._internal( String toString() {
(ref) => create(ref as BotsRef), return r'botsProvider'
from: from, ''
name: null, '$argument';
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
publisherName: publisherName,
projectId: projectId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<Bot>> createElement() { $FutureProviderElement<List<Bot>> $createElement($ProviderPointer pointer) =>
return _BotsProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<List<Bot>> create(Ref ref) {
final argument = this.argument as (String, String);
return bots(ref, argument.$1, argument.$2);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is BotsProvider && return other is BotsProvider && other.argument == argument;
other.publisherName == publisherName &&
other.projectId == projectId;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, publisherName.hashCode);
hash = _SystemHash.combine(hash, projectId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$botsHash() => r'15cefd5781350eb68208a342e85fcb0b9e0e3269';
// ignore: unused_element
mixin BotsRef on AutoDisposeFutureProviderRef<List<Bot>> {
/// The parameter `publisherName` of this provider.
String get publisherName;
/// The parameter `projectId` of this provider. final class BotsFamily extends $Family
String get projectId; with $FunctionalFamilyOverride<FutureOr<List<Bot>>, (String, String)> {
} const BotsFamily._()
: super(
retry: null,
name: r'botsProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
class _BotsProviderElement extends AutoDisposeFutureProviderElement<List<Bot>> BotsProvider call(String publisherName, String projectId) =>
with BotsRef { BotsProvider._(argument: (publisherName, projectId), from: this);
_BotsProviderElement(super.provider);
@override @override
String get publisherName => (origin as BotsProvider).publisherName; String toString() => r'botsProvider';
@override
String get projectId => (origin as BotsProvider).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

View File

@@ -6,167 +6,83 @@ part of 'edit_app.dart';
// RiverpodGenerator // 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) @ProviderFor(customApp)
const customAppProvider = CustomAppFamily(); const customAppProvider = CustomAppFamily._();
/// See also [customApp]. final class CustomAppProvider
class CustomAppFamily extends Family<AsyncValue<CustomApp?>> { extends
/// See also [customApp]. $FunctionalProvider<
const CustomAppFamily(); AsyncValue<CustomApp?>,
CustomApp?,
/// See also [customApp]. FutureOr<CustomApp?>
CustomAppProvider call(String publisherName, String projectId, String id) { >
return CustomAppProvider(publisherName, projectId, id); with $FutureModifier<CustomApp?>, $FutureProvider<CustomApp?> {
} const CustomAppProvider._({
required CustomAppFamily super.from,
@override required (String, String, String) super.argument,
CustomAppProvider getProviderOverride(covariant CustomAppProvider provider) { }) : super(
return call(provider.publisherName, provider.projectId, provider.id); retry: null,
}
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'customAppProvider';
}
/// See also [customApp].
class CustomAppProvider extends AutoDisposeFutureProvider<CustomApp?> {
/// 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', name: r'customAppProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$customAppHash();
FutureOr<CustomApp?> Function(CustomAppRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'customAppProvider'
override: CustomAppProvider._internal( ''
(ref) => create(ref as CustomAppRef), '$argument';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
publisherName: publisherName,
projectId: projectId,
id: id,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<CustomApp?> createElement() { $FutureProviderElement<CustomApp?> $createElement($ProviderPointer pointer) =>
return _CustomAppProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<CustomApp?> create(Ref ref) {
final argument = this.argument as (String, String, String);
return customApp(ref, argument.$1, argument.$2, argument.$3);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is CustomAppProvider && return other is CustomAppProvider && other.argument == argument;
other.publisherName == publisherName &&
other.projectId == projectId &&
other.id == id;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, publisherName.hashCode);
hash = _SystemHash.combine(hash, projectId.hashCode);
hash = _SystemHash.combine(hash, id.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$customAppHash() => r'8e1b38f3dc9b04fad362ee1141fcbfc53f008c09';
// ignore: unused_element
mixin CustomAppRef on AutoDisposeFutureProviderRef<CustomApp?> {
/// The parameter `publisherName` of this provider.
String get publisherName;
/// The parameter `projectId` of this provider. final class CustomAppFamily extends $Family
String get projectId; with
$FunctionalFamilyOverride<
FutureOr<CustomApp?>,
(String, String, String)
> {
const CustomAppFamily._()
: super(
retry: null,
name: r'customAppProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
/// The parameter `id` of this provider. CustomAppProvider call(String publisherName, String projectId, String id) =>
String get id; CustomAppProvider._(argument: (publisherName, projectId, id), from: this);
@override
String toString() => r'customAppProvider';
} }
class _CustomAppProviderElement
extends AutoDisposeFutureProviderElement<CustomApp?>
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

View File

@@ -6,162 +6,74 @@ part of 'edit_bot.dart';
// RiverpodGenerator // 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) @ProviderFor(bot)
const botProvider = BotFamily(); const botProvider = BotFamily._();
/// See also [bot]. final class BotProvider
class BotFamily extends Family<AsyncValue<Bot?>> { extends $FunctionalProvider<AsyncValue<Bot?>, Bot?, FutureOr<Bot?>>
/// See also [bot]. with $FutureModifier<Bot?>, $FutureProvider<Bot?> {
const BotFamily(); const BotProvider._({
required BotFamily super.from,
/// See also [bot]. required (String, String, String) super.argument,
BotProvider call(String publisherName, String projectId, String id) { }) : super(
return BotProvider(publisherName, projectId, id); retry: null,
}
@override
BotProvider getProviderOverride(covariant BotProvider provider) {
return call(provider.publisherName, provider.projectId, provider.id);
}
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'botProvider';
}
/// See also [bot].
class BotProvider extends AutoDisposeFutureProvider<Bot?> {
/// 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', name: r'botProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') ? null : _$botHash, dependencies: null,
dependencies: BotFamily._dependencies, $allTransitiveDependencies: null,
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
Override overrideWith(FutureOr<Bot?> Function(BotRef provider) create) { String debugGetCreateSourceHash() => _$botHash();
return ProviderOverride(
origin: this, @override
override: BotProvider._internal( String toString() {
(ref) => create(ref as BotRef), return r'botProvider'
from: from, ''
name: null, '$argument';
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
publisherName: publisherName,
projectId: projectId,
id: id,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<Bot?> createElement() { $FutureProviderElement<Bot?> $createElement($ProviderPointer pointer) =>
return _BotProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<Bot?> create(Ref ref) {
final argument = this.argument as (String, String, String);
return bot(ref, argument.$1, argument.$2, argument.$3);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is BotProvider && return other is BotProvider && other.argument == argument;
other.publisherName == publisherName &&
other.projectId == projectId &&
other.id == id;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, publisherName.hashCode);
hash = _SystemHash.combine(hash, projectId.hashCode);
hash = _SystemHash.combine(hash, id.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$botHash() => r'7bec47bb2a4061a5babc6d6d19c3d4c320c91188';
// ignore: unused_element
mixin BotRef on AutoDisposeFutureProviderRef<Bot?> {
/// The parameter `publisherName` of this provider.
String get publisherName;
/// The parameter `projectId` of this provider. final class BotFamily extends $Family
String get projectId; with $FunctionalFamilyOverride<FutureOr<Bot?>, (String, String, String)> {
const BotFamily._()
: super(
retry: null,
name: r'botProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
/// The parameter `id` of this provider. BotProvider call(String publisherName, String projectId, String id) =>
String get id; BotProvider._(argument: (publisherName, projectId, id), from: this);
@override
String toString() => r'botProvider';
} }
class _BotProviderElement extends AutoDisposeFutureProviderElement<Bot?>
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

View File

@@ -6,158 +6,80 @@ part of 'edit_project.dart';
// RiverpodGenerator // 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) @ProviderFor(devProject)
const devProjectProvider = DevProjectFamily(); const devProjectProvider = DevProjectFamily._();
/// See also [devProject]. final class DevProjectProvider
class DevProjectFamily extends Family<AsyncValue<DevProject?>> { extends
/// See also [devProject]. $FunctionalProvider<
const DevProjectFamily(); AsyncValue<DevProject?>,
DevProject?,
/// See also [devProject]. FutureOr<DevProject?>
DevProjectProvider call(String pubName, String id) { >
return DevProjectProvider(pubName, id); with $FutureModifier<DevProject?>, $FutureProvider<DevProject?> {
} const DevProjectProvider._({
required DevProjectFamily super.from,
@override required (String, String) super.argument,
DevProjectProvider getProviderOverride( }) : super(
covariant DevProjectProvider provider, retry: null,
) {
return call(provider.pubName, provider.id);
}
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'devProjectProvider';
}
/// See also [devProject].
class DevProjectProvider extends AutoDisposeFutureProvider<DevProject?> {
/// See also [devProject].
DevProjectProvider(String pubName, String id)
: this._internal(
(ref) => devProject(ref as DevProjectRef, pubName, id),
from: devProjectProvider,
name: r'devProjectProvider', name: r'devProjectProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$devProjectHash();
FutureOr<DevProject?> Function(DevProjectRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'devProjectProvider'
override: DevProjectProvider._internal( ''
(ref) => create(ref as DevProjectRef), '$argument';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
pubName: pubName,
id: id,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<DevProject?> createElement() { $FutureProviderElement<DevProject?> $createElement(
return _DevProjectProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<DevProject?> create(Ref ref) {
final argument = this.argument as (String, String);
return devProject(ref, argument.$1, argument.$2);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is DevProjectProvider && return other is DevProjectProvider && other.argument == argument;
other.pubName == pubName &&
other.id == id;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, pubName.hashCode);
hash = _SystemHash.combine(hash, id.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$devProjectHash() => r'd92be3f5cdc510c2a377615ed5c70622a6842bf2';
// ignore: unused_element
mixin DevProjectRef on AutoDisposeFutureProviderRef<DevProject?> {
/// The parameter `pubName` of this provider.
String get pubName;
/// The parameter `id` of this provider. final class DevProjectFamily extends $Family
String get id; with $FunctionalFamilyOverride<FutureOr<DevProject?>, (String, String)> {
} const DevProjectFamily._()
: super(
retry: null,
name: r'devProjectProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
class _DevProjectProviderElement DevProjectProvider call(String pubName, String id) =>
extends AutoDisposeFutureProviderElement<DevProject?> DevProjectProvider._(argument: (pubName, id), from: this);
with DevProjectRef {
_DevProjectProviderElement(super.provider);
@override @override
String get pubName => (origin as DevProjectProvider).pubName; String toString() => r'devProjectProvider';
@override
String get id => (origin as DevProjectProvider).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

View File

@@ -6,287 +6,196 @@ part of 'hub.dart';
// RiverpodGenerator // 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) @ProviderFor(developerStats)
const developerStatsProvider = DeveloperStatsFamily(); const developerStatsProvider = DeveloperStatsFamily._();
/// See also [developerStats]. final class DeveloperStatsProvider
class DeveloperStatsFamily extends Family<AsyncValue<DeveloperStats?>> { extends
/// See also [developerStats]. $FunctionalProvider<
const DeveloperStatsFamily(); AsyncValue<DeveloperStats?>,
DeveloperStats?,
/// See also [developerStats]. FutureOr<DeveloperStats?>
DeveloperStatsProvider call(String? uname) { >
return DeveloperStatsProvider(uname); with $FutureModifier<DeveloperStats?>, $FutureProvider<DeveloperStats?> {
} const DeveloperStatsProvider._({
required DeveloperStatsFamily super.from,
@override required String? super.argument,
DeveloperStatsProvider getProviderOverride( }) : super(
covariant DeveloperStatsProvider provider, retry: null,
) {
return call(provider.uname);
}
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'developerStatsProvider';
}
/// See also [developerStats].
class DeveloperStatsProvider
extends AutoDisposeFutureProvider<DeveloperStats?> {
/// See also [developerStats].
DeveloperStatsProvider(String? uname)
: this._internal(
(ref) => developerStats(ref as DeveloperStatsRef, uname),
from: developerStatsProvider,
name: r'developerStatsProvider', name: r'developerStatsProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$developerStatsHash();
FutureOr<DeveloperStats?> Function(DeveloperStatsRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'developerStatsProvider'
override: DeveloperStatsProvider._internal( ''
(ref) => create(ref as DeveloperStatsRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
uname: uname,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<DeveloperStats?> createElement() { $FutureProviderElement<DeveloperStats?> $createElement(
return _DeveloperStatsProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<DeveloperStats?> create(Ref ref) {
final argument = this.argument as String?;
return developerStats(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is DeveloperStatsProvider && other.uname == uname; return other is DeveloperStatsProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, uname.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$developerStatsHash() => r'45546f29ec7cd1a9c3a4e0f4e39275e78bf34755';
// ignore: unused_element
mixin DeveloperStatsRef on AutoDisposeFutureProviderRef<DeveloperStats?> {
/// The parameter `uname` of this provider.
String? get uname;
}
class _DeveloperStatsProviderElement final class DeveloperStatsFamily extends $Family
extends AutoDisposeFutureProviderElement<DeveloperStats?> with $FunctionalFamilyOverride<FutureOr<DeveloperStats?>, String?> {
with DeveloperStatsRef { const DeveloperStatsFamily._()
_DeveloperStatsProviderElement(super.provider); : super(
retry: null,
name: r'developerStatsProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
DeveloperStatsProvider call(String? uname) =>
DeveloperStatsProvider._(argument: uname, from: this);
@override @override
String? get uname => (origin as DeveloperStatsProvider).uname; String toString() => r'developerStatsProvider';
}
@ProviderFor(developers)
const developersProvider = DevelopersProvider._();
final class DevelopersProvider
extends
$FunctionalProvider<
AsyncValue<List<SnDeveloper>>,
List<SnDeveloper>,
FutureOr<List<SnDeveloper>>
>
with
$FutureModifier<List<SnDeveloper>>,
$FutureProvider<List<SnDeveloper>> {
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<List<SnDeveloper>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnDeveloper>> create(Ref ref) {
return developers(ref);
}
} }
String _$developersHash() => r'252341098617ac398ce133994453f318dd3edbd2'; String _$developersHash() => r'252341098617ac398ce133994453f318dd3edbd2';
/// See also [developers].
@ProviderFor(developers)
final developersProvider =
AutoDisposeFutureProvider<List<SnDeveloper>>.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<List<SnDeveloper>>;
String _$devProjectsHash() => r'715b395bebda785d38691ffee3b88e50b498c91a';
/// See also [devProjects].
@ProviderFor(devProjects) @ProviderFor(devProjects)
const devProjectsProvider = DevProjectsFamily(); const devProjectsProvider = DevProjectsFamily._();
/// See also [devProjects]. final class DevProjectsProvider
class DevProjectsFamily extends Family<AsyncValue<List<DevProject>>> { extends
/// See also [devProjects]. $FunctionalProvider<
const DevProjectsFamily(); AsyncValue<List<DevProject>>,
List<DevProject>,
/// See also [devProjects]. FutureOr<List<DevProject>>
DevProjectsProvider call(String pubName) { >
return DevProjectsProvider(pubName); with $FutureModifier<List<DevProject>>, $FutureProvider<List<DevProject>> {
} const DevProjectsProvider._({
required DevProjectsFamily super.from,
@override required String super.argument,
DevProjectsProvider getProviderOverride( }) : super(
covariant DevProjectsProvider provider, retry: null,
) {
return call(provider.pubName);
}
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'devProjectsProvider';
}
/// See also [devProjects].
class DevProjectsProvider extends AutoDisposeFutureProvider<List<DevProject>> {
/// See also [devProjects].
DevProjectsProvider(String pubName)
: this._internal(
(ref) => devProjects(ref as DevProjectsRef, pubName),
from: devProjectsProvider,
name: r'devProjectsProvider', name: r'devProjectsProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$devProjectsHash();
FutureOr<List<DevProject>> Function(DevProjectsRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'devProjectsProvider'
override: DevProjectsProvider._internal( ''
(ref) => create(ref as DevProjectsRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
pubName: pubName,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<DevProject>> createElement() { $FutureProviderElement<List<DevProject>> $createElement(
return _DevProjectsProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<DevProject>> create(Ref ref) {
final argument = this.argument as String;
return devProjects(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is DevProjectsProvider && other.pubName == pubName; return other is DevProjectsProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, pubName.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$devProjectsHash() => r'715b395bebda785d38691ffee3b88e50b498c91a';
// ignore: unused_element
mixin DevProjectsRef on AutoDisposeFutureProviderRef<List<DevProject>> {
/// The parameter `pubName` of this provider.
String get pubName;
}
class _DevProjectsProviderElement final class DevProjectsFamily extends $Family
extends AutoDisposeFutureProviderElement<List<DevProject>> with $FunctionalFamilyOverride<FutureOr<List<DevProject>>, String> {
with DevProjectsRef { const DevProjectsFamily._()
_DevProjectsProviderElement(super.provider); : super(
retry: null,
name: r'devProjectsProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
DevProjectsProvider call(String pubName) =>
DevProjectsProvider._(argument: pubName, from: this);
@override @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

View File

@@ -22,11 +22,13 @@ final articlesListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
ArticlesListNotifier.new, ArticlesListNotifier.new,
); );
class ArticlesListNotifier class ArticlesListNotifier extends AsyncNotifier<List<SnWebArticle>>
extends AutoDisposeFamilyAsyncNotifier<List<SnWebArticle>, ArticleListQuery> with AsyncPaginationController<SnWebArticle> {
with FamilyAsyncPaginationController<SnWebArticle, ArticleListQuery> {
static const int pageSize = 20; static const int pageSize = 20;
final ArticleListQuery arg;
ArticlesListNotifier(this.arg);
@override @override
Future<List<SnWebArticle>> fetch() async { Future<List<SnWebArticle>> fetch() async {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);

View File

@@ -6,24 +6,44 @@ part of 'articles.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$subscribedFeedsHash() => r'5c0c8c30c5f543f6ea1d39786a6778f77ba5b3df'; // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
/// See also [subscribedFeeds].
@ProviderFor(subscribedFeeds) @ProviderFor(subscribedFeeds)
final subscribedFeedsProvider = const subscribedFeedsProvider = SubscribedFeedsProvider._();
AutoDisposeFutureProvider<List<SnWebFeed>>.internal(
subscribedFeeds, final class SubscribedFeedsProvider
extends
$FunctionalProvider<
AsyncValue<List<SnWebFeed>>,
List<SnWebFeed>,
FutureOr<List<SnWebFeed>>
>
with $FutureModifier<List<SnWebFeed>>, $FutureProvider<List<SnWebFeed>> {
const SubscribedFeedsProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'subscribedFeedsProvider', name: r'subscribedFeedsProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product')
? null
: _$subscribedFeedsHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
); );
@Deprecated('Will be removed in 3.0. Use Ref instead') @override
// ignore: unused_element String debugGetCreateSourceHash() => _$subscribedFeedsHash();
typedef SubscribedFeedsRef = AutoDisposeFutureProviderRef<List<SnWebFeed>>;
// ignore_for_file: type=lint @$internal
// 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 @override
$FutureProviderElement<List<SnWebFeed>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnWebFeed>> create(Ref ref) {
return subscribedFeeds(ref);
}
}
String _$subscribedFeedsHash() => r'5c0c8c30c5f543f6ea1d39786a6778f77ba5b3df';

View File

@@ -26,10 +26,13 @@ final marketplaceWebFeedContentNotifierProvider = AsyncNotifierProvider.family
.autoDispose(MarketplaceWebFeedContentNotifier.new); .autoDispose(MarketplaceWebFeedContentNotifier.new);
class MarketplaceWebFeedContentNotifier class MarketplaceWebFeedContentNotifier
extends AutoDisposeFamilyAsyncNotifier<List<SnWebArticle>, String> extends AsyncNotifier<List<SnWebArticle>>
with FamilyAsyncPaginationController<SnWebArticle, String> { with AsyncPaginationController<SnWebArticle> {
static const int pageSize = 20; static const int pageSize = 20;
final String arg;
MarketplaceWebFeedContentNotifier(this.arg);
@override @override
Future<List<SnWebArticle>> fetch() async { Future<List<SnWebArticle>> fetch() async {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);

View File

@@ -6,289 +6,161 @@ part of 'feed_detail.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$marketplaceWebFeedHash() => // GENERATED CODE - DO NOT MODIFY BY HAND
r'8383f94f1bc272b903c341b8d95000313b69d14c'; // 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) @ProviderFor(marketplaceWebFeed)
const marketplaceWebFeedProvider = MarketplaceWebFeedFamily(); const marketplaceWebFeedProvider = MarketplaceWebFeedFamily._();
/// See also [marketplaceWebFeed]. final class MarketplaceWebFeedProvider
class MarketplaceWebFeedFamily extends Family<AsyncValue<SnWebFeed>> { extends
/// See also [marketplaceWebFeed]. $FunctionalProvider<
const MarketplaceWebFeedFamily(); AsyncValue<SnWebFeed>,
SnWebFeed,
/// See also [marketplaceWebFeed]. FutureOr<SnWebFeed>
MarketplaceWebFeedProvider call(String feedId) { >
return MarketplaceWebFeedProvider(feedId); with $FutureModifier<SnWebFeed>, $FutureProvider<SnWebFeed> {
} const MarketplaceWebFeedProvider._({
required MarketplaceWebFeedFamily super.from,
@override required String super.argument,
MarketplaceWebFeedProvider getProviderOverride( }) : super(
covariant MarketplaceWebFeedProvider provider, retry: null,
) {
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'marketplaceWebFeedProvider';
}
/// See also [marketplaceWebFeed].
class MarketplaceWebFeedProvider extends AutoDisposeFutureProvider<SnWebFeed> {
/// See also [marketplaceWebFeed].
MarketplaceWebFeedProvider(String feedId)
: this._internal(
(ref) => marketplaceWebFeed(ref as MarketplaceWebFeedRef, feedId),
from: marketplaceWebFeedProvider,
name: r'marketplaceWebFeedProvider', name: r'marketplaceWebFeedProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$marketplaceWebFeedHash();
FutureOr<SnWebFeed> Function(MarketplaceWebFeedRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'marketplaceWebFeedProvider'
override: MarketplaceWebFeedProvider._internal( ''
(ref) => create(ref as MarketplaceWebFeedRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
feedId: feedId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnWebFeed> createElement() { $FutureProviderElement<SnWebFeed> $createElement($ProviderPointer pointer) =>
return _MarketplaceWebFeedProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<SnWebFeed> create(Ref ref) {
final argument = this.argument as String;
return marketplaceWebFeed(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is MarketplaceWebFeedProvider && other.feedId == feedId; return other is MarketplaceWebFeedProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, feedId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$marketplaceWebFeedHash() =>
// ignore: unused_element r'8383f94f1bc272b903c341b8d95000313b69d14c';
mixin MarketplaceWebFeedRef on AutoDisposeFutureProviderRef<SnWebFeed> {
/// The parameter `feedId` of this provider.
String get feedId;
}
class _MarketplaceWebFeedProviderElement final class MarketplaceWebFeedFamily extends $Family
extends AutoDisposeFutureProviderElement<SnWebFeed> with $FunctionalFamilyOverride<FutureOr<SnWebFeed>, String> {
with MarketplaceWebFeedRef { const MarketplaceWebFeedFamily._()
_MarketplaceWebFeedProviderElement(super.provider); : super(
retry: null,
name: r'marketplaceWebFeedProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
MarketplaceWebFeedProvider call(String feedId) =>
MarketplaceWebFeedProvider._(argument: feedId, from: this);
@override @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<AsyncValue<bool>, bool, FutureOr<bool>>
with $FutureModifier<bool>, $FutureProvider<bool> {
/// 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<bool> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<bool> 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() => String _$marketplaceWebFeedSubscriptionHash() =>
r'2ff06a48ed7d4236b57412ecca55e94c0a0b6330'; r'2ff06a48ed7d4236b57412ecca55e94c0a0b6330';
/// Provider for web feed subscription status /// Provider for web feed subscription status
///
/// Copied from [marketplaceWebFeedSubscription].
@ProviderFor(marketplaceWebFeedSubscription)
const marketplaceWebFeedSubscriptionProvider =
MarketplaceWebFeedSubscriptionFamily();
/// Provider for web feed subscription status final class MarketplaceWebFeedSubscriptionFamily extends $Family
/// with $FunctionalFamilyOverride<FutureOr<bool>, String> {
/// Copied from [marketplaceWebFeedSubscription]. const MarketplaceWebFeedSubscriptionFamily._()
class MarketplaceWebFeedSubscriptionFamily extends Family<AsyncValue<bool>> { : super(
/// Provider for web feed subscription status retry: null,
///
/// 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<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'marketplaceWebFeedSubscriptionProvider';
}
/// Provider for web feed subscription status
///
/// Copied from [marketplaceWebFeedSubscription].
class MarketplaceWebFeedSubscriptionProvider
extends AutoDisposeFutureProvider<bool> {
/// Provider for web feed subscription status
///
/// Copied from [marketplaceWebFeedSubscription].
MarketplaceWebFeedSubscriptionProvider({required String feedId})
: this._internal(
(ref) => marketplaceWebFeedSubscription(
ref as MarketplaceWebFeedSubscriptionRef,
feedId: feedId,
),
from: marketplaceWebFeedSubscriptionProvider,
name: r'marketplaceWebFeedSubscriptionProvider', name: r'marketplaceWebFeedSubscriptionProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$marketplaceWebFeedSubscriptionHash,
dependencies: MarketplaceWebFeedSubscriptionFamily._dependencies,
allTransitiveDependencies:
MarketplaceWebFeedSubscriptionFamily._allTransitiveDependencies,
feedId: feedId,
);
MarketplaceWebFeedSubscriptionProvider._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<bool> Function(MarketplaceWebFeedSubscriptionRef provider) create,
) {
return ProviderOverride(
origin: this,
override: MarketplaceWebFeedSubscriptionProvider._internal(
(ref) => create(ref as MarketplaceWebFeedSubscriptionRef),
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
feedId: feedId,
),
); );
}
/// Provider for web feed subscription status
MarketplaceWebFeedSubscriptionProvider call({required String feedId}) =>
MarketplaceWebFeedSubscriptionProvider._(argument: feedId, from: this);
@override @override
AutoDisposeFutureProviderElement<bool> createElement() { String toString() => r'marketplaceWebFeedSubscriptionProvider';
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);
}
} }
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin MarketplaceWebFeedSubscriptionRef on AutoDisposeFutureProviderRef<bool> {
/// The parameter `feedId` of this provider.
String get feedId;
}
class _MarketplaceWebFeedSubscriptionProviderElement
extends AutoDisposeFutureProviderElement<bool>
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

View File

@@ -73,19 +73,21 @@ class ExploreScreen extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final currentFilter = useState<String?>(null); final currentFilter = useState<String?>(null);
final notifier = ref.watch(activityListNotifierProvider.notifier); final notifier = ref.watch(activityListProvider.notifier);
useEffect(() { useEffect(() {
// Set FAB type to chat // Set FAB type to chat
final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier); final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier);
Future(() { Future(() {
fabMenuNotifier.state = FabMenuType.compose; fabMenuNotifier.setMenuType(FabMenuType.compose);
}); });
return () { return () {
// Clean up: reset FAB type to main // Clean up: reset FAB type to main
final fabMenu = ref.read(fabMenuTypeProvider);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (fabMenuNotifier.state == FabMenuType.compose) { if (fabMenu == FabMenuType.compose) {
fabMenuNotifier.state = FabMenuType.main; fabMenuNotifier.setMenuType(FabMenuType.main);
} }
}); });
}; };
@@ -99,7 +101,7 @@ class ExploreScreen extends HookConsumerWidget {
// Listen for post creation events to refresh activities // Listen for post creation events to refresh activities
useEffect(() { useEffect(() {
final subscription = eventBus.on<PostCreatedEvent>().listen((event) { final subscription = eventBus.on<PostCreatedEvent>().listen((event) {
ref.invalidate(activityListNotifierProvider); ref.invalidate(activityListProvider);
}); });
return subscription.cancel; return subscription.cancel;
}, []); }, []);
@@ -116,9 +118,7 @@ class ExploreScreen extends HookConsumerWidget {
final user = ref.watch(userInfoProvider); final user = ref.watch(userInfoProvider);
final notificationCount = ref.watch( final notificationCount = ref.watch(notificationUnreadCountProvider);
notificationUnreadCountNotifierProvider,
);
final isWide = isWideScreen(context); final isWide = isWideScreen(context);
@@ -316,8 +316,8 @@ class ExploreScreen extends HookConsumerWidget {
final isWide = isWideScreen(context); final isWide = isWideScreen(context);
return PaginationWidget( return PaginationWidget(
provider: activityListNotifierProvider, provider: activityListProvider,
notifier: activityListNotifierProvider.notifier, notifier: activityListProvider.notifier,
// Sliver list cannot provide refresh handled by the pagination list // Sliver list cannot provide refresh handled by the pagination list
isRefreshable: false, isRefreshable: false,
isSliver: true, isSliver: true,
@@ -339,7 +339,7 @@ class ExploreScreen extends HookConsumerWidget {
) { ) {
final bodyView = _buildActivityList(context, ref); final bodyView = _buildActivityList(context, ref);
final notifier = ref.watch(activityListNotifierProvider.notifier); final notifier = ref.watch(activityListProvider.notifier);
return Row( return Row(
spacing: 12, spacing: 12,
@@ -557,13 +557,11 @@ class ExploreScreen extends HookConsumerWidget {
String? currentFilter, String? currentFilter,
) { ) {
final user = ref.watch(userInfoProvider); final user = ref.watch(userInfoProvider);
final notificationCount = ref.watch( final notificationCount = ref.watch(notificationUnreadCountProvider);
notificationUnreadCountNotifierProvider,
);
final bodyView = _buildActivityList(context, ref); final bodyView = _buildActivityList(context, ref);
final notifier = ref.watch(activityListNotifierProvider.notifier); final notifier = ref.watch(activityListProvider.notifier);
return Expanded( return Expanded(
child: ClipRRect( child: ClipRRect(
@@ -737,7 +735,7 @@ class _ActivityListView extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final notifier = ref.watch(activityListNotifierProvider.notifier); final notifier = ref.watch(activityListProvider.notifier);
return SliverList.separated( return SliverList.separated(
itemCount: data.length + 1, itemCount: data.length + 1,

View File

@@ -116,7 +116,7 @@ class FileListScreen extends HookConsumerWidget {
completer.future completer.future
.then((uploadedFile) { .then((uploadedFile) {
if (uploadedFile != null) { if (uploadedFile != null) {
ref.invalidate(indexedCloudFileListNotifierProvider); ref.invalidate(indexedCloudFileListProvider);
} }
}) })
.catchError((error) { .catchError((error) {

View File

@@ -6,302 +6,173 @@ part of 'lottery.dart';
// RiverpodGenerator // 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) @ProviderFor(lotteryTickets)
const lotteryTicketsProvider = LotteryTicketsFamily(); const lotteryTicketsProvider = LotteryTicketsFamily._();
/// See also [lotteryTickets]. final class LotteryTicketsProvider
class LotteryTicketsFamily extends Family<AsyncValue<List<SnLotteryTicket>>> { extends
/// See also [lotteryTickets]. $FunctionalProvider<
const LotteryTicketsFamily(); AsyncValue<List<SnLotteryTicket>>,
List<SnLotteryTicket>,
/// See also [lotteryTickets]. FutureOr<List<SnLotteryTicket>>
LotteryTicketsProvider call({int offset = 0, int take = 20}) { >
return LotteryTicketsProvider(offset: offset, take: take); with
} $FutureModifier<List<SnLotteryTicket>>,
$FutureProvider<List<SnLotteryTicket>> {
@override const LotteryTicketsProvider._({
LotteryTicketsProvider getProviderOverride( required LotteryTicketsFamily super.from,
covariant LotteryTicketsProvider provider, required ({int offset, int take}) super.argument,
) { }) : super(
return call(offset: provider.offset, take: provider.take); retry: null,
}
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'lotteryTicketsProvider';
}
/// See also [lotteryTickets].
class LotteryTicketsProvider
extends AutoDisposeFutureProvider<List<SnLotteryTicket>> {
/// 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', name: r'lotteryTicketsProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$lotteryTicketsHash();
FutureOr<List<SnLotteryTicket>> Function(LotteryTicketsRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'lotteryTicketsProvider'
override: LotteryTicketsProvider._internal( ''
(ref) => create(ref as LotteryTicketsRef), '$argument';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
offset: offset,
take: take,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<SnLotteryTicket>> createElement() { $FutureProviderElement<List<SnLotteryTicket>> $createElement(
return _LotteryTicketsProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnLotteryTicket>> create(Ref ref) {
final argument = this.argument as ({int offset, int take});
return lotteryTickets(ref, offset: argument.offset, take: argument.take);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is LotteryTicketsProvider && return other is LotteryTicketsProvider && other.argument == argument;
other.offset == offset &&
other.take == take;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, offset.hashCode);
hash = _SystemHash.combine(hash, take.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$lotteryTicketsHash() => r'dd17cd721fc3b176ffa0ee0a85d0d850740e5e80';
// ignore: unused_element
mixin LotteryTicketsRef on AutoDisposeFutureProviderRef<List<SnLotteryTicket>> {
/// The parameter `offset` of this provider.
int get offset;
/// The parameter `take` of this provider. final class LotteryTicketsFamily extends $Family
int get take; with
$FunctionalFamilyOverride<
FutureOr<List<SnLotteryTicket>>,
({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 @ProviderFor(lotteryRecords)
extends AutoDisposeFutureProviderElement<List<SnLotteryTicket>> const lotteryRecordsProvider = LotteryRecordsFamily._();
with LotteryTicketsRef {
_LotteryTicketsProviderElement(super.provider); final class LotteryRecordsProvider
extends
$FunctionalProvider<
AsyncValue<List<SnLotteryRecord>>,
List<SnLotteryRecord>,
FutureOr<List<SnLotteryRecord>>
>
with
$FutureModifier<List<SnLotteryRecord>>,
$FutureProvider<List<SnLotteryRecord>> {
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 @override
int get offset => (origin as LotteryTicketsProvider).offset; String debugGetCreateSourceHash() => _$lotteryRecordsHash();
@override @override
int get take => (origin as LotteryTicketsProvider).take; String toString() {
return r'lotteryRecordsProvider'
''
'$argument';
}
@$internal
@override
$FutureProviderElement<List<SnLotteryRecord>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnLotteryRecord>> 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'; String _$lotteryRecordsHash() => r'55c657460f18d9777741d09013b445ca036863f3';
/// See also [lotteryRecords]. final class LotteryRecordsFamily extends $Family
@ProviderFor(lotteryRecords) with
const lotteryRecordsProvider = LotteryRecordsFamily(); $FunctionalFamilyOverride<
FutureOr<List<SnLotteryRecord>>,
/// See also [lotteryRecords]. ({int offset, int take})
class LotteryRecordsFamily extends Family<AsyncValue<List<SnLotteryRecord>>> { > {
/// See also [lotteryRecords]. const LotteryRecordsFamily._()
const LotteryRecordsFamily(); : super(
retry: null,
/// 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<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'lotteryRecordsProvider';
}
/// See also [lotteryRecords].
class LotteryRecordsProvider
extends AutoDisposeFutureProvider<List<SnLotteryRecord>> {
/// See also [lotteryRecords].
LotteryRecordsProvider({int offset = 0, int take = 20})
: this._internal(
(ref) => lotteryRecords(
ref as LotteryRecordsRef,
offset: offset,
take: take,
),
from: lotteryRecordsProvider,
name: r'lotteryRecordsProvider', name: r'lotteryRecordsProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$lotteryRecordsHash,
dependencies: LotteryRecordsFamily._dependencies,
allTransitiveDependencies:
LotteryRecordsFamily._allTransitiveDependencies,
offset: offset,
take: take,
);
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;
@override
Override overrideWith(
FutureOr<List<SnLotteryRecord>> Function(LotteryRecordsRef provider) create,
) {
return ProviderOverride(
origin: this,
override: LotteryRecordsProvider._internal(
(ref) => create(ref as LotteryRecordsRef),
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
offset: offset, );
take: take,
), LotteryRecordsProvider call({int offset = 0, int take = 20}) =>
LotteryRecordsProvider._(
argument: (offset: offset, take: take),
from: this,
); );
}
@override @override
AutoDisposeFutureProviderElement<List<SnLotteryRecord>> createElement() { String toString() => r'lotteryRecordsProvider';
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);
}
} }
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin LotteryRecordsRef on AutoDisposeFutureProviderRef<List<SnLotteryRecord>> {
/// The parameter `offset` of this provider.
int get offset;
/// The parameter `take` of this provider.
int get take;
}
class _LotteryRecordsProviderElement
extends AutoDisposeFutureProviderElement<List<SnLotteryRecord>>
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

View File

@@ -82,7 +82,7 @@ class NotificationUnreadCountNotifier
} }
} }
final notificationListNotifierProvider = AsyncNotifierProvider( final notificationListProvider = AsyncNotifierProvider(
NotificationListNotifier.new, NotificationListNotifier.new,
); );
@@ -108,9 +108,7 @@ class NotificationListNotifier extends AsyncNotifier<List<SnNotification>>
.toList(); .toList();
final unreadCount = notifications.where((n) => n.viewedAt == null).length; final unreadCount = notifications.where((n) => n.viewedAt == null).length;
ref ref.read(notificationUnreadCountProvider.notifier).decrement(unreadCount);
.read(notificationUnreadCountNotifierProvider.notifier)
.decrement(unreadCount);
return notifications; return notifications;
} }
@@ -147,7 +145,7 @@ class NotificationSheet extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
// Refresh unread count when sheet opens to sync across devices // Refresh unread count when sheet opens to sync across devices
ref.read(notificationUnreadCountNotifierProvider.notifier).refresh(); ref.read(notificationUnreadCountProvider.notifier).refresh();
Future<void> markAllRead() async { Future<void> markAllRead() async {
showLoadingModal(context); showLoadingModal(context);
@@ -155,8 +153,8 @@ class NotificationSheet extends HookConsumerWidget {
await apiClient.post('/ring/notifications/all/read'); await apiClient.post('/ring/notifications/all/read');
if (!context.mounted) return; if (!context.mounted) return;
hideLoadingModal(context); hideLoadingModal(context);
ref.invalidate(notificationListNotifierProvider); ref.invalidate(notificationListProvider);
ref.watch(notificationUnreadCountNotifierProvider.notifier).clear(); ref.watch(notificationUnreadCountProvider.notifier).clear();
} }
return SheetScaffold( return SheetScaffold(
@@ -168,8 +166,8 @@ class NotificationSheet extends HookConsumerWidget {
), ),
], ],
child: PaginationList( child: PaginationList(
provider: notificationListNotifierProvider, provider: notificationListProvider,
notifier: notificationListNotifierProvider.notifier, notifier: notificationListProvider.notifier,
itemBuilder: (context, index, notification) { itemBuilder: (context, index, notification) {
final pfp = notification.meta['pfp'] as String?; final pfp = notification.meta['pfp'] as String?;
final images = notification.meta['images'] as List?; final images = notification.meta['images'] as List?;

View File

@@ -6,26 +6,52 @@ part of 'notification.dart';
// RiverpodGenerator // 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<NotificationUnreadCountNotifier, int> {
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() => String _$notificationUnreadCountNotifierHash() =>
r'8bff5ad3b65389589b4112add3246afd9b8e38f9'; r'8bff5ad3b65389589b4112add3246afd9b8e38f9';
/// See also [NotificationUnreadCountNotifier]. abstract class _$NotificationUnreadCountNotifier extends $AsyncNotifier<int> {
@ProviderFor(NotificationUnreadCountNotifier) FutureOr<int> build();
final notificationUnreadCountNotifierProvider = @$mustCallSuper
AutoDisposeAsyncNotifierProvider< @override
NotificationUnreadCountNotifier, void runBuild() {
int final created = build();
>.internal( final ref = this.ref as $Ref<AsyncValue<int>, int>;
NotificationUnreadCountNotifier.new, final element =
name: r'notificationUnreadCountNotifierProvider', ref.element
debugGetCreateSourceHash: as $ClassProviderElement<
const bool.fromEnvironment('dart.vm.product') AnyNotifier<AsyncValue<int>, int>,
? null AsyncValue<int>,
: _$notificationUnreadCountNotifierHash, Object?,
dependencies: null, Object?
allTransitiveDependencies: null, >;
); element.handleValue(ref, created);
}
typedef _$NotificationUnreadCountNotifier = AutoDisposeAsyncNotifier<int>; }
// 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

View File

@@ -122,7 +122,7 @@ class ArticleComposeScreen extends HookConsumerWidget {
useEffect(() { useEffect(() {
if (originalPost == null && initialState == null) { if (originalPost == null && initialState == null) {
// Try to load the most recent article draft // Try to load the most recent article draft
final drafts = ref.read(composeStorageNotifierProvider); final drafts = ref.read(composeStorageProvider);
if (drafts.isNotEmpty) { if (drafts.isNotEmpty) {
final mostRecentDraft = drafts.values.reduce( final mostRecentDraft = drafts.values.reduce(
(a, b) => (a, b) =>

View File

@@ -11,14 +11,13 @@ import 'package:island/widgets/paging/pagination_list.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
// Post Categories Notifier // Post Categories Notifier
final postCategoriesNotifierProvider = AsyncNotifierProvider.autoDispose< final postCategoriesProvider = AsyncNotifierProvider.autoDispose<
PostCategoriesNotifier, PostCategoriesNotifier,
List<SnPostCategory> List<SnPostCategory>
>(PostCategoriesNotifier.new); >(PostCategoriesNotifier.new);
class PostCategoriesNotifier class PostCategoriesNotifier extends AsyncNotifier<List<SnPostCategory>>
extends AutoDisposeAsyncNotifier<List<SnPostCategory>> with AsyncPaginationController<SnPostCategory> {
with AutoDisposeAsyncPaginationController<SnPostCategory> {
@override @override
Future<List<SnPostCategory>> fetch() async { Future<List<SnPostCategory>> fetch() async {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);
@@ -35,13 +34,13 @@ class PostCategoriesNotifier
} }
// Post Tags Notifier // Post Tags Notifier
final postTagsNotifierProvider = final postTagsProvider =
AsyncNotifierProvider.autoDispose<PostTagsNotifier, List<SnPostTag>>( AsyncNotifierProvider.autoDispose<PostTagsNotifier, List<SnPostTag>>(
PostTagsNotifier.new, PostTagsNotifier.new,
); );
class PostTagsNotifier extends AutoDisposeAsyncNotifier<List<SnPostTag>> class PostTagsNotifier extends AsyncNotifier<List<SnPostTag>>
with AutoDisposeAsyncPaginationController<SnPostTag> { with AsyncPaginationController<SnPostTag> {
@override @override
Future<List<SnPostTag>> fetch() async { Future<List<SnPostTag>> fetch() async {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);
@@ -65,8 +64,8 @@ class PostCategoriesListScreen extends ConsumerWidget {
return AppScaffold( return AppScaffold(
appBar: AppBar(title: const Text('categories').tr()), appBar: AppBar(title: const Text('categories').tr()),
body: PaginationList( body: PaginationList(
provider: postCategoriesNotifierProvider, provider: postCategoriesProvider,
notifier: postCategoriesNotifierProvider.notifier, notifier: postCategoriesProvider.notifier,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, index, category) { itemBuilder: (context, index, category) {
return ListTile( return ListTile(
@@ -96,8 +95,8 @@ class PostTagsListScreen extends ConsumerWidget {
return AppScaffold( return AppScaffold(
appBar: AppBar(title: const Text('tags').tr()), appBar: AppBar(title: const Text('tags').tr()),
body: PaginationList( body: PaginationList(
provider: postTagsNotifierProvider, provider: postTagsProvider,
notifier: postTagsNotifierProvider.notifier, notifier: postTagsProvider.notifier,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, index, tag) { itemBuilder: (context, index, tag) {
return ListTile( return ListTile(

View File

@@ -6,406 +6,229 @@ part of 'post_category_detail.dart';
// RiverpodGenerator // 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) @ProviderFor(postCategory)
const postCategoryProvider = PostCategoryFamily(); const postCategoryProvider = PostCategoryFamily._();
/// See also [postCategory]. final class PostCategoryProvider
class PostCategoryFamily extends Family<AsyncValue<SnPostCategory>> { extends
/// See also [postCategory]. $FunctionalProvider<
const PostCategoryFamily(); AsyncValue<SnPostCategory>,
SnPostCategory,
/// See also [postCategory]. FutureOr<SnPostCategory>
PostCategoryProvider call(String slug) { >
return PostCategoryProvider(slug); with $FutureModifier<SnPostCategory>, $FutureProvider<SnPostCategory> {
} const PostCategoryProvider._({
required PostCategoryFamily super.from,
@override required String super.argument,
PostCategoryProvider getProviderOverride( }) : super(
covariant PostCategoryProvider provider, retry: null,
) {
return call(provider.slug);
}
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'postCategoryProvider';
}
/// See also [postCategory].
class PostCategoryProvider extends AutoDisposeFutureProvider<SnPostCategory> {
/// See also [postCategory].
PostCategoryProvider(String slug)
: this._internal(
(ref) => postCategory(ref as PostCategoryRef, slug),
from: postCategoryProvider,
name: r'postCategoryProvider', name: r'postCategoryProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$postCategoryHash();
FutureOr<SnPostCategory> Function(PostCategoryRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'postCategoryProvider'
override: PostCategoryProvider._internal( ''
(ref) => create(ref as PostCategoryRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
slug: slug,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnPostCategory> createElement() { $FutureProviderElement<SnPostCategory> $createElement(
return _PostCategoryProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnPostCategory> create(Ref ref) {
final argument = this.argument as String;
return postCategory(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PostCategoryProvider && other.slug == slug; return other is PostCategoryProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, slug.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$postCategoryHash() => r'0df2de729ba96819ee37377314615abef0c99547';
// ignore: unused_element
mixin PostCategoryRef on AutoDisposeFutureProviderRef<SnPostCategory> {
/// The parameter `slug` of this provider.
String get slug;
}
class _PostCategoryProviderElement final class PostCategoryFamily extends $Family
extends AutoDisposeFutureProviderElement<SnPostCategory> with $FunctionalFamilyOverride<FutureOr<SnPostCategory>, String> {
with PostCategoryRef { const PostCategoryFamily._()
_PostCategoryProviderElement(super.provider); : super(
retry: null,
name: r'postCategoryProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
PostCategoryProvider call(String slug) =>
PostCategoryProvider._(argument: slug, from: this);
@override @override
String get slug => (origin as PostCategoryProvider).slug; String toString() => r'postCategoryProvider';
}
@ProviderFor(postTag)
const postTagProvider = PostTagFamily._();
final class PostTagProvider
extends
$FunctionalProvider<
AsyncValue<SnPostTag>,
SnPostTag,
FutureOr<SnPostTag>
>
with $FutureModifier<SnPostTag>, $FutureProvider<SnPostTag> {
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<SnPostTag> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<SnPostTag> 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'; String _$postTagHash() => r'e050fdf9af81a843a9abd9cf979dd2672e0a2b93';
/// See also [postTag]. final class PostTagFamily extends $Family
@ProviderFor(postTag) with $FunctionalFamilyOverride<FutureOr<SnPostTag>, String> {
const postTagProvider = PostTagFamily(); const PostTagFamily._()
: super(
/// See also [postTag]. retry: null,
class PostTagFamily extends Family<AsyncValue<SnPostTag>> {
/// 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<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'postTagProvider';
}
/// See also [postTag].
class PostTagProvider extends AutoDisposeFutureProvider<SnPostTag> {
/// See also [postTag].
PostTagProvider(String slug)
: this._internal(
(ref) => postTag(ref as PostTagRef, slug),
from: postTagProvider,
name: r'postTagProvider', name: r'postTagProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$postTagHash,
dependencies: PostTagFamily._dependencies,
allTransitiveDependencies: PostTagFamily._allTransitiveDependencies,
slug: slug,
);
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;
@override
Override overrideWith(
FutureOr<SnPostTag> Function(PostTagRef provider) create,
) {
return ProviderOverride(
origin: this,
override: PostTagProvider._internal(
(ref) => create(ref as PostTagRef),
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
slug: slug,
),
); );
}
PostTagProvider call(String slug) =>
PostTagProvider._(argument: slug, from: this);
@override @override
AutoDisposeFutureProviderElement<SnPostTag> createElement() { String toString() => r'postTagProvider';
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);
}
} }
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin PostTagRef on AutoDisposeFutureProviderRef<SnPostTag> {
/// The parameter `slug` of this provider.
String get slug;
}
class _PostTagProviderElement
extends AutoDisposeFutureProviderElement<SnPostTag>
with PostTagRef {
_PostTagProviderElement(super.provider);
@override
String get slug => (origin as PostTagProvider).slug;
}
String _$postCategorySubscriptionStatusHash() =>
r'407dc7fcaeffc461b591b4ee2418811aa4f0a63f';
/// See also [postCategorySubscriptionStatus].
@ProviderFor(postCategorySubscriptionStatus) @ProviderFor(postCategorySubscriptionStatus)
const postCategorySubscriptionStatusProvider = const postCategorySubscriptionStatusProvider =
PostCategorySubscriptionStatusFamily(); PostCategorySubscriptionStatusFamily._();
/// See also [postCategorySubscriptionStatus]. final class PostCategorySubscriptionStatusProvider
class PostCategorySubscriptionStatusFamily extends Family<AsyncValue<bool>> { extends $FunctionalProvider<AsyncValue<bool>, bool, FutureOr<bool>>
/// See also [postCategorySubscriptionStatus]. with $FutureModifier<bool>, $FutureProvider<bool> {
const PostCategorySubscriptionStatusFamily(); const PostCategorySubscriptionStatusProvider._({
required PostCategorySubscriptionStatusFamily super.from,
/// See also [postCategorySubscriptionStatus]. required (String, bool) super.argument,
PostCategorySubscriptionStatusProvider call(String slug, bool isCategory) { }) : super(
return PostCategorySubscriptionStatusProvider(slug, isCategory); retry: null,
}
@override
PostCategorySubscriptionStatusProvider getProviderOverride(
covariant PostCategorySubscriptionStatusProvider provider,
) {
return call(provider.slug, provider.isCategory);
}
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'postCategorySubscriptionStatusProvider';
}
/// See also [postCategorySubscriptionStatus].
class PostCategorySubscriptionStatusProvider
extends AutoDisposeFutureProvider<bool> {
/// See also [postCategorySubscriptionStatus].
PostCategorySubscriptionStatusProvider(String slug, bool isCategory)
: this._internal(
(ref) => postCategorySubscriptionStatus(
ref as PostCategorySubscriptionStatusRef,
slug,
isCategory,
),
from: postCategorySubscriptionStatusProvider,
name: r'postCategorySubscriptionStatusProvider', name: r'postCategorySubscriptionStatusProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$postCategorySubscriptionStatusHash();
FutureOr<bool> Function(PostCategorySubscriptionStatusRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'postCategorySubscriptionStatusProvider'
override: PostCategorySubscriptionStatusProvider._internal( ''
(ref) => create(ref as PostCategorySubscriptionStatusRef), '$argument';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
slug: slug,
isCategory: isCategory,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<bool> createElement() { $FutureProviderElement<bool> $createElement($ProviderPointer pointer) =>
return _PostCategorySubscriptionStatusProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<bool> create(Ref ref) {
final argument = this.argument as (String, bool);
return postCategorySubscriptionStatus(ref, argument.$1, argument.$2);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PostCategorySubscriptionStatusProvider && return other is PostCategorySubscriptionStatusProvider &&
other.slug == slug && other.argument == argument;
other.isCategory == isCategory;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, slug.hashCode);
hash = _SystemHash.combine(hash, isCategory.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$postCategorySubscriptionStatusHash() =>
// ignore: unused_element r'407dc7fcaeffc461b591b4ee2418811aa4f0a63f';
mixin PostCategorySubscriptionStatusRef on AutoDisposeFutureProviderRef<bool> {
/// The parameter `slug` of this provider.
String get slug;
/// The parameter `isCategory` of this provider. final class PostCategorySubscriptionStatusFamily extends $Family
bool get isCategory; with $FunctionalFamilyOverride<FutureOr<bool>, (String, bool)> {
} const PostCategorySubscriptionStatusFamily._()
: super(
retry: null,
name: r'postCategorySubscriptionStatusProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
class _PostCategorySubscriptionStatusProviderElement PostCategorySubscriptionStatusProvider call(String slug, bool isCategory) =>
extends AutoDisposeFutureProviderElement<bool> PostCategorySubscriptionStatusProvider._(
with PostCategorySubscriptionStatusRef { argument: (slug, isCategory),
_PostCategorySubscriptionStatusProviderElement(super.provider); from: this,
);
@override @override
String get slug => (origin as PostCategorySubscriptionStatusProvider).slug; String toString() => r'postCategorySubscriptionStatusProvider';
@override
bool get isCategory =>
(origin as PostCategorySubscriptionStatusProvider).isCategory;
} }
// 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

View File

@@ -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_award_history_sheet.dart';
import 'package:island/widgets/post/post_pin_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_quick_reply.dart';
import 'package:island/widgets/post/post_replies.dart';
import 'package:island/widgets/post/compose_sheet.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/widgets/response.dart';
import 'package:island/utils/share_utils.dart'; import 'package:island/utils/share_utils.dart';
import 'package:island/widgets/safety/abuse_report_helper.dart'; import 'package:island/widgets/safety/abuse_report_helper.dart';
@@ -38,20 +38,21 @@ Future<SnPost?> post(Ref ref, String id) async {
} }
final postStateProvider = final postStateProvider =
StateNotifierProvider.family<PostState, AsyncValue<SnPost?>, String>( NotifierProvider.family<PostState, AsyncValue<SnPost?>, String>(
(ref, id) => PostState(ref, id), PostState.new,
); );
class PostState extends StateNotifier<AsyncValue<SnPost?>> { class PostState extends Notifier<AsyncValue<SnPost?>> {
final Ref _ref; final String arg;
final String _id; PostState(this.arg);
PostState(this._ref, this._id) : super(const AsyncValue.loading()) { @override
// Initialize with the initial post data AsyncValue<SnPost?> build() {
_ref.listen<AsyncValue<SnPost?>>( ref.listen<AsyncValue<SnPost?>>(
postProvider(_id), postProvider(arg),
(_, next) => state = next, (_, next) => state = next,
); );
return const AsyncValue.loading();
} }
void updatePost(SnPost? newPost) { void updatePost(SnPost? newPost) {
@@ -460,7 +461,7 @@ class PostDetailScreen extends HookConsumerWidget {
ExtendedRefreshIndicator( ExtendedRefreshIndicator(
onRefresh: () async { onRefresh: () async {
ref.invalidate(postProvider(id)); ref.invalidate(postProvider(id));
ref.invalidate(postRepliesNotifierProvider(id)); ref.read(postRepliesProvider(id).notifier).refresh();
}, },
child: CustomScrollView( child: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
@@ -494,7 +495,9 @@ class PostDetailScreen extends HookConsumerWidget {
), ),
onRefresh: () { onRefresh: () {
ref.invalidate(postProvider(id)); ref.invalidate(postProvider(id));
ref.invalidate(postRepliesNotifierProvider(id)); ref
.read(postRepliesProvider(id).notifier)
.refresh();
}, },
onUpdate: (newItem) { onUpdate: (newItem) {
ref ref
@@ -523,9 +526,9 @@ class PostDetailScreen extends HookConsumerWidget {
(post) => PostQuickReply( (post) => PostQuickReply(
parent: post!, parent: post!,
onPosted: () { onPosted: () {
ref.invalidate( ref
postRepliesNotifierProvider(id), .read(postRepliesProvider(id).notifier)
); .refresh();
}, },
), ),
loading: () => const SizedBox.shrink(), loading: () => const SizedBox.shrink(),

View File

@@ -6,139 +6,73 @@ part of 'post_detail.dart';
// RiverpodGenerator // 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) @ProviderFor(post)
const postProvider = PostFamily(); const postProvider = PostFamily._();
/// See also [post]. final class PostProvider
class PostFamily extends Family<AsyncValue<SnPost?>> { extends $FunctionalProvider<AsyncValue<SnPost?>, SnPost?, FutureOr<SnPost?>>
/// See also [post]. with $FutureModifier<SnPost?>, $FutureProvider<SnPost?> {
const PostFamily(); const PostProvider._({
required PostFamily super.from,
/// See also [post]. required String super.argument,
PostProvider call(String id) { }) : super(
return PostProvider(id); retry: null,
}
@override
PostProvider getProviderOverride(covariant PostProvider provider) {
return call(provider.id);
}
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'postProvider';
}
/// See also [post].
class PostProvider extends AutoDisposeFutureProvider<SnPost?> {
/// See also [post].
PostProvider(String id)
: this._internal(
(ref) => post(ref as PostRef, id),
from: postProvider,
name: r'postProvider', name: r'postProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') ? null : _$postHash, dependencies: null,
dependencies: PostFamily._dependencies, $allTransitiveDependencies: null,
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
Override overrideWith(FutureOr<SnPost?> Function(PostRef provider) create) { String debugGetCreateSourceHash() => _$postHash();
return ProviderOverride(
origin: this, @override
override: PostProvider._internal( String toString() {
(ref) => create(ref as PostRef), return r'postProvider'
from: from, ''
name: null, '($argument)';
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
id: id,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnPost?> createElement() { $FutureProviderElement<SnPost?> $createElement($ProviderPointer pointer) =>
return _PostProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<SnPost?> create(Ref ref) {
final argument = this.argument as String;
return post(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PostProvider && other.id == id; return other is PostProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, id.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$postHash() => r'66c2eb074c6d7467fef81cab70a13356e648e661';
// ignore: unused_element
mixin PostRef on AutoDisposeFutureProviderRef<SnPost?> {
/// The parameter `id` of this provider.
String get id;
}
class _PostProviderElement extends AutoDisposeFutureProviderElement<SnPost?> final class PostFamily extends $Family
with PostRef { with $FunctionalFamilyOverride<FutureOr<SnPost?>, String> {
_PostProviderElement(super.provider); const PostFamily._()
: super(
retry: null,
name: r'postProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
PostProvider call(String id) => PostProvider._(argument: id, from: this);
@override @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

View File

@@ -12,13 +12,12 @@ import 'package:island/pods/paging.dart';
import 'package:island/widgets/paging/pagination_list.dart'; import 'package:island/widgets/paging/pagination_list.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
final postSearchNotifierProvider = final postSearchProvider = AsyncNotifierProvider.autoDispose(
AsyncNotifierProvider.autoDispose<PostSearchNotifier, List<SnPost>>(
PostSearchNotifier.new, PostSearchNotifier.new,
); );
class PostSearchNotifier extends AutoDisposeAsyncNotifier<List<SnPost>> class PostSearchNotifier extends AsyncNotifier<List<SnPost>>
with AutoDisposeAsyncPaginationController<SnPost> { with AsyncPaginationController<SnPost> {
static const int _pageSize = 20; static const int _pageSize = 20;
String _currentQuery = ''; String _currentQuery = '';
String? _pubName; String? _pubName;
@@ -131,7 +130,7 @@ class PostSearchScreen extends HookConsumerWidget {
if (debounceTimer.value?.isActive ?? false) debounceTimer.value!.cancel(); if (debounceTimer.value?.isActive ?? false) debounceTimer.value!.cancel();
debounceTimer.value = Timer(debounce, () { 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, () { debounceTimer.value = Timer(debounce, () {
ref ref
.read(postSearchNotifierProvider.notifier) .read(postSearchProvider.notifier)
.search( .search(
query, query,
pubName: pubName:
@@ -303,7 +302,7 @@ class PostSearchScreen extends HookConsumerWidget {
), ),
body: Consumer( body: Consumer(
builder: (context, ref, child) { builder: (context, ref, child) {
final searchState = ref.watch(postSearchNotifierProvider); final searchState = ref.watch(postSearchProvider);
return CustomScrollView( return CustomScrollView(
slivers: [ slivers: [
@@ -318,8 +317,8 @@ class PostSearchScreen extends HookConsumerWidget {
), ),
// Use PaginationList with isSliver=true // Use PaginationList with isSliver=true
PaginationList( PaginationList(
provider: postSearchNotifierProvider, provider: postSearchProvider,
notifier: postSearchNotifierProvider.notifier, notifier: postSearchProvider.notifier,
isSliver: true, isSliver: true,
isRefreshable: isRefreshable:
false, // CustomScrollView handles refreshing usually, but here we don't have PullToRefresh 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 && searchController.text.isNotEmpty &&
!searchState.isLoading) !searchState.isLoading)
SliverFillRemaining( SliverFillRemaining(

View File

@@ -6,650 +6,383 @@ part of 'publisher_profile.dart';
// RiverpodGenerator // 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) @ProviderFor(publisher)
const publisherProvider = PublisherFamily(); const publisherProvider = PublisherFamily._();
/// See also [publisher]. final class PublisherProvider
class PublisherFamily extends Family<AsyncValue<SnPublisher>> { extends
/// See also [publisher]. $FunctionalProvider<
const PublisherFamily(); AsyncValue<SnPublisher>,
SnPublisher,
/// See also [publisher]. FutureOr<SnPublisher>
PublisherProvider call(String uname) { >
return PublisherProvider(uname); with $FutureModifier<SnPublisher>, $FutureProvider<SnPublisher> {
} const PublisherProvider._({
required PublisherFamily super.from,
@override required String super.argument,
PublisherProvider getProviderOverride(covariant PublisherProvider provider) { }) : super(
return call(provider.uname); retry: null,
}
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'publisherProvider';
}
/// See also [publisher].
class PublisherProvider extends AutoDisposeFutureProvider<SnPublisher> {
/// See also [publisher].
PublisherProvider(String uname)
: this._internal(
(ref) => publisher(ref as PublisherRef, uname),
from: publisherProvider,
name: r'publisherProvider', name: r'publisherProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$publisherHash();
FutureOr<SnPublisher> Function(PublisherRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'publisherProvider'
override: PublisherProvider._internal( ''
(ref) => create(ref as PublisherRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
uname: uname,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnPublisher> createElement() { $FutureProviderElement<SnPublisher> $createElement(
return _PublisherProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnPublisher> create(Ref ref) {
final argument = this.argument as String;
return publisher(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PublisherProvider && other.uname == uname; return other is PublisherProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, uname.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$publisherHash() => r'a1da21f0275421382e2882fd52c4e061c4675cf7';
// ignore: unused_element
mixin PublisherRef on AutoDisposeFutureProviderRef<SnPublisher> {
/// The parameter `uname` of this provider.
String get uname;
}
class _PublisherProviderElement final class PublisherFamily extends $Family
extends AutoDisposeFutureProviderElement<SnPublisher> with $FunctionalFamilyOverride<FutureOr<SnPublisher>, String> {
with PublisherRef { const PublisherFamily._()
_PublisherProviderElement(super.provider); : super(
retry: null,
name: r'publisherProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
PublisherProvider call(String uname) =>
PublisherProvider._(argument: uname, from: this);
@override @override
String get uname => (origin as PublisherProvider).uname; String toString() => r'publisherProvider';
}
@ProviderFor(publisherBadges)
const publisherBadgesProvider = PublisherBadgesFamily._();
final class PublisherBadgesProvider
extends
$FunctionalProvider<
AsyncValue<List<SnAccountBadge>>,
List<SnAccountBadge>,
FutureOr<List<SnAccountBadge>>
>
with
$FutureModifier<List<SnAccountBadge>>,
$FutureProvider<List<SnAccountBadge>> {
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<List<SnAccountBadge>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnAccountBadge>> 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'; String _$publisherBadgesHash() => r'26776fd6cb611953f52bdb6a7dfa004c34d5cd8e';
/// See also [publisherBadges]. final class PublisherBadgesFamily extends $Family
@ProviderFor(publisherBadges) with $FunctionalFamilyOverride<FutureOr<List<SnAccountBadge>>, String> {
const publisherBadgesProvider = PublisherBadgesFamily(); const PublisherBadgesFamily._()
: super(
/// See also [publisherBadges]. retry: null,
class PublisherBadgesFamily extends Family<AsyncValue<List<SnAccountBadge>>> {
/// 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<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'publisherBadgesProvider';
}
/// See also [publisherBadges].
class PublisherBadgesProvider
extends AutoDisposeFutureProvider<List<SnAccountBadge>> {
/// See also [publisherBadges].
PublisherBadgesProvider(String pubName)
: this._internal(
(ref) => publisherBadges(ref as PublisherBadgesRef, pubName),
from: publisherBadgesProvider,
name: r'publisherBadgesProvider', name: r'publisherBadgesProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$publisherBadgesHash,
dependencies: PublisherBadgesFamily._dependencies,
allTransitiveDependencies:
PublisherBadgesFamily._allTransitiveDependencies,
pubName: pubName,
);
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;
@override
Override overrideWith(
FutureOr<List<SnAccountBadge>> Function(PublisherBadgesRef provider) create,
) {
return ProviderOverride(
origin: this,
override: PublisherBadgesProvider._internal(
(ref) => create(ref as PublisherBadgesRef),
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
pubName: pubName,
),
); );
}
PublisherBadgesProvider call(String pubName) =>
PublisherBadgesProvider._(argument: pubName, from: this);
@override @override
AutoDisposeFutureProviderElement<List<SnAccountBadge>> createElement() { String toString() => r'publisherBadgesProvider';
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);
}
} }
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin PublisherBadgesRef on AutoDisposeFutureProviderRef<List<SnAccountBadge>> {
/// The parameter `pubName` of this provider.
String get pubName;
}
class _PublisherBadgesProviderElement
extends AutoDisposeFutureProviderElement<List<SnAccountBadge>>
with PublisherBadgesRef {
_PublisherBadgesProviderElement(super.provider);
@override
String get pubName => (origin as PublisherBadgesProvider).pubName;
}
String _$publisherSubscriptionStatusHash() =>
r'634262ce519e1c8288267df11e08e1d4acaa4a44';
/// See also [publisherSubscriptionStatus].
@ProviderFor(publisherSubscriptionStatus) @ProviderFor(publisherSubscriptionStatus)
const publisherSubscriptionStatusProvider = PublisherSubscriptionStatusFamily(); const publisherSubscriptionStatusProvider =
PublisherSubscriptionStatusFamily._();
/// See also [publisherSubscriptionStatus]. final class PublisherSubscriptionStatusProvider
class PublisherSubscriptionStatusFamily extends
extends Family<AsyncValue<SnSubscriptionStatus>> { $FunctionalProvider<
/// See also [publisherSubscriptionStatus]. AsyncValue<SnSubscriptionStatus>,
const PublisherSubscriptionStatusFamily(); SnSubscriptionStatus,
FutureOr<SnSubscriptionStatus>
/// See also [publisherSubscriptionStatus]. >
PublisherSubscriptionStatusProvider call(String pubName) { with
return PublisherSubscriptionStatusProvider(pubName); $FutureModifier<SnSubscriptionStatus>,
} $FutureProvider<SnSubscriptionStatus> {
const PublisherSubscriptionStatusProvider._({
@override required PublisherSubscriptionStatusFamily super.from,
PublisherSubscriptionStatusProvider getProviderOverride( required String super.argument,
covariant PublisherSubscriptionStatusProvider provider, }) : super(
) { retry: null,
return call(provider.pubName);
}
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'publisherSubscriptionStatusProvider';
}
/// See also [publisherSubscriptionStatus].
class PublisherSubscriptionStatusProvider
extends AutoDisposeFutureProvider<SnSubscriptionStatus> {
/// See also [publisherSubscriptionStatus].
PublisherSubscriptionStatusProvider(String pubName)
: this._internal(
(ref) => publisherSubscriptionStatus(
ref as PublisherSubscriptionStatusRef,
pubName,
),
from: publisherSubscriptionStatusProvider,
name: r'publisherSubscriptionStatusProvider', name: r'publisherSubscriptionStatusProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$publisherSubscriptionStatusHash();
FutureOr<SnSubscriptionStatus> Function(
PublisherSubscriptionStatusRef provider, @override
) String toString() {
create, return r'publisherSubscriptionStatusProvider'
) { ''
return ProviderOverride( '($argument)';
origin: this,
override: PublisherSubscriptionStatusProvider._internal(
(ref) => create(ref as PublisherSubscriptionStatusRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
pubName: pubName,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnSubscriptionStatus> createElement() { $FutureProviderElement<SnSubscriptionStatus> $createElement(
return _PublisherSubscriptionStatusProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnSubscriptionStatus> create(Ref ref) {
final argument = this.argument as String;
return publisherSubscriptionStatus(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PublisherSubscriptionStatusProvider && return other is PublisherSubscriptionStatusProvider &&
other.pubName == pubName; other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, pubName.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$publisherSubscriptionStatusHash() =>
// ignore: unused_element r'634262ce519e1c8288267df11e08e1d4acaa4a44';
mixin PublisherSubscriptionStatusRef
on AutoDisposeFutureProviderRef<SnSubscriptionStatus> {
/// The parameter `pubName` of this provider.
String get pubName;
}
class _PublisherSubscriptionStatusProviderElement final class PublisherSubscriptionStatusFamily extends $Family
extends AutoDisposeFutureProviderElement<SnSubscriptionStatus> with $FunctionalFamilyOverride<FutureOr<SnSubscriptionStatus>, String> {
with PublisherSubscriptionStatusRef { const PublisherSubscriptionStatusFamily._()
_PublisherSubscriptionStatusProviderElement(super.provider); : super(
retry: null,
name: r'publisherSubscriptionStatusProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
PublisherSubscriptionStatusProvider call(String pubName) =>
PublisherSubscriptionStatusProvider._(argument: pubName, from: this);
@override @override
String get pubName => (origin as PublisherSubscriptionStatusProvider).pubName; String toString() => r'publisherSubscriptionStatusProvider';
} }
String _$publisherAppbarForcegroundColorHash() =>
r'cd9a9816177a6eecc2bc354acebbbd48892ffdd7';
/// See also [publisherAppbarForcegroundColor].
@ProviderFor(publisherAppbarForcegroundColor) @ProviderFor(publisherAppbarForcegroundColor)
const publisherAppbarForcegroundColorProvider = const publisherAppbarForcegroundColorProvider =
PublisherAppbarForcegroundColorFamily(); PublisherAppbarForcegroundColorFamily._();
/// See also [publisherAppbarForcegroundColor]. final class PublisherAppbarForcegroundColorProvider
class PublisherAppbarForcegroundColorFamily extends Family<AsyncValue<Color?>> { extends $FunctionalProvider<AsyncValue<Color?>, Color?, FutureOr<Color?>>
/// See also [publisherAppbarForcegroundColor]. with $FutureModifier<Color?>, $FutureProvider<Color?> {
const PublisherAppbarForcegroundColorFamily(); const PublisherAppbarForcegroundColorProvider._({
required PublisherAppbarForcegroundColorFamily super.from,
/// See also [publisherAppbarForcegroundColor]. required String super.argument,
PublisherAppbarForcegroundColorProvider call(String pubName) { }) : super(
return PublisherAppbarForcegroundColorProvider(pubName); retry: null,
}
@override
PublisherAppbarForcegroundColorProvider getProviderOverride(
covariant PublisherAppbarForcegroundColorProvider provider,
) {
return call(provider.pubName);
}
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'publisherAppbarForcegroundColorProvider';
}
/// See also [publisherAppbarForcegroundColor].
class PublisherAppbarForcegroundColorProvider
extends AutoDisposeFutureProvider<Color?> {
/// See also [publisherAppbarForcegroundColor].
PublisherAppbarForcegroundColorProvider(String pubName)
: this._internal(
(ref) => publisherAppbarForcegroundColor(
ref as PublisherAppbarForcegroundColorRef,
pubName,
),
from: publisherAppbarForcegroundColorProvider,
name: r'publisherAppbarForcegroundColorProvider', name: r'publisherAppbarForcegroundColorProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: null,
: _$publisherAppbarForcegroundColorHash,
dependencies: PublisherAppbarForcegroundColorFamily._dependencies,
allTransitiveDependencies:
PublisherAppbarForcegroundColorFamily._allTransitiveDependencies,
pubName: pubName,
); );
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;
@override @override
Override overrideWith( String debugGetCreateSourceHash() => _$publisherAppbarForcegroundColorHash();
FutureOr<Color?> Function(PublisherAppbarForcegroundColorRef provider)
create, @override
) { String toString() {
return ProviderOverride( return r'publisherAppbarForcegroundColorProvider'
origin: this, ''
override: PublisherAppbarForcegroundColorProvider._internal( '($argument)';
(ref) => create(ref as PublisherAppbarForcegroundColorRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
pubName: pubName,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<Color?> createElement() { $FutureProviderElement<Color?> $createElement($ProviderPointer pointer) =>
return _PublisherAppbarForcegroundColorProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<Color?> create(Ref ref) {
final argument = this.argument as String;
return publisherAppbarForcegroundColor(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PublisherAppbarForcegroundColorProvider && return other is PublisherAppbarForcegroundColorProvider &&
other.pubName == pubName; other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, pubName.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$publisherAppbarForcegroundColorHash() =>
// ignore: unused_element r'cd9a9816177a6eecc2bc354acebbbd48892ffdd7';
mixin PublisherAppbarForcegroundColorRef
on AutoDisposeFutureProviderRef<Color?> {
/// The parameter `pubName` of this provider.
String get pubName;
}
class _PublisherAppbarForcegroundColorProviderElement final class PublisherAppbarForcegroundColorFamily extends $Family
extends AutoDisposeFutureProviderElement<Color?> with $FunctionalFamilyOverride<FutureOr<Color?>, String> {
with PublisherAppbarForcegroundColorRef { const PublisherAppbarForcegroundColorFamily._()
_PublisherAppbarForcegroundColorProviderElement(super.provider); : super(
retry: null,
@override name: r'publisherAppbarForcegroundColorProvider',
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<AsyncValue<SnHeatmap?>> {
/// 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<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'publisherHeatmapProvider';
}
/// See also [publisherHeatmap].
class PublisherHeatmapProvider extends AutoDisposeFutureProvider<SnHeatmap?> {
/// 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,
);
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;
@override
Override overrideWith(
FutureOr<SnHeatmap?> Function(PublisherHeatmapRef provider) create,
) {
return ProviderOverride(
origin: this,
override: PublisherHeatmapProvider._internal(
(ref) => create(ref as PublisherHeatmapRef),
from: from,
name: null,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, $allTransitiveDependencies: null,
debugGetCreateSourceHash: null, isAutoDispose: true,
uname: uname,
),
); );
}
PublisherAppbarForcegroundColorProvider call(String pubName) =>
PublisherAppbarForcegroundColorProvider._(argument: pubName, from: this);
@override @override
AutoDisposeFutureProviderElement<SnHeatmap?> createElement() { String toString() => r'publisherAppbarForcegroundColorProvider';
return _PublisherHeatmapProviderElement(this); }
@ProviderFor(publisherHeatmap)
const publisherHeatmapProvider = PublisherHeatmapFamily._();
final class PublisherHeatmapProvider
extends
$FunctionalProvider<
AsyncValue<SnHeatmap?>,
SnHeatmap?,
FutureOr<SnHeatmap?>
>
with $FutureModifier<SnHeatmap?>, $FutureProvider<SnHeatmap?> {
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<SnHeatmap?> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<SnHeatmap?> create(Ref ref) {
final argument = this.argument as String;
return publisherHeatmap(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is PublisherHeatmapProvider && other.uname == uname; return other is PublisherHeatmapProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, uname.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$publisherHeatmapHash() => r'86db275ce3861a2855b5ec35fbfef85fc47b23a6';
// ignore: unused_element
mixin PublisherHeatmapRef on AutoDisposeFutureProviderRef<SnHeatmap?> {
/// The parameter `uname` of this provider.
String get uname;
}
class _PublisherHeatmapProviderElement final class PublisherHeatmapFamily extends $Family
extends AutoDisposeFutureProviderElement<SnHeatmap?> with $FunctionalFamilyOverride<FutureOr<SnHeatmap?>, String> {
with PublisherHeatmapRef { const PublisherHeatmapFamily._()
_PublisherHeatmapProviderElement(super.provider); : super(
retry: null,
name: r'publisherHeatmapProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
PublisherHeatmapProvider call(String uname) =>
PublisherHeatmapProvider._(argument: uname, from: this);
@override @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

View File

@@ -529,10 +529,12 @@ final realmMemberListNotifierProvider = AsyncNotifierProvider.autoDispose
RealmMemberListNotifier.new, RealmMemberListNotifier.new,
); );
class RealmMemberListNotifier class RealmMemberListNotifier extends AsyncNotifier<List<SnRealmMember>>
extends AutoDisposeFamilyAsyncNotifier<List<SnRealmMember>, String> with AsyncPaginationController<SnRealmMember> {
with FamilyAsyncPaginationController<SnRealmMember, String> { String arg;
static const int _pageSize = 20; RealmMemberListNotifier(this.arg);
static const int pageSize = 20;
@override @override
Future<List<SnRealmMember>> fetch() async { Future<List<SnRealmMember>> fetch() async {
@@ -542,7 +544,7 @@ class RealmMemberListNotifier
'/pass/realms/$arg/members', '/pass/realms/$arg/members',
queryParameters: { queryParameters: {
'offset': fetchedCount, 'offset': fetchedCount,
'take': _pageSize, 'take': pageSize,
'withStatus': true, 'withStatus': true,
}, },
); );

View File

@@ -47,13 +47,14 @@ class RealmListScreen extends HookConsumerWidget {
// Set FAB type to realm // Set FAB type to realm
final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier); final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier);
Future(() { Future(() {
fabMenuNotifier.state = FabMenuType.realm; fabMenuNotifier.setMenuType(FabMenuType.realm);
}); });
return () { return () {
// Clean up: reset FAB type to main // Clean up: reset FAB type to main
final fabMenu = ref.read(fabMenuTypeProvider);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (fabMenuNotifier.state == FabMenuType.realm) { if (fabMenu == FabMenuType.realm) {
fabMenuNotifier.state = FabMenuType.main; fabMenuNotifier.setMenuType(FabMenuType.main);
} }
}); });
}; };

View File

@@ -6,174 +6,155 @@ part of 'realms.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
@ProviderFor(realmsJoined)
const realmsJoinedProvider = RealmsJoinedProvider._();
final class RealmsJoinedProvider
extends
$FunctionalProvider<
AsyncValue<List<SnRealm>>,
List<SnRealm>,
FutureOr<List<SnRealm>>
>
with $FutureModifier<List<SnRealm>>, $FutureProvider<List<SnRealm>> {
const RealmsJoinedProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'realmsJoinedProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$realmsJoinedHash();
@$internal
@override
$FutureProviderElement<List<SnRealm>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnRealm>> create(Ref ref) {
return realmsJoined(ref);
}
}
String _$realmsJoinedHash() => r'b15029acd38f03bbbb8708adb78f25ac357a0421'; String _$realmsJoinedHash() => r'b15029acd38f03bbbb8708adb78f25ac357a0421';
/// See also [realmsJoined].
@ProviderFor(realmsJoined)
final realmsJoinedProvider = AutoDisposeFutureProvider<List<SnRealm>>.internal(
realmsJoined,
name: r'realmsJoinedProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$realmsJoinedHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef RealmsJoinedRef = AutoDisposeFutureProviderRef<List<SnRealm>>;
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) @ProviderFor(realm)
const realmProvider = RealmFamily(); const realmProvider = RealmFamily._();
/// See also [realm]. final class RealmProvider
class RealmFamily extends Family<AsyncValue<SnRealm?>> { extends
/// See also [realm]. $FunctionalProvider<AsyncValue<SnRealm?>, SnRealm?, FutureOr<SnRealm?>>
const RealmFamily(); with $FutureModifier<SnRealm?>, $FutureProvider<SnRealm?> {
const RealmProvider._({
/// See also [realm]. required RealmFamily super.from,
RealmProvider call(String? identifier) { required String? super.argument,
return RealmProvider(identifier); }) : super(
} retry: null,
@override
RealmProvider getProviderOverride(covariant RealmProvider provider) {
return call(provider.identifier);
}
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'realmProvider';
}
/// See also [realm].
class RealmProvider extends AutoDisposeFutureProvider<SnRealm?> {
/// See also [realm].
RealmProvider(String? identifier)
: this._internal(
(ref) => realm(ref as RealmRef, identifier),
from: realmProvider,
name: r'realmProvider', name: r'realmProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') ? null : _$realmHash, dependencies: null,
dependencies: RealmFamily._dependencies, $allTransitiveDependencies: null,
allTransitiveDependencies: RealmFamily._allTransitiveDependencies,
identifier: identifier,
); );
RealmProvider._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 @override
Override overrideWith(FutureOr<SnRealm?> Function(RealmRef provider) create) { String debugGetCreateSourceHash() => _$realmHash();
return ProviderOverride(
origin: this, @override
override: RealmProvider._internal( String toString() {
(ref) => create(ref as RealmRef), return r'realmProvider'
from: from, ''
name: null, '($argument)';
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
identifier: identifier,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnRealm?> createElement() { $FutureProviderElement<SnRealm?> $createElement($ProviderPointer pointer) =>
return _RealmProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<SnRealm?> create(Ref ref) {
final argument = this.argument as String?;
return realm(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is RealmProvider && other.identifier == identifier; return other is RealmProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, identifier.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$realmHash() => r'71a126ab2810566646e1629290c1ce9ffa0839e3';
// ignore: unused_element
mixin RealmRef on AutoDisposeFutureProviderRef<SnRealm?> {
/// The parameter `identifier` of this provider.
String? get identifier;
}
class _RealmProviderElement extends AutoDisposeFutureProviderElement<SnRealm?> final class RealmFamily extends $Family
with RealmRef { with $FunctionalFamilyOverride<FutureOr<SnRealm?>, String?> {
_RealmProviderElement(super.provider); const RealmFamily._()
: super(
retry: null,
name: r'realmProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
RealmProvider call(String? identifier) =>
RealmProvider._(argument: identifier, from: this);
@override @override
String? get identifier => (origin as RealmProvider).identifier; String toString() => r'realmProvider';
}
@ProviderFor(realmInvites)
const realmInvitesProvider = RealmInvitesProvider._();
final class RealmInvitesProvider
extends
$FunctionalProvider<
AsyncValue<List<SnRealmMember>>,
List<SnRealmMember>,
FutureOr<List<SnRealmMember>>
>
with
$FutureModifier<List<SnRealmMember>>,
$FutureProvider<List<SnRealmMember>> {
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<List<SnRealmMember>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnRealmMember>> create(Ref ref) {
return realmInvites(ref);
}
} }
String _$realmInvitesHash() => r'92cce0978c7ca8813e27ae42fc6f3a93a09a8962'; String _$realmInvitesHash() => r'92cce0978c7ca8813e27ae42fc6f3a93a09a8962';
/// See also [realmInvites].
@ProviderFor(realmInvites)
final realmInvitesProvider =
AutoDisposeFutureProvider<List<SnRealmMember>>.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<List<SnRealmMember>>;
// 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

View File

@@ -52,7 +52,7 @@ class SettingsScreen extends HookConsumerWidget {
final serverUrl = ref.watch(serverUrlProvider); final serverUrl = ref.watch(serverUrlProvider);
final prefs = ref.watch(sharedPreferencesProvider); final prefs = ref.watch(sharedPreferencesProvider);
final controller = TextEditingController(text: serverUrl); final controller = TextEditingController(text: serverUrl);
final settings = ref.watch(appSettingsNotifierProvider); final settings = ref.watch(appSettingsProvider);
final isDesktop = final isDesktop =
!kIsWeb && (Platform.isWindows || Platform.isMacOS || Platform.isLinux); !kIsWeb && (Platform.isWindows || Platform.isMacOS || Platform.isLinux);
final isWide = isWideScreen(context); final isWide = isWideScreen(context);
@@ -137,9 +137,7 @@ class SettingsScreen extends HookConsumerWidget {
value: settings.themeMode, value: settings.themeMode,
onChanged: (String? value) { onChanged: (String? value) {
if (value != null) { if (value != null) {
ref ref.read(appSettingsProvider.notifier).setThemeMode(value);
.read(appSettingsNotifierProvider.notifier)
.setThemeMode(value);
showSnackBar('settingsApplied'.tr()); showSnackBar('settingsApplied'.tr());
} }
}, },
@@ -170,9 +168,7 @@ class SettingsScreen extends HookConsumerWidget {
suffixIcon: IconButton( suffixIcon: IconButton(
icon: const Icon(Symbols.restart_alt), icon: const Icon(Symbols.restart_alt),
onPressed: () { onPressed: () {
ref ref.read(appSettingsProvider.notifier).setCustomFonts(null);
.read(appSettingsNotifierProvider.notifier)
.setCustomFonts(null);
showSnackBar('settingsApplied'.tr()); showSnackBar('settingsApplied'.tr());
}, },
), ),
@@ -183,7 +179,7 @@ class SettingsScreen extends HookConsumerWidget {
), ),
onSubmitted: (value) { onSubmitted: (value) {
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setCustomFonts(value.isEmpty ? null : value); .setCustomFonts(value.isEmpty ? null : value);
showSnackBar('settingsApplied'.tr()); showSnackBar('settingsApplied'.tr());
}, },
@@ -218,7 +214,7 @@ class SettingsScreen extends HookConsumerWidget {
onChanged: (String? value) { onChanged: (String? value) {
if (value != null) { if (value != null) {
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setMessageDisplayStyle(value); .setMessageDisplayStyle(value);
showSnackBar('settingsApplied'.tr()); showSnackBar('settingsApplied'.tr());
} }
@@ -280,7 +276,7 @@ class SettingsScreen extends HookConsumerWidget {
TextButton( TextButton(
onPressed: () { onPressed: () {
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setAppColorScheme(selectedColor.value); .setAppColorScheme(selectedColor.value);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@@ -330,7 +326,7 @@ class SettingsScreen extends HookConsumerWidget {
onColorChanged: (color) { onColorChanged: (color) {
final current = settings.customColors ?? ThemeColors(); final current = settings.customColors ?? ThemeColors();
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setCustomColors(current.copyWith(primary: color?.value)); .setCustomColors(current.copyWith(primary: color?.value));
}, },
), ),
@@ -344,7 +340,7 @@ class SettingsScreen extends HookConsumerWidget {
onColorChanged: (color) { onColorChanged: (color) {
final current = settings.customColors ?? ThemeColors(); final current = settings.customColors ?? ThemeColors();
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setCustomColors(current.copyWith(secondary: color?.value)); .setCustomColors(current.copyWith(secondary: color?.value));
}, },
), ),
@@ -358,7 +354,7 @@ class SettingsScreen extends HookConsumerWidget {
onColorChanged: (color) { onColorChanged: (color) {
final current = settings.customColors ?? ThemeColors(); final current = settings.customColors ?? ThemeColors();
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setCustomColors(current.copyWith(tertiary: color?.value)); .setCustomColors(current.copyWith(tertiary: color?.value));
}, },
), ),
@@ -372,7 +368,7 @@ class SettingsScreen extends HookConsumerWidget {
onColorChanged: (color) { onColorChanged: (color) {
final current = settings.customColors ?? ThemeColors(); final current = settings.customColors ?? ThemeColors();
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setCustomColors(current.copyWith(surface: color?.value)); .setCustomColors(current.copyWith(surface: color?.value));
}, },
), ),
@@ -386,7 +382,7 @@ class SettingsScreen extends HookConsumerWidget {
onColorChanged: (color) { onColorChanged: (color) {
final current = settings.customColors ?? ThemeColors(); final current = settings.customColors ?? ThemeColors();
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setCustomColors( .setCustomColors(
current.copyWith(background: color?.value), current.copyWith(background: color?.value),
); );
@@ -402,7 +398,7 @@ class SettingsScreen extends HookConsumerWidget {
onColorChanged: (color) { onColorChanged: (color) {
final current = settings.customColors ?? ThemeColors(); final current = settings.customColors ?? ThemeColors();
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setCustomColors(current.copyWith(error: color?.value)); .setCustomColors(current.copyWith(error: color?.value));
}, },
), ),
@@ -412,9 +408,7 @@ class SettingsScreen extends HookConsumerWidget {
trailing: const Icon(Symbols.restart_alt).padding(right: 2), trailing: const Icon(Symbols.restart_alt).padding(right: 2),
contentPadding: EdgeInsets.symmetric(horizontal: 20), contentPadding: EdgeInsets.symmetric(horizontal: 20),
onTap: () { onTap: () {
ref ref.read(appSettingsProvider.notifier).setCustomColors(null);
.read(appSettingsNotifierProvider.notifier)
.setCustomColors(null);
showSnackBar('settingsApplied'.tr()); showSnackBar('settingsApplied'.tr());
}, },
), ),
@@ -448,9 +442,7 @@ class SettingsScreen extends HookConsumerWidget {
value: settings.fabPosition, value: settings.fabPosition,
onChanged: (String? value) { onChanged: (String? value) {
if (value != null) { if (value != null) {
ref ref.read(appSettingsProvider.notifier).setFabPosition(value);
.read(appSettingsNotifierProvider.notifier)
.setFabPosition(value);
showSnackBar('settingsApplied'.tr()); showSnackBar('settingsApplied'.tr());
} }
}, },
@@ -481,7 +473,7 @@ class SettingsScreen extends HookConsumerWidget {
label: '${(settings.cardTransparency * 100).round()}%', label: '${(settings.cardTransparency * 100).round()}%',
onChanged: (value) { onChanged: (value) {
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setAppTransparentBackground(value); .setAppTransparentBackground(value);
}, },
), ),
@@ -533,7 +525,7 @@ class SettingsScreen extends HookConsumerWidget {
value: settings.showBackgroundImage, value: settings.showBackgroundImage,
onChanged: (value) { onChanged: (value) {
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setShowBackgroundImage(value); .setShowBackgroundImage(value);
}, },
), ),
@@ -609,7 +601,7 @@ class SettingsScreen extends HookConsumerWidget {
? colorScheme.primary ? colorScheme.primary
: colorScheme.primary; : colorScheme.primary;
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setAppColorScheme(color.value); .setAppColorScheme(color.value);
if (context.mounted) { if (context.mounted) {
hideLoadingModal(context); hideLoadingModal(context);
@@ -699,7 +691,7 @@ class SettingsScreen extends HookConsumerWidget {
value: currentPoolId, value: currentPoolId,
onChanged: (value) { onChanged: (value) {
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setDefaultPoolId(value); .setDefaultPoolId(value);
showSnackBar('settingsApplied'.tr()); showSnackBar('settingsApplied'.tr());
}, },
@@ -738,9 +730,7 @@ class SettingsScreen extends HookConsumerWidget {
trailing: Switch( trailing: Switch(
value: settings.autoTranslate, value: settings.autoTranslate,
onChanged: (value) { onChanged: (value) {
ref ref.read(appSettingsProvider.notifier).setAutoTranslate(value);
.read(appSettingsNotifierProvider.notifier)
.setAutoTranslate(value);
}, },
), ),
), ),
@@ -754,9 +744,7 @@ class SettingsScreen extends HookConsumerWidget {
trailing: Switch( trailing: Switch(
value: settings.soundEffects, value: settings.soundEffects,
onChanged: (value) { onChanged: (value) {
ref ref.read(appSettingsProvider.notifier).setSoundEffects(value);
.read(appSettingsNotifierProvider.notifier)
.setSoundEffects(value);
}, },
), ),
), ),
@@ -770,9 +758,7 @@ class SettingsScreen extends HookConsumerWidget {
trailing: Switch( trailing: Switch(
value: settings.aprilFoolFeatures, value: settings.aprilFoolFeatures,
onChanged: (value) { onChanged: (value) {
ref ref.read(appSettingsProvider.notifier).setAprilFoolFeatures(value);
.read(appSettingsNotifierProvider.notifier)
.setAprilFoolFeatures(value);
}, },
), ),
), ),
@@ -790,9 +776,7 @@ class SettingsScreen extends HookConsumerWidget {
trailing: Switch( trailing: Switch(
value: settings.enterToSend, value: settings.enterToSend,
onChanged: (value) { onChanged: (value) {
ref ref.read(appSettingsProvider.notifier).setEnterToSend(value);
.read(appSettingsNotifierProvider.notifier)
.setEnterToSend(value);
}, },
), ),
), ),
@@ -806,9 +790,7 @@ class SettingsScreen extends HookConsumerWidget {
trailing: Switch( trailing: Switch(
value: settings.appBarTransparent, value: settings.appBarTransparent,
onChanged: (value) { onChanged: (value) {
ref ref.read(appSettingsProvider.notifier).setAppBarTransparent(value);
.read(appSettingsNotifierProvider.notifier)
.setAppBarTransparent(value);
}, },
), ),
), ),
@@ -820,9 +802,7 @@ class SettingsScreen extends HookConsumerWidget {
trailing: Switch( trailing: Switch(
value: settings.dataSavingMode, value: settings.dataSavingMode,
onChanged: (value) { onChanged: (value) {
ref ref.read(appSettingsProvider.notifier).setDataSavingMode(value);
.read(appSettingsNotifierProvider.notifier)
.setDataSavingMode(value);
}, },
), ),
), ),
@@ -836,9 +816,7 @@ class SettingsScreen extends HookConsumerWidget {
trailing: Switch( trailing: Switch(
value: settings.disableAnimation, value: settings.disableAnimation,
onChanged: (value) { onChanged: (value) {
ref ref.read(appSettingsProvider.notifier).setDisableAnimation(value);
.read(appSettingsNotifierProvider.notifier)
.setDisableAnimation(value);
}, },
), ),
), ),
@@ -865,7 +843,7 @@ class SettingsScreen extends HookConsumerWidget {
label: '${(settings.windowOpacity * 100).round()}%', label: '${(settings.windowOpacity * 100).round()}%',
onChanged: (value) { onChanged: (value) {
ref ref
.read(appSettingsNotifierProvider.notifier) .read(appSettingsProvider.notifier)
.setWindowOpacity(value); .setWindowOpacity(value);
}, },
), ),

View File

@@ -6,312 +6,173 @@ part of 'pack_detail.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$marketplaceStickerPackContentHash() => // GENERATED CODE - DO NOT MODIFY BY HAND
r'886f8305c978dbea6e5d990a7d555048ac704a5d'; // 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));
}
}
/// Marketplace version of sticker pack detail page (no publisher dependency). /// Marketplace version of sticker pack detail page (no publisher dependency).
/// Shows all stickers in the pack and provides a button to add the sticker. /// Shows all stickers in the pack and provides a button to add the sticker.
/// API interactions are intentionally left blank per request. /// API interactions are intentionally left blank per request.
///
/// Copied from [marketplaceStickerPackContent].
@ProviderFor(marketplaceStickerPackContent) @ProviderFor(marketplaceStickerPackContent)
const marketplaceStickerPackContentProvider = const marketplaceStickerPackContentProvider =
MarketplaceStickerPackContentFamily(); MarketplaceStickerPackContentFamily._();
/// Marketplace version of sticker pack detail page (no publisher dependency). /// Marketplace version of sticker pack detail page (no publisher dependency).
/// Shows all stickers in the pack and provides a button to add the sticker. /// Shows all stickers in the pack and provides a button to add the sticker.
/// API interactions are intentionally left blank per request. /// API interactions are intentionally left blank per request.
///
/// Copied from [marketplaceStickerPackContent]. final class MarketplaceStickerPackContentProvider
class MarketplaceStickerPackContentFamily extends
extends Family<AsyncValue<List<SnSticker>>> { $FunctionalProvider<
AsyncValue<List<SnSticker>>,
List<SnSticker>,
FutureOr<List<SnSticker>>
>
with $FutureModifier<List<SnSticker>>, $FutureProvider<List<SnSticker>> {
/// Marketplace version of sticker pack detail page (no publisher dependency). /// Marketplace version of sticker pack detail page (no publisher dependency).
/// Shows all stickers in the pack and provides a button to add the sticker. /// Shows all stickers in the pack and provides a button to add the sticker.
/// API interactions are intentionally left blank per request. /// API interactions are intentionally left blank per request.
/// const MarketplaceStickerPackContentProvider._({
/// Copied from [marketplaceStickerPackContent]. required MarketplaceStickerPackContentFamily super.from,
const MarketplaceStickerPackContentFamily(); required String super.argument,
}) : super(
/// Marketplace version of sticker pack detail page (no publisher dependency). retry: null,
/// 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
MarketplaceStickerPackContentProvider getProviderOverride(
covariant MarketplaceStickerPackContentProvider provider,
) {
return call(packId: provider.packId);
}
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'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<List<SnSticker>> {
/// 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', name: r'marketplaceStickerPackContentProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$marketplaceStickerPackContentHash();
FutureOr<List<SnSticker>> Function(
MarketplaceStickerPackContentRef provider, @override
) String toString() {
create, return r'marketplaceStickerPackContentProvider'
) { ''
return ProviderOverride( '($argument)';
origin: this,
override: MarketplaceStickerPackContentProvider._internal(
(ref) => create(ref as MarketplaceStickerPackContentRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
packId: packId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<SnSticker>> createElement() { $FutureProviderElement<List<SnSticker>> $createElement(
return _MarketplaceStickerPackContentProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnSticker>> create(Ref ref) {
final argument = this.argument as String;
return marketplaceStickerPackContent(ref, packId: argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is MarketplaceStickerPackContentProvider && return other is MarketplaceStickerPackContentProvider &&
other.packId == packId; other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, packId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$marketplaceStickerPackContentHash() =>
// ignore: unused_element r'886f8305c978dbea6e5d990a7d555048ac704a5d';
mixin MarketplaceStickerPackContentRef
on AutoDisposeFutureProviderRef<List<SnSticker>> {
/// The parameter `packId` of this provider.
String get packId;
}
class _MarketplaceStickerPackContentProviderElement /// Marketplace version of sticker pack detail page (no publisher dependency).
extends AutoDisposeFutureProviderElement<List<SnSticker>> /// Shows all stickers in the pack and provides a button to add the sticker.
with MarketplaceStickerPackContentRef { /// API interactions are intentionally left blank per request.
_MarketplaceStickerPackContentProviderElement(super.provider);
final class MarketplaceStickerPackContentFamily extends $Family
with $FunctionalFamilyOverride<FutureOr<List<SnSticker>>, String> {
const MarketplaceStickerPackContentFamily._()
: super(
retry: null,
name: r'marketplaceStickerPackContentProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
/// 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.
MarketplaceStickerPackContentProvider call({required String packId}) =>
MarketplaceStickerPackContentProvider._(argument: packId, from: this);
@override @override
String get packId => (origin as MarketplaceStickerPackContentProvider).packId; String toString() => r'marketplaceStickerPackContentProvider';
} }
String _$marketplaceStickerPackOwnershipHash() =>
r'e5dd301c309fac958729d13d984ce7a77edbe7e6';
/// See also [marketplaceStickerPackOwnership].
@ProviderFor(marketplaceStickerPackOwnership) @ProviderFor(marketplaceStickerPackOwnership)
const marketplaceStickerPackOwnershipProvider = const marketplaceStickerPackOwnershipProvider =
MarketplaceStickerPackOwnershipFamily(); MarketplaceStickerPackOwnershipFamily._();
/// See also [marketplaceStickerPackOwnership]. final class MarketplaceStickerPackOwnershipProvider
class MarketplaceStickerPackOwnershipFamily extends Family<AsyncValue<bool>> { extends $FunctionalProvider<AsyncValue<bool>, bool, FutureOr<bool>>
/// See also [marketplaceStickerPackOwnership]. with $FutureModifier<bool>, $FutureProvider<bool> {
const MarketplaceStickerPackOwnershipFamily(); const MarketplaceStickerPackOwnershipProvider._({
required MarketplaceStickerPackOwnershipFamily super.from,
/// See also [marketplaceStickerPackOwnership]. required String super.argument,
MarketplaceStickerPackOwnershipProvider call({required String packId}) { }) : super(
return MarketplaceStickerPackOwnershipProvider(packId: packId); retry: null,
}
@override
MarketplaceStickerPackOwnershipProvider getProviderOverride(
covariant MarketplaceStickerPackOwnershipProvider provider,
) {
return call(packId: provider.packId);
}
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'marketplaceStickerPackOwnershipProvider';
}
/// See also [marketplaceStickerPackOwnership].
class MarketplaceStickerPackOwnershipProvider
extends AutoDisposeFutureProvider<bool> {
/// See also [marketplaceStickerPackOwnership].
MarketplaceStickerPackOwnershipProvider({required String packId})
: this._internal(
(ref) => marketplaceStickerPackOwnership(
ref as MarketplaceStickerPackOwnershipRef,
packId: packId,
),
from: marketplaceStickerPackOwnershipProvider,
name: r'marketplaceStickerPackOwnershipProvider', name: r'marketplaceStickerPackOwnershipProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: null,
: _$marketplaceStickerPackOwnershipHash,
dependencies: MarketplaceStickerPackOwnershipFamily._dependencies,
allTransitiveDependencies:
MarketplaceStickerPackOwnershipFamily._allTransitiveDependencies,
packId: packId,
); );
MarketplaceStickerPackOwnershipProvider._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
Override overrideWith( String debugGetCreateSourceHash() => _$marketplaceStickerPackOwnershipHash();
FutureOr<bool> Function(MarketplaceStickerPackOwnershipRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'marketplaceStickerPackOwnershipProvider'
override: MarketplaceStickerPackOwnershipProvider._internal( ''
(ref) => create(ref as MarketplaceStickerPackOwnershipRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
packId: packId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<bool> createElement() { $FutureProviderElement<bool> $createElement($ProviderPointer pointer) =>
return _MarketplaceStickerPackOwnershipProviderElement(this); $FutureProviderElement(pointer);
@override
FutureOr<bool> create(Ref ref) {
final argument = this.argument as String;
return marketplaceStickerPackOwnership(ref, packId: argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is MarketplaceStickerPackOwnershipProvider && return other is MarketplaceStickerPackOwnershipProvider &&
other.packId == packId; other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, packId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$marketplaceStickerPackOwnershipHash() =>
// ignore: unused_element r'e5dd301c309fac958729d13d984ce7a77edbe7e6';
mixin MarketplaceStickerPackOwnershipRef on AutoDisposeFutureProviderRef<bool> {
/// The parameter `packId` of this provider.
String get packId;
}
class _MarketplaceStickerPackOwnershipProviderElement final class MarketplaceStickerPackOwnershipFamily extends $Family
extends AutoDisposeFutureProviderElement<bool> with $FunctionalFamilyOverride<FutureOr<bool>, String> {
with MarketplaceStickerPackOwnershipRef { const MarketplaceStickerPackOwnershipFamily._()
_MarketplaceStickerPackOwnershipProviderElement(super.provider); : super(
retry: null,
name: r'marketplaceStickerPackOwnershipProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
MarketplaceStickerPackOwnershipProvider call({required String packId}) =>
MarketplaceStickerPackOwnershipProvider._(argument: packId, from: this);
@override @override
String get packId => String toString() => r'marketplaceStickerPackOwnershipProvider';
(origin as MarketplaceStickerPackOwnershipProvider).packId;
} }
// 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

View File

@@ -3,8 +3,8 @@ import 'dart:ui';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/pods/userinfo.dart'; import 'package:island/pods/userinfo.dart';
import 'package:island/screens/notification.dart'; import 'package:island/screens/notification.dart';
import 'package:island/services/responsive.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/config.dart';
import 'package:island/pods/chat/chat_summary.dart'; import 'package:island/pods/chat/chat_summary.dart';
final currentRouteProvider = StateProvider<String?>((ref) => null); final currentRouteProvider = NotifierProvider<CurrentRouteNotifier, String?>(
CurrentRouteNotifier.new,
);
class CurrentRouteNotifier extends Notifier<String?> {
@override
String? build() {
return null;
}
void updateRoute(String? route) {
state = route;
}
}
const kWideScreenRouteStart = 4; const kWideScreenRouteStart = 4;
const kTabRoutes = [ const kTabRoutes = [
@@ -42,16 +55,14 @@ class TabsScreen extends HookConsumerWidget {
// Update the current route provider whenever the location changes // Update the current route provider whenever the location changes
useEffect(() { useEffect(() {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
ref.read(currentRouteProvider.notifier).state = currentLocation; ref.read(currentRouteProvider.notifier).updateRoute(currentLocation);
}); });
return null; return null;
}, [currentLocation]); }, [currentLocation]);
final notificationUnreadCount = ref.watch( final notificationUnreadCount = ref.watch(notificationUnreadCountProvider);
notificationUnreadCountNotifierProvider,
);
final chatUnreadCount = ref.watch(chatUnreadCountNotifierProvider); final chatUnreadCount = ref.watch(chatUnreadCountProvider);
final wideScreen = isWideScreen(context); final wideScreen = isWideScreen(context);
@@ -134,7 +145,7 @@ class TabsScreen extends HookConsumerWidget {
isWideScreen(context) ? null : kWideScreenRouteStart, isWideScreen(context) ? null : kWideScreenRouteStart,
); );
final shouldShowFab = routes.contains(currentLocation) && !wideScreen; final shouldShowFab = routes.contains(currentLocation) && !wideScreen;
final settings = ref.watch(appSettingsNotifierProvider); final settings = ref.watch(appSettingsProvider);
if (isWideScreen(context)) { if (isWideScreen(context)) {
return Container( return Container(

View File

@@ -66,7 +66,7 @@ class ThoughtScreen extends HookConsumerWidget {
); );
// Get initial thoughts and topic from provider // Get initial thoughts and topic from provider
final initialThoughts = thoughts.valueOrNull; final initialThoughts = thoughts.value;
final initialTopic = final initialTopic =
(initialThoughts?.isNotEmpty ?? false) && (initialThoughts?.isNotEmpty ?? false) &&
initialThoughts!.first.sequence?.topic != null initialThoughts!.first.sequence?.topic != null

View File

@@ -6,190 +6,157 @@ part of 'think.dart';
// RiverpodGenerator // 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<AsyncValue<bool>, bool, FutureOr<bool>>
with $FutureModifier<bool>, $FutureProvider<bool> {
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<bool> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<bool> create(Ref ref) {
return thoughtAvailableStaus(ref);
}
}
String _$thoughtAvailableStausHash() => String _$thoughtAvailableStausHash() =>
r'720e04e56bff8c4d4ca6854ce997da4e7926c84c'; r'720e04e56bff8c4d4ca6854ce997da4e7926c84c';
/// See also [thoughtAvailableStaus].
@ProviderFor(thoughtAvailableStaus)
final thoughtAvailableStausProvider = AutoDisposeFutureProvider<bool>.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<bool>;
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) @ProviderFor(thoughtSequence)
const thoughtSequenceProvider = ThoughtSequenceFamily(); const thoughtSequenceProvider = ThoughtSequenceFamily._();
/// See also [thoughtSequence]. final class ThoughtSequenceProvider
class ThoughtSequenceFamily extends
extends Family<AsyncValue<List<SnThinkingThought>>> { $FunctionalProvider<
/// See also [thoughtSequence]. AsyncValue<List<SnThinkingThought>>,
const ThoughtSequenceFamily(); List<SnThinkingThought>,
FutureOr<List<SnThinkingThought>>
/// See also [thoughtSequence]. >
ThoughtSequenceProvider call(String sequenceId) { with
return ThoughtSequenceProvider(sequenceId); $FutureModifier<List<SnThinkingThought>>,
} $FutureProvider<List<SnThinkingThought>> {
const ThoughtSequenceProvider._({
@override required ThoughtSequenceFamily super.from,
ThoughtSequenceProvider getProviderOverride( required String super.argument,
covariant ThoughtSequenceProvider provider, }) : super(
) { retry: null,
return call(provider.sequenceId);
}
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'thoughtSequenceProvider';
}
/// See also [thoughtSequence].
class ThoughtSequenceProvider
extends AutoDisposeFutureProvider<List<SnThinkingThought>> {
/// See also [thoughtSequence].
ThoughtSequenceProvider(String sequenceId)
: this._internal(
(ref) => thoughtSequence(ref as ThoughtSequenceRef, sequenceId),
from: thoughtSequenceProvider,
name: r'thoughtSequenceProvider', name: r'thoughtSequenceProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$thoughtSequenceHash();
FutureOr<List<SnThinkingThought>> Function(ThoughtSequenceRef provider)
create, @override
) { String toString() {
return ProviderOverride( return r'thoughtSequenceProvider'
origin: this, ''
override: ThoughtSequenceProvider._internal( '($argument)';
(ref) => create(ref as ThoughtSequenceRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
sequenceId: sequenceId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<List<SnThinkingThought>> createElement() { $FutureProviderElement<List<SnThinkingThought>> $createElement(
return _ThoughtSequenceProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnThinkingThought>> create(Ref ref) {
final argument = this.argument as String;
return thoughtSequence(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is ThoughtSequenceProvider && other.sequenceId == sequenceId; return other is ThoughtSequenceProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, sequenceId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$thoughtSequenceHash() => r'2a93c0a04f9a720ba474c02a36502940fb7f3ed7';
// ignore: unused_element
mixin ThoughtSequenceRef
on AutoDisposeFutureProviderRef<List<SnThinkingThought>> {
/// The parameter `sequenceId` of this provider.
String get sequenceId;
}
class _ThoughtSequenceProviderElement final class ThoughtSequenceFamily extends $Family
extends AutoDisposeFutureProviderElement<List<SnThinkingThought>> with $FunctionalFamilyOverride<FutureOr<List<SnThinkingThought>>, String> {
with ThoughtSequenceRef { const ThoughtSequenceFamily._()
_ThoughtSequenceProviderElement(super.provider); : super(
retry: null,
name: r'thoughtSequenceProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
ThoughtSequenceProvider call(String sequenceId) =>
ThoughtSequenceProvider._(argument: sequenceId, from: this);
@override @override
String get sequenceId => (origin as ThoughtSequenceProvider).sequenceId; String toString() => r'thoughtSequenceProvider';
}
@ProviderFor(thoughtServices)
const thoughtServicesProvider = ThoughtServicesProvider._();
final class ThoughtServicesProvider
extends
$FunctionalProvider<
AsyncValue<ThoughtServicesResponse>,
ThoughtServicesResponse,
FutureOr<ThoughtServicesResponse>
>
with
$FutureModifier<ThoughtServicesResponse>,
$FutureProvider<ThoughtServicesResponse> {
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<ThoughtServicesResponse> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<ThoughtServicesResponse> create(Ref ref) {
return thoughtServices(ref);
}
} }
String _$thoughtServicesHash() => r'0ddeaec713ecfcdc9786c197f3d4cb41d36c26a5'; String _$thoughtServicesHash() => r'0ddeaec713ecfcdc9786c197f3d4cb41d36c26a5';
/// See also [thoughtServices].
@ProviderFor(thoughtServices)
final thoughtServicesProvider =
AutoDisposeFutureProvider<ThoughtServicesResponse>.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<ThoughtServicesResponse>;
// 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

View File

@@ -991,7 +991,7 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
} }
} }
final transactionListNotifierProvider = AsyncNotifierProvider( final transactionListProvider = AsyncNotifierProvider(
TransactionListNotifier.new, TransactionListNotifier.new,
); );
@@ -1019,9 +1019,7 @@ class TransactionListNotifier extends AsyncNotifier<List<SnTransaction>>
} }
} }
final walletFundsNotifierProvider = AsyncNotifierProvider( final walletFundsProvider = AsyncNotifierProvider(WalletFundsNotifier.new);
WalletFundsNotifier.new,
);
class WalletFundsNotifier extends AsyncNotifier<List<SnWalletFund>> class WalletFundsNotifier extends AsyncNotifier<List<SnWalletFund>>
with AsyncPaginationController<SnWalletFund> { with AsyncPaginationController<SnWalletFund> {
@@ -1045,7 +1043,7 @@ class WalletFundsNotifier extends AsyncNotifier<List<SnWalletFund>>
} }
} }
final walletFundRecipientsNotifierProvider = AsyncNotifierProvider( final walletFundRecipientsProvider = AsyncNotifierProvider(
WalletFundRecipientsNotifier.new, WalletFundRecipientsNotifier.new,
); );
@@ -1428,8 +1426,8 @@ class WalletScreen extends HookConsumerWidget {
// Transactions Tab // Transactions Tab
PaginationList( PaginationList(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
provider: transactionListNotifierProvider, provider: transactionListProvider,
notifier: transactionListNotifierProvider.notifier, notifier: transactionListProvider.notifier,
itemBuilder: (context, index, transaction) { itemBuilder: (context, index, transaction) {
final isIncome = final isIncome =
transaction.payeeWalletId == wallet.value?.id; transaction.payeeWalletId == wallet.value?.id;
@@ -1519,7 +1517,7 @@ class WalletScreen extends HookConsumerWidget {
} }
Widget _buildFundsList(BuildContext context, WidgetRef ref) { Widget _buildFundsList(BuildContext context, WidgetRef ref) {
final funds = ref.watch(walletFundsNotifierProvider); final funds = ref.watch(walletFundsProvider);
return funds.when( return funds.when(
data: (fundList) { data: (fundList) {
@@ -1781,7 +1779,7 @@ class WalletScreen extends HookConsumerWidget {
if (paidOrder != null) { if (paidOrder != null) {
// Wait for server to handle order // Wait for server to handle order
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
ref.invalidate(walletFundsNotifierProvider); ref.invalidate(walletFundsProvider);
ref.invalidate(walletCurrentProvider); ref.invalidate(walletCurrentProvider);
if (context.mounted) { if (context.mounted) {
showSnackBar('fundCreatedSuccessfully'.tr()); showSnackBar('fundCreatedSuccessfully'.tr());
@@ -1807,7 +1805,7 @@ class WalletScreen extends HookConsumerWidget {
if (context.mounted) hideLoadingModal(context); if (context.mounted) hideLoadingModal(context);
// Invalidate providers to refresh data // Invalidate providers to refresh data
ref.invalidate(transactionListNotifierProvider); ref.invalidate(transactionListProvider);
ref.invalidate(walletCurrentProvider); ref.invalidate(walletCurrentProvider);
if (context.mounted) { if (context.mounted) {
showSnackBar('transferCreatedSuccessfully'.tr()); showSnackBar('transferCreatedSuccessfully'.tr());

View File

@@ -6,180 +6,157 @@ part of 'wallet.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
@ProviderFor(walletCurrent)
const walletCurrentProvider = WalletCurrentProvider._();
final class WalletCurrentProvider
extends
$FunctionalProvider<
AsyncValue<SnWallet?>,
SnWallet?,
FutureOr<SnWallet?>
>
with $FutureModifier<SnWallet?>, $FutureProvider<SnWallet?> {
const WalletCurrentProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'walletCurrentProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$walletCurrentHash();
@$internal
@override
$FutureProviderElement<SnWallet?> $createElement($ProviderPointer pointer) =>
$FutureProviderElement(pointer);
@override
FutureOr<SnWallet?> create(Ref ref) {
return walletCurrent(ref);
}
}
String _$walletCurrentHash() => r'bdc7cb27ce2286b561a03522085cc4efc884faad'; String _$walletCurrentHash() => r'bdc7cb27ce2286b561a03522085cc4efc884faad';
/// See also [walletCurrent]. @ProviderFor(walletStats)
@ProviderFor(walletCurrent) const walletStatsProvider = WalletStatsProvider._();
final walletCurrentProvider = AutoDisposeFutureProvider<SnWallet?>.internal(
walletCurrent, final class WalletStatsProvider
name: r'walletCurrentProvider', extends
debugGetCreateSourceHash: $FunctionalProvider<
const bool.fromEnvironment('dart.vm.product') AsyncValue<SnWalletStats>,
? null SnWalletStats,
: _$walletCurrentHash, FutureOr<SnWalletStats>
dependencies: null, >
allTransitiveDependencies: null, with $FutureModifier<SnWalletStats>, $FutureProvider<SnWalletStats> {
); const WalletStatsProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'walletStatsProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$walletStatsHash();
@$internal
@override
$FutureProviderElement<SnWalletStats> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnWalletStats> create(Ref ref) {
return walletStats(ref);
}
}
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef WalletCurrentRef = AutoDisposeFutureProviderRef<SnWallet?>;
String _$walletStatsHash() => r'2243011937b377a66cdf44cae144021cee69e82f'; String _$walletStatsHash() => r'2243011937b377a66cdf44cae144021cee69e82f';
/// See also [walletStats].
@ProviderFor(walletStats)
final walletStatsProvider = AutoDisposeFutureProvider<SnWalletStats>.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<SnWalletStats>;
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) @ProviderFor(walletFund)
const walletFundProvider = WalletFundFamily(); const walletFundProvider = WalletFundFamily._();
/// See also [walletFund]. final class WalletFundProvider
class WalletFundFamily extends Family<AsyncValue<SnWalletFund>> { extends
/// See also [walletFund]. $FunctionalProvider<
const WalletFundFamily(); AsyncValue<SnWalletFund>,
SnWalletFund,
/// See also [walletFund]. FutureOr<SnWalletFund>
WalletFundProvider call(String fundId) { >
return WalletFundProvider(fundId); with $FutureModifier<SnWalletFund>, $FutureProvider<SnWalletFund> {
} const WalletFundProvider._({
required WalletFundFamily super.from,
@override required String super.argument,
WalletFundProvider getProviderOverride( }) : super(
covariant WalletFundProvider provider, retry: null,
) {
return call(provider.fundId);
}
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'walletFundProvider';
}
/// See also [walletFund].
class WalletFundProvider extends AutoDisposeFutureProvider<SnWalletFund> {
/// See also [walletFund].
WalletFundProvider(String fundId)
: this._internal(
(ref) => walletFund(ref as WalletFundRef, fundId),
from: walletFundProvider,
name: r'walletFundProvider', name: r'walletFundProvider',
debugGetCreateSourceHash: isAutoDispose: true,
const bool.fromEnvironment('dart.vm.product') dependencies: null,
? null $allTransitiveDependencies: 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
Override overrideWith( String debugGetCreateSourceHash() => _$walletFundHash();
FutureOr<SnWalletFund> Function(WalletFundRef provider) create,
) { @override
return ProviderOverride( String toString() {
origin: this, return r'walletFundProvider'
override: WalletFundProvider._internal( ''
(ref) => create(ref as WalletFundRef), '($argument)';
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
fundId: fundId,
),
);
} }
@$internal
@override @override
AutoDisposeFutureProviderElement<SnWalletFund> createElement() { $FutureProviderElement<SnWalletFund> $createElement(
return _WalletFundProviderElement(this); $ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<SnWalletFund> create(Ref ref) {
final argument = this.argument as String;
return walletFund(ref, argument);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return other is WalletFundProvider && other.fundId == fundId; return other is WalletFundProvider && other.argument == argument;
} }
@override @override
int get hashCode { int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode); return argument.hashCode;
hash = _SystemHash.combine(hash, fundId.hashCode);
return _SystemHash.finish(hash);
} }
} }
@Deprecated('Will be removed in 3.0. Use Ref instead') String _$walletFundHash() => r'459efdee5e2775eedaa4312e0d317c218fa7e1fa';
// ignore: unused_element
mixin WalletFundRef on AutoDisposeFutureProviderRef<SnWalletFund> {
/// The parameter `fundId` of this provider.
String get fundId;
}
class _WalletFundProviderElement final class WalletFundFamily extends $Family
extends AutoDisposeFutureProviderElement<SnWalletFund> with $FunctionalFamilyOverride<FutureOr<SnWalletFund>, String> {
with WalletFundRef { const WalletFundFamily._()
_WalletFundProviderElement(super.provider); : super(
retry: null,
name: r'walletFundProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
WalletFundProvider call(String fundId) =>
WalletFundProvider._(argument: fundId, from: this);
@override @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

Some files were not shown because too many files have changed in this diff Show More