showDomainPreferencesDialog function

Future<void> showDomainPreferencesDialog(
  1. BuildContext context
)

Implementation

Future<void> showDomainPreferencesDialog(BuildContext context) async {
  final domain = AppPreferences.private.domain;

  bool isWrapped(String key) => key.startsWith("$domain.");
  String unwrap(String key) => key.replaceFirst("$domain.", "");

  final keys = AppPreferences.global.getKeys().toList();
  keys.sort();
  final values = <String, String>{
    for (final key in keys)
      if (isWrapped(key))
        unwrap(key): AppPreferences.global.get(key)?.toString() ?? ""
  };

  await showKDialogContent(
    context,
    title: "Preferencias",
    builder: (context) => _Content(values),
  );
}