containerPeaker method

void containerPeaker()

Implementation

void containerPeaker() async {
  //show whats "underneath" each tile
  buttonsDisabled = true;
  List<int> peaked = [];
  int peaking = 0;
  await Future<dynamic>.delayed(const Duration(seconds: 2));
  for (int i = 0; i < containers.length; i++) {
    while (peaked.contains(peaking)) {
      peaking = _random.nextInt(containers.length);
    }
    peaked.add(peaking);
    if (mounted) {
      setState(() {
        containerHide[peaking] = containers[peaking]; //reveal tile
      });
    }
    await Future<dynamic>.delayed(const Duration(seconds: 1));
    containerHide[peaking] =
        'packages/cognition_package/assets/images/hidden.png'; //after time, set back to default
  }
  if (mounted) {
    setState(() {
      matchObject = tempMatch;
    });
  }
  buttonsDisabled = false;
}