put method

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

Send a PUT web request

Implementation

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

  final http.Response response = await http.Client()
      .put(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 [PUT] $url\n${response.body}');
  }

  _checkResponse(response);

  return json.decode(response.body);
}