25 lines
655 B
Dart
25 lines
655 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:geojson/geojson.dart';
|
|
import 'package:http/http.dart' as http;
|
|
|
|
class LocationService{
|
|
|
|
static Future<GeoJsonFeatureCollection?> loadLocations() async {
|
|
final geo = GeoJson();
|
|
GeoJsonFeatureCollection? fs;
|
|
print("#### feature collection ####");
|
|
String url = 'http://container.intranet.sumasen.net:8100/api/location/';
|
|
final response = await http.get(Uri.parse(url),
|
|
headers: <String, String>{
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
},
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
return featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
|
}
|
|
}
|
|
|
|
} |