validate method

void validate()

Validate the parameters

Throws ArgumentError if something is wrong.

Implementation

void validate() {
  if (id.length > 32) {
    throw ArgumentError('Exceeds 32 character limit', 'id');
  }
  if (!_id.hasMatch(id)) {
    throw ArgumentError('Invalid character', 'id');
  }
  if (version != null && version!.isNotEmpty) {
    if (!_version.hasMatch(version!)) {
      throw ArgumentError('Invalid character', 'version');
    }
  }
  if (salt != null && salt!.isNotEmpty) {
    if (!_saltValue.hasMatch(salt!)) {
      throw ArgumentError('Invalid salt', 'salt');
    }
  }
  if (hash != null && hash!.isNotEmpty) {
    if (!_hashValue.hasMatch(hash!)) {
      throw ArgumentError('Invalid hash', 'hash');
    }
  }
  if (params != null) {
    for (final e in params!.entries) {
      if (e.key.length > 32) {
        throw ArgumentError('Exceeds 32 character limit', 'params:${e.key}');
      }
      if (!_paramName.hasMatch(e.key)) {
        throw ArgumentError('Invalid character', 'params:${e.key}');
      }
      if (!_paramValue.hasMatch(e.value)) {
        throw ArgumentError('Invalid character', 'params:${e.key}:value');
      }
    }
  }
}