removeManualRule method

Future<bool> removeManualRule(
  1. String ruleKey
)

Remove a manual rule

Implementation

Future<bool> removeManualRule(String ruleKey) async {
  try {
    final manualRules = await _loadManualRules();
    final initialCount = manualRules.length;

    manualRules.removeWhere((rule) => rule['key']?.toString() == ruleKey);

    if (manualRules.length == initialCount) {
      ObslyLogger.warn('Manual rule "$ruleKey" not found');
      return false;
    }

    await _saveManualRules(manualRules);
    await _refreshRulesFromSources();

    ObslyLogger.log('🗑️ Manual rule "$ruleKey" removed');
    return true;
  } catch (e) {
    ObslyLogger.error('Error removing manual rule: $e');
    return false;
  }
}