savePreferences method

Future<void> savePreferences({
  1. required String widgetCode,
  2. required Color backgroundColor,
  3. required String appBarTitle,
  4. required Color appBarBackgroundColor,
  5. required Color appBarTitleColor,
  6. required Color appBarBackButtonColor,
})

Implementation

Future<void> savePreferences({
  required String widgetCode,
  required Color backgroundColor,
  required String appBarTitle,
  required Color appBarBackgroundColor,
  required Color appBarTitleColor,
  required Color appBarBackButtonColor,
}) async {
  final prefs = await SharedPreferences.getInstance();

  await prefs.setString(_keyWidgetCode, widgetCode);
  await prefs.setInt(_keyBackgroundColor, backgroundColor.value);
  await prefs.setString(_keyAppBarTitle, appBarTitle);
  await prefs.setInt(_keyAppBarBackgroundColor, appBarBackgroundColor.value);
  await prefs.setInt(_keyAppBarTitleColor, appBarTitleColor.value);
  await prefs.setInt(_keyAppBarBackButtonColor, appBarBackButtonColor.value);
}