rollback method
Rollback a view to the previously saved version.
Implementation
Future<bool> rollback(String module, String viewId) async {
if (cacheStorage == null || viewService == null) return false;
final key = '$_rollbackPrefix${module}_$viewId';
final historyKey = '${key}_history';
final historyStr = await cacheStorage!.read(historyKey);
if (historyStr == null) return false;
final history = (jsonDecode(historyStr) as List).cast<String>();
if (history.isEmpty) return false;
final rollbackJson = history.removeAt(0);
await cacheStorage!.write(historyKey, jsonEncode(history));
final json = jsonDecode(rollbackJson) as Map<String, dynamic>;
final definition = NiceViewDefinition.fromJson(json);
await viewService!.cache.put(definition);
return true;
}