findByEmail method

Future<Client?> findByEmail(
  1. String email
)

Find client by its contact email address

Implementation

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

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

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