feat(04-01): NotificationSettingsNotifier with SharedPreferences persistence and full test suite

- Fix NotificationService API calls to use flutter_local_notifications v21 named parameters
- Expose nextInstanceOf as @visibleForTesting public method for unit testing
- Create NotificationSettingsNotifier with @Riverpod(keepAlive: true)
- NotificationSettings data class with enabled bool + TimeOfDay fields
- Persist notifications_enabled, notifications_hour, notifications_minute to SharedPreferences
- Sync default state in build(), async _load() overrides on hydration
- Update tests to use correct Riverpod 3 provider name (notificationSettingsProvider)
- Add makeContainer() helper to await initial _load() before asserting mutations
- All 84 tests pass (72 existing + 12 new notification tests)
This commit is contained in:
2026-03-16 14:57:04 +01:00
parent 0f6789becd
commit 4f72eac933
4 changed files with 151 additions and 31 deletions

View File

@@ -0,0 +1,65 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'notification_settings_notifier.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
@ProviderFor(NotificationSettingsNotifier)
final notificationSettingsProvider = NotificationSettingsNotifierProvider._();
final class NotificationSettingsNotifierProvider
extends
$NotifierProvider<NotificationSettingsNotifier, NotificationSettings> {
NotificationSettingsNotifierProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'notificationSettingsProvider',
isAutoDispose: false,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$notificationSettingsNotifierHash();
@$internal
@override
NotificationSettingsNotifier create() => NotificationSettingsNotifier();
/// {@macro riverpod.override_with_value}
Override overrideWithValue(NotificationSettings value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<NotificationSettings>(value),
);
}
}
String _$notificationSettingsNotifierHash() =>
r'0d04ca73c4724bb84ce8d92608cd238cb362254a';
abstract class _$NotificationSettingsNotifier
extends $Notifier<NotificationSettings> {
NotificationSettings build();
@$mustCallSuper
@override
void runBuild() {
final ref = this.ref as $Ref<NotificationSettings, NotificationSettings>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<NotificationSettings, NotificationSettings>,
NotificationSettings,
Object?,
Object?
>;
element.handleCreate(ref, build);
}
}