findByIdNumber method

Future<Client?> findByIdNumber(
  1. String idNumber
)

Find client by its id number

Implementation

Future<Client?> findByIdNumber(String idNumber) async {
  final response = await WebClient().get(
      '${InvoiceNinjaAdmin.url}/api/v1/clients?id_number=$idNumber',
      token: InvoiceNinjaAdmin.token);

  final data = ClientList.fromJson(response).data;

  return data.isEmpty ? null : data.first;
}