Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:shared_preferences/shared_preferences.dart';
final sharedPreferencesServiceProvider = Provider<SharedPreferencesService>((ref) => throw UnimplementedError());
class SharedPreferencesService {
SharedPreferencesService(this.sharedPreferences);
final SharedPreferences sharedPreferences;
static const onboardingCompleteKey = 'onboardingComplete';
Future<void> setOnboardingComplete() async {
await sharedPreferences.setBool(onboardingCompleteKey, true);
}
bool isOnboardingComplete() =>
sharedPreferences.getBool(onboardingCompleteKey) ?? false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment