getCreditCardSetting static method

Future<List<CreditCardSettingsModel>> getCreditCardSetting({
  1. required String token,
  2. required BuildContext context,
})

Implementation

static Future<List<CreditCardSettingsModel>> getCreditCardSetting(
    {required String token, required BuildContext context}) async {
  final url = Uri.parse(
    ApiEndPoint.creditCardSettings,
  );
  Map<String, String> header = {'Content-Type': 'application/json', "Authorization": token};
  var result = await http.get(
    url,
    headers: header,
  );
  List<CreditCardSettingsModel> creditCardSettings = [];
  if (result.statusCode == 200) {
    List response = jsonDecode(result.body);
    creditCardSettings = response.map((e) => CreditCardSettingsModel.fromJson(e)).toList();
    print('notification count:::${response}');
  }
  return creditCardSettings;
}