Mix.chooser constructor Null safety

Mix.chooser(
  1. {required bool condition,
  2. required Mix trueMix,
  3. required Mix falseMix}
)

Chooses mix based on condition

Implementation

factory Mix.chooser({
  required bool condition,
  required Mix trueMix,
  required Mix falseMix,
}) {
  if (condition) {
    return trueMix;
  } else {
    return falseMix;
  }
}