Hello the dart code below contains a series of locations with the gps position, at the time of starting the app I have to retrieve the long and lat that I have saved in two variables, what I have to do next is to sort the list of locations based on the gps distance from where to find me this is based on lat and long how can I do?
Dart Code:
double longitudine=0,latitudine=0;
Future<bool> caricamentoSedi() async {
await _getGpsValue();
listaSedi = await Sede.caricamento();
//This point write function order listaSedi
return true;
}
Sede class:
class Sede {
//Costruttore di una sede
Sede(this.info_id, this.app_id, this.info_title, this.descrizione, this.email,
this.telefono, this.lat, this.long, this.note,this.rgbcolor);
final int info_id, app_id;
double lat = 0, long = 0;
final String info_title, descrizione, email, telefono, note,rgbcolor;
//Descrizione: Funzione che effettua il caricamento delle sedi
static Future<List<Sede>> caricamento() async {
return await SedeController.caricamento();
}
//Descrizione: funzione che recupero l'email
String getEmail() {
return email;
}
//Descrizione: funzione che recupera la descrizione
String getDescrizione() {
return descrizione;
}
//Descrizione: funzione che recupera il numero di telefono rimuovendo li spazi vuoti presenti nel valore
String getTelefono() {
return telefono.replaceAll(new RegExp(r"\s+"), "");
}
//Recupero latitudine
double getLatitudine() {
return lat;
}
//Recupero longitudine
double getLongitudine() {
return long;
}
//Recupero note
String getNote() {
return this.note;
}
}