toMap method

Map<String, dynamic> toMap()

Implementation

Map<String, dynamic> toMap() {
  final Map<String, dynamic> optionsMap = <String, dynamic>{};

  void addIfNonNull(String fieldName, dynamic value) {
    if (value != null) {
      optionsMap[fieldName] = value;
    }
  }

  addIfNonNull('degree', degree);
  addIfNonNull('location', this.location?.toJson());
  addIfNonNull('bearing_before', this.bearingBefore);
  addIfNonNull('bearing_after', this.bearingAfter);
  addIfNonNull('instruction', this.instruction);
  addIfNonNull('type', this.type);
  addIfNonNull('modifier', this.modifier);
  addIfNonNull('exit', this.exit);
  return optionsMap;
}