NumberSpec class final
Specification for numeric types (integer and floating-point).
Constructors
-
NumberSpec({bool isInteger = false, num? minimum, num? maximum, bool exclusiveMinimum = false, bool exclusiveMaximum = false, num? multipleOf, num? defaultValue, String? description, bool nullable = false, List<
Object> ? examples, bool isDeprecated = false}) -
Creates a new NumberSpec.
const
-
NumberSpec.double({num? minimum, num? maximum, bool exclusiveMinimum = false, bool exclusiveMaximum = false, num? multipleOf, double? defaultValue, String? description, bool nullable = false, List<
Object> ? examples, bool isDeprecated = false}) -
Creates a double/number spec.
const
-
NumberSpec.integer({num? minimum, num? maximum, bool exclusiveMinimum = false, bool exclusiveMaximum = false, num? multipleOf, int? defaultValue, String? description, bool nullable = false, List<
Object> ? examples, bool isDeprecated = false}) -
Creates an integer spec.
const
Properties
- defaultValue → num?
-
Default value.
final
- description → String?
-
Optional description of this type.
finalinherited
-
examples
→ List<
Object> ? -
Example values for documentation.
finalinherited
- exclusiveMaximum → bool
-
Whether the maximum is exclusive.
final
- exclusiveMinimum → bool
-
Whether the minimum is exclusive.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDeprecated → bool
-
Whether this type is deprecated.
finalinherited
- isInteger → bool
-
Whether this is an integer type.
final
- maximum → num?
-
Maximum value.
final
- minimum → num?
-
Minimum value.
final
- multipleOf → num?
-
Value must be a multiple of this number.
final
- nullable → bool
-
Whether this type accepts null values.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
asNullable(
) → NumberSpec -
Creates a copy of this spec with nullable set to true.
override
-
copyWith(
{bool? isInteger, num? minimum, num? maximum, bool? exclusiveMinimum, bool? exclusiveMaximum, num? multipleOf, num? defaultValue, String? description, bool? nullable, List< Object> ? examples, bool? isDeprecated}) → NumberSpec - Creates a copy with the given modifications.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withDescription(
String description) → NumberSpec -
Creates a copy of this spec with the given description.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited