hasPermission method

Future<bool> hasPermission(
  1. String featureName
)

Check if user has a specific permission

Implementation

Future<bool> hasPermission(String featureName) async {
  try {
    final prefs = await SharedPreferences.getInstance();
    final permissions = prefs.getStringList('user_permissions') ?? [];

    final hasIt = permissions.contains(featureName);
    print('🔍 Checking permission "$featureName": ${hasIt ? "✅ GRANTED" : "❌ DENIED"}');

    if (!hasIt) {
      print('📋 Available permissions: $permissions');
    }

    return hasIt;
  } catch (e) {
    print('❌ Error checking permission: $e');
    return false;
  }
}