deleteInstrument method

Future<void> deleteInstrument(
  1. String id
)

deletes customer instrument using id

Implementation

Future<void> deleteInstrument(String id) async {
  final customer = state.value;

  await checkout.deleteInstrument(id);

  state = AsyncValue.data(
    customer!.copyWith(
      instruments: [
        for (final i in customer.instruments)
          if (i.id != id) i,
      ],
    ),
  );
}