getAllClients method

Future<Response> getAllClients({
  1. dynamic accessToken,
})

Implementation

Future<Response> getAllClients({accessToken}) async {
  Map<String, String> headers = {'Authorization': 'Bearer $accessToken'};

  var response = await networking.getData(
      path: 'get_all_client_by_createdby_id', headers: headers);

  if (response.isSuccess && response.data != null) {
    GetClientResponse getClientResponse =
        GetClientResponse.fromJson(response.data);

    return Response(true, data: getClientResponse.client, message: '');
  } else if (response.message.contains('No records')) {
    return Response(false, message: 'No records');
  }

  return Response(false, message: response.message);
}