listCustomers method
Retrieve all customers created.
Implementation
Future<List<MollieCustomer>> listCustomers() async {
List<MollieCustomer> customers = [];
var res = await http.get(
Uri.parse(_apiEndpoint),
headers: _headers,
);
dynamic data = json.decode(res.body);
for (int i = 0; i < data["count"]; i++) {
var customer = data["_embedded"]["customers"][i];
customers.add(MollieCustomer.build(customer));
}
return customers;
}