save method
Persist client to the server
Implementation
Future<Client> save(Client client) async {
dynamic response;
if (client.id.isEmpty) {
response = await WebClient().post(
'${InvoiceNinjaAdmin.url}/api/v1/clients',
token: InvoiceNinjaAdmin.token,
data: client.toJson());
} else {
response = await WebClient().put(
'${InvoiceNinjaAdmin.url}/api/v1/clients/${client.id}',
token: InvoiceNinjaAdmin.token,
data: client.toJson());
}
return ClientItem.fromJson(response).data;
}