PreconditionStatus.fromBoolean constructor Null safety

PreconditionStatus.fromBoolean(
  1. bool result,
  2. [Object? data]
)

Often you have a boolean value in your hands - use this constructor to create either PreconditionStatus.satisfied() (true) or PreconditionStatus.unsatisfied() (false).

Implementation

factory PreconditionStatus.fromBoolean(bool result, [Object? data]) {
  if (result) return PreconditionStatus.satisfied(data);
  return PreconditionStatus.unsatisfied(data);
}