deleteTemplate method
- String name
Delete a template by name and update the SharedPreferences.
Warning This will also delete the template file.
Implementation
Future<void> deleteTemplate(String name) async {
// Remove from prefs StringList
var templates = prefs.getStringList('templates');
if (templates == null) return;
templates.remove(name);
prefs.setStringList('templates', templates);
// Delete template file
await File(getTemplateFilePath(name)).delete();
Notify.message('deletedinstance-text'.i18n([name]));
}