Skip to content

Instantly share code, notes, and snippets.

@emiliodallatorre
Created November 2, 2023 09:54
Show Gist options
  • Select an option

  • Save emiliodallatorre/2ff10fe2bee09dd27f8fa828b52417c5 to your computer and use it in GitHub Desktop.

Select an option

Save emiliodallatorre/2ff10fe2bee09dd27f8fa828b52417c5 to your computer and use it in GitHub Desktop.

Revisions

  1. emiliodallatorre created this gist Nov 2, 2023.
    17 changes: 17 additions & 0 deletions location_helper.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    import 'package:cloud_firestore/cloud_firestore.dart';
    import 'package:geoflutterfire2/geoflutterfire2.dart';

    class LocationHelper {
    static Map<String, dynamic> geoFirePointToJson(final GeoFirePoint? geoFirePoint) {
    return geoFirePoint?.data;
    }

    static GeoFirePoint? geoFirePointFromJson(final Map<String, dynamic>? json) {
    if (json == null) {
    return null;
    }

    final GeoPoint geoPoint = json["geopoint"] as GeoPoint;
    return GeoFirePoint(geoPoint.latitude, geoPoint.longitude);
    }
    }