generateService static method

String generateService()

Implementation

static String generateService() {
  return '''
import 'package:shared_preferences/shared_preferences.dart';

class FeatureService {
static late SharedPreferences _prefs;

static Future<void> initialize() async {
  _prefs = await SharedPreferences.getInstance();
}

static Future<void> setFeatureEnabled(String featureId, bool enabled) async {
  await _prefs.setBool('feature_\$featureId', enabled);
}

static bool isFeatureEnabled(String featureId) {
  return _prefs.getBool('feature_\$featureId') ?? true;
}

static Future<bool> isOnboardingCompleted() async {
  return _prefs.getBool('onboardingCompleted') ?? false;
}

static Future<void> completeOnboarding() async {
  await _prefs.setBool('onboardingCompleted', true);
}

static Future<void> resetOnboarding() async {
  await _prefs.setBool('onboardingCompleted', false);
}

// Specific feature checks
static bool get isCameraEnabled => isFeatureEnabled('camera');
static bool get isImagePickerEnabled => isFeatureEnabled('image_picker');
static bool get isLocationEnabled => isFeatureEnabled('location');
static bool get isContactsEnabled => isFeatureEnabled('contacts');
static bool get isCallEnabled => isFeatureEnabled('call');
}
''';
}