post method

Future post(
  1. String url, {
  2. String? companyKey,
  3. String? token,
  4. dynamic data,
})

Send a POST web request

Implementation

Future<dynamic> post(
  String url, {
  String? companyKey,
  String? token,
  dynamic data,
}) async {
  _checkInitialized();

  final http.Response response = await http.Client()
      .post(Uri.parse(url),
          body: json.encode(data),
          headers: _getHeaders(companyKey: companyKey, token: token))
      .timeout(const Duration(seconds: 60));

  if (InvoiceNinja.debugEnabled == true ||
      InvoiceNinjaAdmin.debugEnabled == true) {
    _printWrapped('Invoice Ninja [POST] $url\n${response.body}');
  }

  _checkResponse(response);

  return json.decode(response.body);
}