validate method

void validate()

Implementation

void validate() {
  if (!RegExp(r'^[A-Za-z0-9_-]{1,160}$').hasMatch(mediaRef) ||
      fileName.isEmpty ||
      fileName.length > 255 ||
      RegExp(r'[/\\\x00-\x1f]').hasMatch(fileName) ||
      !const {'image/jpeg', 'image/png', 'image/webp'}.contains(mimeType) ||
      bytes <= 0 ||
      bytes > 100 * 1024 * 1024 ||
      width < 1 ||
      height < 1 ||
      width > 8192 ||
      height > 8192 ||
      width * height > 16 * 1024 * 1024) {
    throw const FormatException('Invalid gallery image metadata.');
  }
}