getPerson method

Future<List<Person>> getPerson(
  1. String search
)

Implementation

Future<List<Person>> getPerson(String search) async {
  final response = await query('search/person', HttpMethod.get, constructQuery(search));

  if (response.statusCode == 200) {
    final List<Person> persons = List<Person>.from(response.data["results"].map((x) => Person.fromJson(x)));
    return persons.toList();
  } else {
    // If the server did not return a 200 OK response,
    // then throw an exception.
    throw Exception('Failed to load Person');
  }
}