Skip to content

Commit

Permalink
add destinations attribute to road #21
Browse files Browse the repository at this point in the history
  • Loading branch information
liodali committed Nov 11, 2023
1 parent bf602f5 commit 9c62356
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/src/models/road.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ class Road {
bool _isError = false;
RoadDetailInfo details = RoadDetailInfo();
final List<List<RoadStep>> _roadLegs = <List<RoadStep>>[];

List<String> get destinations => _roadLegs
.expand((legs) => legs)
.map((roadLeg) => roadLeg.destinations)
.where((element) => element != null)
.whereType<String>()
.toList();

Road.empty()
: distance = 0.0,
duration = 0.0,
Expand Down

0 comments on commit 9c62356

Please sign in to comment.