retrieveAllLocationsByAccount static method

Future<List<Location>> retrieveAllLocationsByAccount(
  1. String accountId
)

Implementation

static Future<List<Location>> retrieveAllLocationsByAccount(String accountId) async {
  final List<Location> locations = [];

  final res = await httpClient.get(Config.getURI('/accounts/$accountId/locations.json'));

  for (final location in json.decode(res.body.toString())) {
    Location l = Location.fromJson(location);
    l.hasPermission = await AuthService.hasPermission(l.accountId);
    locations.add(l);
  }

  return locations;
}