Skip to content

Instantly share code, notes, and snippets.

View muellercornelius's full-sized avatar

Cornelius Müller muellercornelius

View GitHub Profile
@muellercornelius
muellercornelius / getLengthofPolyline.dart
Created April 30, 2021 08:27
Calculate the length of a polyline using Geolocator and a Google Maps Polyline
Polyline track = new Polyline(polylineId: PolylineId("1"), points: [/*your track data*/]);
distance = 0;
for (int i = 0; i < track.points.length; i++) {
if (track.points.length > 1 && i > 0) {
LatLng startPoint = track.points[i - 1];
LatLng endPoint = track.points[i];
distance += Geolocator.distanceBetween(startPoint.latitude, startPoint.longitude, endPoint.latitude, endPoint.longitude);
}
}
@muellercornelius
muellercornelius / main.dart
Created May 27, 2021 15:56
Flutter Clock
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override