get method

Future get(
  1. String endPoint
)

Make a custom get request to a Woocommerce endpoint, using WooCommerce SDK.

Implementation

Future<dynamic> get(String endPoint) async {
  String url = this._getOAuthURL("GET", endPoint);
  String _token = await _localDbService.getSecurityToken();
  String _bearerToken = "Bearer $_token";
  _printToLog('this is the bearer token : ' + _bearerToken);
  Map<String, String> headers = new HashMap();
  headers.putIfAbsent('Accept', () => 'application/json charset=utf-8');
  // 'Authorization': _bearerToken,
  try {
    final http.Response response = await http.get(Uri.parse(url));
    if (response.statusCode == 200) {
      return json.decode(response.body);
    }
    _handleHttpError(response);
  } on SocketException {
    throw Exception('No Internet connection.');
  }
}