onInit method

  1. @override
void onInit()
override

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();
  AppConfig.logger.t("onInit NeomChamber Controller");

  try {
    userServiceImpl.itemlistOwnerType = OwnerType.profile;
    profile = userServiceImpl.profile;
    ownerId = profile.id;
    ownerName = profile.name;

    if(Sint.arguments != null) {
      if(Sint.arguments.isNotEmpty && Sint.arguments[0] is Collective) {
        collective = Sint.arguments[0];
        userServiceImpl.collective = collective!;
      }

      if(collective != null) {
        ownerId = collective!.id;
        ownerName = collective!.name;
        ownerType = OwnerType.collective;
        userServiceImpl.itemlistOwnerType = OwnerType.collective;
      }
    }

    // Listeners para actualizar la vista previa cuando el usuario escribe
    baseFreqController.addListener(_updateBinauralPreview);
    binauralBeatController.addListener(_updateBinauralPreview);

  } catch (e, st) {
    NeomErrorLogger.recordError(e, st, module: 'neom_generator', operation: 'onInit');
  }

}