BpmValidator class final

Validator for BPM (beats per minute) tag values.

This validator ensures that BPM values are within the valid range of 1-999 (inclusive), representing realistic musical tempos from very slow ballads to extremely fast electronic music.

Error keys:

  • outOfRange: Value is outside the valid range (1-999)

Example usage:

const validator = BpmValidator();

final error = validator.validate(120);  // null (valid)
final error2 = validator.validate(0);   // {outOfRange: {...}}
final error3 = validator.validate(1000); // {outOfRange: {...}}
Inheritance

Constructors

BpmValidator()
Creates a new BPM validator.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

formatErrorMessage(Map<String, dynamic> error) String
Formats the error map into a human-readable error message.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
validate(int? value) Map<String, dynamic>?
Validates the given value.
override
validateOrThrow(int value) int
Validates the value and throws an ArgumentError if invalid.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isValid(int? value) bool
Checks if a value is within the valid BPM range.

Constants

max → const int
The maximum valid BPM value (inclusive).
min → const int
The minimum valid BPM value (inclusive).
outOfRangeError → const String
Error key for out-of-range values.