getDateFormatList method

  1. @override
Future<NetworkResponse<List<DateFormatModel>>> getDateFormatList()
override

Core

Implementation

@override
Future<NetworkResponse<List<DateFormatModel>>> getDateFormatList() async {
  bool isDisconnect = await WifiService.isDisconnectWhenCallApi();
  if (isDisconnect) return NetworkResponse.withDisconnect();
  try {
    Response response = await AppClientsWeb(requiredToken: false)
        .get(AppEndpoint.getDateFormatList());
    return NetworkResponse.fromResponse(response,
        converter: (json) => (json as List<dynamic>)
            .map<DateFormatModel>((i) => DateFormatModel.fromJson(i))
            .toList());
  } on DioError catch (e) {
    return NetworkResponse.withErrorRequest(e);
  } catch (e) {
    return NetworkResponse.withErrorConvert(e);
  }
}