moveMessagesToFlag method Null safety

Future<MoveResult> moveMessagesToFlag(
  1. MessageSequence sequence,
  2. MailboxFlag flag
)

Moves the specified message sequence to the folder flagged with the specified mailbox flag.

Implementation

Future<MoveResult> moveMessagesToFlag(
    MessageSequence sequence, MailboxFlag flag) {
  final target = getMailbox(flag);
  if (target == null) {
    throw StateError('Move target mailbox with flag $flag not found');
  }
  return _incomingMailClient.moveMessages(sequence, target);
}