|
|
|
@ -12,21 +12,16 @@ class TrafRequestProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
TrafRequestDataModel? trafRequestDataModel;
|
|
|
|
TrafRequestDataModel? trafRequestDataModel;
|
|
|
|
|
|
|
|
|
|
|
|
Future<int> addTraf(Map<String, dynamic> body) async {
|
|
|
|
Future<bool> addTraf(Map<String, dynamic> body) async {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
isLoading = true;
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
Response response = await ApiManager.instance.post(URLs.addTRAF, body: body);
|
|
|
|
Response response = await ApiManager.instance.post(URLs.addTRAF, body: body);
|
|
|
|
if (response.statusCode >= 200 && response.statusCode < 300) {
|
|
|
|
if (response.statusCode >= 200 && response.statusCode < 300) {
|
|
|
|
// trafRequestDataModel = TrafRequestDataModel.fromJson(json.decode(response.body)["data"]);
|
|
|
|
// trafRequestDataModel = TrafRequestDataModel.fromJson(json.decode(response.body)["data"]);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
isLoading = false;
|
|
|
|
return false;
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
isLoading = false;
|
|
|
|
return false;
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|