build method
Implementation
@override
VoNotificationState build() {
_service = VoNotificationService();
_storage = ref.read(voNotificationStorageProvider);
if (!_isEnabled) {
return const VoNotificationState(
permissionStatus: VoNotificationPermissionStatus.unavailable,
);
}
ref.listen(authControllerProvider.select((s) => s.status), (prev, next) {
if (next == AuthStatus.authenticated) {
syncTokenIfAuthorized();
} else if (next == AuthStatus.unauthenticated) {
unregister();
}
});
final tokenRefreshSub = VoMessaging.onTokenRefresh.listen((token) {
syncToken(token);
});
ref.onDispose(tokenRefreshSub.cancel);
return const VoNotificationState();
}