APIs

Open file locate: ./lib/api/..

  • http_manager.dark: define API url, timeout, post, get, exception code handler
  • api.dark: define constants Suffix API url for each function

http_manager.dark

You can change your API URL from here for your new API URI following format https://{domain}/index.php/wp-json

You also can customize about connectTimeout, receiveTimeout … etc

class HTTPManager {
  BaseOptions baseOptions = BaseOptions(
    baseUrl: "https://demo.listarapp.com/index.php/wp-json",
    connectTimeout: 30000,
    receiveTimeout: 30000,
    headers: {},
    contentType: Headers.jsonContentType,
    responseType: ResponseType.json,
  );

api.dark

This file has defined all API suffix for all functions of this project. So every function need define API URL

  static const String AUTH_LOGIN = "/jwt-auth/v1/token";
  static const String AUTH_VALIDATE = "/jwt-auth/v1/token/validate";
  static const String REGISTER = "/listar/v1/auth/register";
  static const String FORGOT_PASSWORD = "/listar/v1/auth/reset_password";
  static const String CHANGE_PASSWORD = "/wp/v2/users/me";
  static const String CHANGE_PROFILE = "/wp/v2/users/me";
  static const String GET_SETTING = "/listar/v1/setting/init";
  static const String GET_HOME = "/listar/v1/home/init";
  static const String GET_CATEGORY = "/listar/v1/category/list";
  static const String GET_WISHLIST = "/listar/v1/wishlist/list";
  static const String SAVE_WISHLIST = "/listar/v1/wishlist/save";
  static const String DELETE_WISHLIST = "/listar/v1/wishlist/remove";
  static const String CLEAR_WISHLIST = "/listar/v1/wishlist/reset";
  static const String GET_LIST_PRODUCT = "/listar/v1/place/list";
  static const String GET_COMMENT = "/listar/v1/comments";
  static const String SAVE_COMMENT = "/wp/v2/comments";
  static const String GET_PRODUCT_DETAIL = "/listar/v1/place/view";
  static const String GET_AREA = "/listar/v1/location/list";