RailFare class

Represents the fare for a rail journey.

Constructors

RailFare({required double duringPeakTime, required double offPeakTime, required double seniorCitizen})
Creates a new RailFare object.
const
RailFare.empty()
Creates an empty RailFare object.
RailFare.fromJson(Map<String, dynamic> json)
Creates a new RailFare object from a JSON object.
factory

Properties

currentFare double
Returns the current fare for a journey.
no setter
duringPeakTime double
The fare for a journey during peak hours.
final
hashCode int
The hash code for this object.
no setteroverride
isEmpty bool
Whether or not this RailFare object is empty.
no setter
isNotEmpty bool
Whether or not this RailFare object is not empty.
no setter
offPeakTime double
The fare for a journey during off-peak hours.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
seniorCitizen double
Reduced fare for senior citizens.
final

Methods

fareAtTime(DateTime time) double
Returns the fare for a journey at the given time.
isPeakTime(DateTime time) bool
Whether or not the given time is considered peak time.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Returns a JSON representation of this object.
toString() String
A string representation of this object.
override

Operators

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