validate method

  1. @override
void validate()

Validates

Implementation

@override
void validate() {
  if (LocalAssertUtils.isNullOrEmptyOrInvalid(_key, String)) {
    throw const LocalNotificationsException(message: 'key id is requried');
  }
  if (LocalAssertUtils.isNullOrEmptyOrInvalid(_label, String)) {
    throw const LocalNotificationsException(
        message: 'label id is requried');
  }
  if (LocalAssertUtils.isNullOrEmptyOrInvalid(_autoDismissible, bool)) {
    throw const LocalNotificationsException(
        message: 'autoDismissible id is requried');
  }
  if (LocalAssertUtils.isNullOrEmptyOrInvalid(_showInCompactView, bool)) {
    throw const LocalNotificationsException(
        message: 'showInCompactView id is requried');
  }

  // For action buttons, it's only allowed resource media types
  if (!LocalStringUtils.isNullOrEmpty(_icon) &&
      LocalBitmapUtils().getMediaSource(_icon!) != MediaSource.Resource) {
    throw const LocalNotificationsException(
        message:
            'icons for action buttons must be a native resource media type');
  }
}