deleteLayout method

Future<void> deleteLayout(
  1. String id
)

Delete a layout configuration

Implementation

Future<void> deleteLayout(String id) async {
  // Remove from cache
  _configCache.remove(id);

  // Remove from storage
  await _storage.deleteLayoutConfig(id);

  // If this was the current layout, reset the current layout
  if (_currentLayoutId == id) {
    _currentLayoutId =
        _configCache.isNotEmpty ? _configCache.keys.first : null;
    notifyListeners();

    if (_currentLayoutId != null) {
      _notifyLayoutChange();
    }
  }
}