findByNumber method

Future<RecurringInvoice?> findByNumber(
  1. String number
)

Find an invoice by its number

Implementation

Future<RecurringInvoice?> findByNumber(String number) async {
  final response = await WebClient().get(
      '${InvoiceNinjaAdmin.url}/api/v1/recurring_invoices?invoice_number=$number',
      token: InvoiceNinjaAdmin.token);

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

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