getErrors method

Set<String>? getErrors()

Gets errors if Invalid, null if Valid.

Implementation

Set<String>? getErrors() => switch (this) {
  Invalid(:final errors) => errors,
  Valid() => null,
};