getAll method

Future<List<QuickbooksAccount>> getAll({
  1. required String accessToken,
  2. required String companyId,
  3. String? conditions,
})

Gets all QuickbooksAccount in the Quickbooks API for the given accessToken and companyId

Implementation

Future<List<QuickbooksAccount>> getAll({
  required String accessToken,
  required String companyId,
  String? conditions,
}) async {
  List<Map<String, dynamic>> items = await getMany(
    accessToken: accessToken,
    companyId: companyId,
    conditions: conditions,
    location: 'Account',
  );

  List<QuickbooksAccount> results = [];

  for (var item in items) {
    try {
      results.add(QuickbooksAccount.fromMap(item));
    } catch (e) {
      print(e);
    }
  }
  return results;
}