Step.fromMap constructor
Step.fromMap( - dynamic stepMap
)
Implementation
factory Step.fromMap(dynamic stepMap) {
final kindOrdinal = stepMap["kind"] as int?;
final directionOrdinal = stepMap["direction"] as int?;
return Step(
name: stepMap["name"] as String?,
number: stepMap["number"] as int,
distance: stepMap["distance"] as double,
duration: stepMap["duration"] as double,
isLastStep: stepMap["isLastStep"] as bool,
levelDifference: stepMap["levelDifference"] as double?,
kind: kindOrdinal != null ? Kind.values.elementAt(kindOrdinal) : null,
direction: directionOrdinal != null
? Direction.values.elementAt(directionOrdinal)
: null,
navInstructions: NavigationInstructions.fromMap(
Map<String, dynamic>.from(stepMap["navInstructions"])),
);
}