Skip to content

Instantly share code, notes, and snippets.

@preetjdp
Created March 28, 2020 20:52
Show Gist options
  • Select an option

  • Save preetjdp/2d6db1d94b4995e1046b3c727e6eac81 to your computer and use it in GitHub Desktop.

Select an option

Save preetjdp/2d6db1d94b4995e1046b3c727e6eac81 to your computer and use it in GitHub Desktop.
class NearByPeople {
List<User> nearbyPeople;
NearByPeople({@required this.nearbyPeople});
List<BuddyLocation> nearByLocationPoints() {
return nearbyPeople.map((person) => person.location).toList();
}
Set<Marker> nearbyMarkers(BuildContext context) {
List<BuddyLocation> nearbyLocationPoints = nearByLocationPoints();
return nearbyLocationPoints
.map((point) => Marker(
markerId: MarkerId(point.uid),
position: point.latLng,
flat: true,
icon: Provider.of<BitmapDescriptor>(context)))
.toSet();
}
factory NearByPeople.fromList(List<User> users) =>
NearByPeople(nearbyPeople: users);
factory NearByPeople.initialData() {
return NearByPeople(nearbyPeople: [User.initialData()]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment