import 'package:shared_preferences/shared_preferences.dart'; /// WU17b: persists whether the first-run welcome screen (`PantallaBienvenida`, /// `onboarding-welcome` spec) has already been shown, so it renders once /// rather than on every launch. /// /// Same injectable-`SharedPreferences`, versioned-key convention as /// `ServicioContenidoApp` (S3-R4) — but a plain one-time boolean flag, since /// this welcome screen is a single first-impression surface, not something /// that re-triggers per app version the way the "what's new" onboarding /// dialog does. class ServicioBienvenida { ServicioBienvenida({SharedPreferences? prefs}) : _prefs = prefs; static const _keyBienvenidaVista = 'pluri_bienvenida_vista_v1'; final SharedPreferences? _prefs; /// Injected startup instance (S3-R4); getInstance() is only a fallback. Future _resolverPrefs() async => _prefs ?? SharedPreferences.getInstance(); Future debeMostrarBienvenida() async { final prefs = await _resolverPrefs(); return !(prefs.getBool(_keyBienvenidaVista) ?? false); } Future marcarBienvenidaVista() async { final prefs = await _resolverPrefs(); await prefs.setBool(_keyBienvenidaVista, true); } }