onInit method
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
Implementation
@override
void onInit() async {
super.onInit();
List<dynamic> arguments = Get.arguments ?? [];
try {
if(arguments.isNotEmpty) {
if(arguments.elementAt(0) is ChamberPreset) {
chamberPreset = arguments.elementAt(0);
} else if(arguments.elementAt(0) is NeomFrequency) {
chamberPreset.neomFrequency = arguments.elementAt(0);
}
}
if(Get.isRegistered<UserService>()) {
userServiceImpl = Get.find<UserService>();
}
if(Get.isRegistered<FrequencyService>()) {
frequencyServiceImpl = Get.find<FrequencyService>();
}
profile = userServiceImpl?.profile;
chambers.value = profile?.chambers ?? {};
soundController = SoundController();
chamberPreset.neomFrequency ??= NeomFrequency();
chamberPreset.neomParameter ??= NeomParameter();
settingChamber();
_recorder = FlutterSoundRecorder();
initializeRecorder();
} catch(e) {
AppConfig.logger.e(e.toString());
}
}