This commit is contained in:
Mohamed Nouffer
2022-04-17 11:45:21 +05:30
parent ee3845681d
commit e6cf730ae2
30 changed files with 1260 additions and 534 deletions

View File

@ -6,8 +6,6 @@ import 'package:http/http.dart' as http;
class LocationService{
static Future<GeoJsonFeatureCollection?> loadLocations() async {
final geo = GeoJson();
GeoJsonFeatureCollection? fs;
String url = 'http://localhost:8100/api/location/';
final response = await http.get(Uri.parse(url),
headers: <String, String>{
@ -19,11 +17,10 @@ class LocationService{
return featuresFromGeoJson(utf8.decode(response.bodyBytes));
}
return null;
}
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture) async {
final geo = GeoJson();
GeoJsonFeatureCollection? fs;
String url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
final response = await http.get(Uri.parse(url),
headers: <String, String>{
@ -33,8 +30,27 @@ class LocationService{
if (response.statusCode == 200) {
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
//print(cc);
return cc; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
}
return null;
}
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture) async {
String url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
//print(cc);
return cc; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
}
return null;
}