getInstitutionsForCountry method

Future<List<Institution>> getInstitutionsForCountry({
  1. required String countryCode,
})

Gets the Institutions (Banks) for the given countryCode.

Refer to Step 2 of Nordigen Account Information API documentation. countryCode is just two-letter country code (ISO 3166).

Implementation

Future<List<Institution>> getInstitutionsForCountry({
  required String countryCode,
}) async {
  // Make GET request and fetch output.
  final List<dynamic> fetchedData = await _nordigenGetter(
        endpointUrl:
            'https://bankaccountdata.gocardless.com/api/v2/institutions/?country=$countryCode',
      ) ??
      <dynamic>[];
  // Map the recieved List<dynamic> into List<Institution> Data Format.
  return fetchedData
      .map<Institution>(
        (dynamic institutionItem) => Institution.fromMap(institutionItem),
      )
      .toList();
}