Skip to content

Commit

Permalink
feat: Create stim when task starts
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-bermonti committed Jun 9, 2024
1 parent 45d908c commit f56edec
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/src/digit_span_task/components/stim/stim_controller.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:digit_span_tasks/src/digit_span_task/components/stim/stim_creator.dart';
import 'package:get/get.dart';
import 'package:digit_span_tasks/src/digit_span_task/components/activity/activity_controller.dart';
import 'package:digit_span_tasks/src/digit_span_task/components/exceptions/errors.dart';
Expand All @@ -6,6 +7,8 @@ import 'package:stimuli/errors.dart';
import 'package:stimuli/stimuli.dart';
import 'package:digit_span_tasks/src/digit_span_task/components/config/ds_config.dart';

import '../config/user_config.dart';

/// Manage the stim
class StimController extends GetxController {
late Stimuli stim;
Expand All @@ -22,8 +25,14 @@ class StimController extends GetxController {

/// Prepare stim pool to be used.
Future<void> prepareStimPool() async {
UserConfig userConfig = _config.userConfig;
final List<String> stimList = createDigitSets(
minSize: userConfig.minStimSize,
maxSize: userConfig.maxStimSize,
countEachSize: userConfig.countEachSize,
);
try {
stim = Stimuli(stimuli: _config.userConfig.stimList);
stim = Stimuli(stimuli: stimList);
} on StimFileAccessException catch (e) {
throw GenericDigitSpanTasksException(e.toString());
}
Expand Down

0 comments on commit f56edec

Please sign in to comment.