fetchBookById method

Future<MyResponse<Book>> fetchBookById(
  1. int bookId
)

Implementation

Future<MyResponse<Book>> fetchBookById(int bookId) async {
  var response = await DioUtils.request(DioUtils.REQUEST_GET, "${Apis.FETCH_ALL_BOOKS}$bookId");
  if (response.statusCode == 200) {
    return MyResponse<Book>.fromJson(response.data,Apis.SINGLE);
  } else {
    return MyResponse<Book>.init(Apis.CODE_ERROR, null, null);
  }
}