import 'package:get/get.dart'; import 'package:get_storage/get_storage.dart'; class VoiceReplicationController extends GetxController { final GetStorage _storage = GetStorage(); RxBool isReplicating = false.obs; RxString speakerProfileId = ''.obs; @override void onInit() { super.onInit(); _getDefaultData(); } void _getDefaultData() { isReplicating.value = _storage.read('open_voice_replication') ?? false; speakerProfileId.value = _storage.read('speakerProfileId') ?? ''; } void switchChange(bool value) { isReplicating.value = value; if (speakerProfileId.value.isNotEmpty) { _storage.write('open_voice_replication', value); } } }