optimized

This commit is contained in:
Mohamed Nouffer
2023-10-06 16:25:21 +05:30
parent 7fdb6c05ee
commit 0e2a8f89f3
101 changed files with 50948 additions and 4137 deletions

View File

@ -2,22 +2,20 @@ import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:rogapp/utils/const.dart';
class PerfectureService{
class PerfectureService {
static Future<List<dynamic>?> loadPerfectures() async {
List<dynamic> perfs = [];
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/perf_main/';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
//print('++++++++$url');
final response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
perfs = json.decode(utf8.decode(response.bodyBytes));
}
return perfs;
@ -26,35 +24,34 @@ class PerfectureService{
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
List<dynamic> perfs = [];
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/subperfinmain/?area=' + area;
print('++++++++$url');
final response = await http.get(Uri.parse(url),
String url = '$serverUrl/api/subperfinmain/?area=$area';
//print('++++++++$url');
final response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
perfs = json.decode(utf8.decode(response.bodyBytes));
}
return perfs;
}
static Future<List<dynamic>?> getMainPerfExt(String id) async {
List<dynamic> perfs = [];
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/mainperfext/?perf=' + id;
print('++++++++$url');
final response = await http.get(Uri.parse(url),
String url = '$serverUrl/api/mainperfext/?perf=$id';
//print('++++++++$url');
final response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
perfs = json.decode(utf8.decode(response.bodyBytes));
}
return perfs;
@ -63,16 +60,16 @@ class PerfectureService{
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
List<dynamic> perfs = [];
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/allgifuareas/?perf=' + perf;
print('++++++++$url');
final response = await http.get(Uri.parse(url),
String url = '$serverUrl/api/allgifuareas/?perf=$perf';
//print('++++++++$url');
final response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
perfs = json.decode(utf8.decode(response.bodyBytes));
}
return perfs;
@ -82,40 +79,35 @@ class PerfectureService{
List<dynamic> perfs = [];
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/customareanames';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
//print('++++++++$url');
final response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
perfs = json.decode(utf8.decode(response.bodyBytes));
}
return perfs;
}
static Future<List<dynamic>?> getSubExt(String id) async {
List<dynamic> perfs = [];
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/perfext/?sub_perf=' + id;
print('++++++++$url');
final response = await http.get(Uri.parse(url),
String url = '$serverUrl/api/perfext/?sub_perf=$id';
//print('++++++++$url');
final response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
perfs = json.decode(utf8.decode(response.bodyBytes));
}
return perfs;
}
}