TermPair constructor Null safety

TermPair(
  1. Term term1,
  2. Term term2
)

Factory constructor that instantiates a TermPair instance:

  • term1 is the first Term in the pair; and
  • term2 is the second Term in the pair. Both terms must be non-empty strings, otherwise an exception is thrown.

Implementation

factory TermPair(Term term1, Term term2) {
  assert(term1.isNotEmpty && term2.isNotEmpty);
  return TermPair._([term1, term2]);
}