Guest User

Untitled

a guest
Jul 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. // From a button tap
  2. onTap: () async {
  3. print('MapFilerSettings..FINAL...slected.... check _lat = ' + _lat.toString());
  4. GeoPoint areaGP = new GeoPoint(_lat, _lng);
  5. Area searchArea = new Area(areaGP, 50.0);
  6. getEvents(seachArea);...
  7.  
  8. /// biild future or StreamBuilder...test ???
  9.  
  10.  
  11. Stream<List<EventData>> getEvents(area) {
  12. try {
  13. return getDataInArea(
  14. area: area,
  15. locationFieldNameInDB: 'geoPoint',
  16. mapper: (eventDoc) {
  17. print('mapFiterSettings.....getGeoPointsByRadius....data: '+eventDoc.data['email'].toString());
  18. // var event = _eventSerializer.fromMap(eventDoc.data);
  19. // // if you serializer does not pass types like GeoPoint through
  20. // // you have to add that fields manually. If using `jaguar_serializer`
  21. // // add @pass attribute to the GeoPoint field and you can omit this.
  22. // event.location = eventDoc.data['location'] as GeoPoint;
  23. // event.id = eventDoc.documentID;
  24. // return new EventData(event);
  25. },
  26. locationAccessor: (eventData) => eventData.event.location,
  27. distanceMapper: (eventData, distance) {
  28. eventData.distance = distance;
  29. return eventData;
  30. }, collection: null,
  31. // distanceAccessor: (eventData) => eventDatas.distance, collection: null,
  32. // clientSitefilters: (event) => event.startTime > DateTime.now(), collection: null // filer only future events
  33. );
  34. } on Exception catch (ex) {
  35. print(ex);
  36. }
  37. return null;
  38. }
Add Comment
Please, Sign In to add comment