validate method

void validate()

Validation method to ensure required fields are present

Implementation

void validate() {
  if (to.isEmpty) {
    throw StateError('Mailable must have at least one recipient in "to"');
  }
  if (subject.isEmpty) {
    throw StateError('Mailable must have a non-empty subject');
  }
  if (view.isEmpty) {
    throw StateError('Mailable must have a view path');
  }
}