import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../constants.dart'; import 'settings_options.dart'; class SettingsProvider extends ChangeNotifier { bool showSameCountry; SettingsProvider({ this.showSameCountry = false, // default value }); void toggleShowSameCountries() async { showSameCountry = !showSameCountry; notifyListeners(); SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.setBool(Constants.prefKeySameCountry, showSameCountry); } List get settingsOptions => [ SettingsOption( title: "Match within my country", subtitle: 'Show profiles from your country only', getValue: () => showSameCountry, onChanged: (value) => toggleShowSameCountries(), ), ]; }