restore method

Future<void> restore()

Puts back the value it had before glint switched it on; nothing when glint did not.

Implementation

Future<void> restore() async {
  if (!pending) return;
  String? prior;
  try {
    prior = (jsonDecode(_saved.readAsStringSync()) as Map<String, Object?>)['prior'] as String?;
  } on Object {
    prior = null;
  }
  if (prior == null || prior.isEmpty || prior == 'null') {
    await _settings(['delete', 'system', 'show_touches']);
  } else {
    await _settings(['put', 'system', 'show_touches', prior]);
  }
  _saved.deleteSync();
}