LevelGoalTracker constructor

LevelGoalTracker({
  1. Key? key,
  2. required List<GoalItem> goals,
  3. Axis direction = Axis.horizontal,
  4. bool showLabel = false,
  5. double spacing = NeonTheme.s8,
  6. EdgeInsetsGeometry? padding,
  7. BoxDecoration? itemDecoration,
})

Implementation

LevelGoalTracker({
  super.key,
  required this.goals,
  this.direction = Axis.horizontal,
  this.showLabel = false,
  this.spacing = NeonTheme.s8,
  this.padding,
  this.itemDecoration,
}) {
  if (goals.isEmpty || goals.length > 4) {
    throw ArgumentError.value(
      goals.length,
      'goals.length',
      'must have 1 to 4 goals',
    );
  }
  final ids = <String>{};
  for (final goal in goals) {
    if (!ids.add(goal.id)) {
      throw ArgumentError.value(
        goal.id,
        'goals',
        'duplicate goal id: "${goal.id}"',
      );
    }
  }
}