JsonNumberNode class

Represents a JSON numeric node in the Dart JSON model.

This node wraps a numeric value (int or double) and provides type-checking consistent with JsonNode.

Usage Example

final numNode = JsonNumberNode(42);

if (numNode.isNumber()) {
  print(numNode.toObject()); // 42
}

Behavior Overview

Dart JSON Value Internal Representation Description
42 value = 42 Integer value
3.14 value = 3.14 Floating-point value

Design Notes

  • Stores the numeric value in a final value field for immutability.
  • Supports conversion back to native Dart num via toObject.
  • Type-checking methods align with the JsonNode interface.
Implemented types

Constructors

JsonNumberNode(num value)
Represents a JSON numeric node in the Dart JSON model.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
value → num
The numeric value of this JSON node.
final

Methods

isArray() → bool
Returns true if this node represents a JSON array ([...]).
override
isBoolean() → bool
Returns true if this node represents a JSON boolean (true or false).
override
isNull() → bool
Returns true if this node represents a JSON null.
override
isNumber() → bool
Returns true if this node represents a JSON number.
override
isObject() → bool
Returns true if this node represents a JSON object ({...}).
override
isTextual() → bool
Returns true if this node represents a JSON string.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toObject() → num
Generic interface representing a parsed node in Jetleaf's structured data model (JSON/YAML/other).
override
toString() → String
A string representation of this object.
inherited

Operators

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