Files
tripz/lib/controller/home/profile/promos_controller.dart
2023-09-08 18:25:14 +03:00

33 lines
741 B
Dart

import 'dart:convert';
import 'package:get/get.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/controller/functions/crud.dart';
class PromosController extends GetxController {
List<dynamic> promoList = [];
bool isloading = true;
@override
void onInit() {
getPromoBytody();
super.onInit();
}
Future getPromoBytody() async {
var res = await CRUD().get(link: AppLink.getPromoBytody, payload: {});
if (res.toString() == 'failure') {
Get.snackbar('failure', 'message');
isloading = false;
update();
} else {
var jsonDecoded = jsonDecode(res);
promoList = jsonDecoded['message'];
print(promoList);
isloading = false;
update();
}
}
}