RollResult class

RollResult represents the result of evaluating a particular node of the AST.

Constructors

RollResult({required String expression, required OpType opType, int ndice = 0, int nsides = 0, List<int> results = const [], RollMetadata metadata = const RollMetadata(), RollResult? left, RollResult? right})
const
RollResult.fromRollResult(RollResult other, {required String expression, OpType? opType, int? ndice, int? nsides, List<int>? results, RollMetadata metadata = const RollMetadata(), RollResult? left, RollResult? right})
factory constructor to merge other with the params of this function and produce a new RollResult.
factory

Properties

expression → String
the parsed expression
final
hashCode → int
The hash code for this object.
no setterinherited
left → RollResult?
final
metadata → RollMetadata
final
ndice → int
number of dice rolled. may be zero if complex expression or arithmetic result
final
nsides → int
number of sides. may be zero if complex expression or arithmetic result
final
opType → OpType
final
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
results → List<int>
the results of the evaluating the expression
final
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
toStringPretty({String indent = ''}) → String
totalOrDefault(int defaultCb()) → int
Get the total, or if results are empty return result of calling defaultCb.

Operators

operator *(RollResult other) → RollResult
multiplication operator for RollResult.
operator +(RollResult other) → RollResult
addition operator for RollResult.
operator -(RollResult other) → RollResult
subtraction operator for RollResult.
operator ==(Object other) → bool
The equality operator.
inherited