-
-
Save yaizudamashii/0a71070e150c80806131807969a97ef0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_riverpod/flutter_riverpod.dart'; | |
import 'package:flutter_voice_chat_using_agora/services/shared_preferences_service.dart'; | |
import 'package:state_notifier/state_notifier.dart'; | |
final onboardingViewModelProvider = StateNotifierProvider<OnboardingViewModel, bool>((ref) { | |
final sharedPreferencesService = ref.watch(sharedPreferencesServiceProvider); | |
return OnboardingViewModel(sharedPreferencesService); | |
}); | |
class OnboardingViewModel extends StateNotifier<bool> { | |
OnboardingViewModel(this.sharedPreferencesService) | |
: super(sharedPreferencesService.isOnboardingComplete()); | |
final SharedPreferencesService sharedPreferencesService; | |
Future<void> completeOnboarding() async { | |
await sharedPreferencesService.setOnboardingComplete(); | |
state = true; | |
} | |
bool get isOnboardingComplete => state; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment