getFrom method

Future<Map<String, dynamic>> getFrom(
  1. String url,
  2. Map<String, String> headers
)

Implementation

Future<Map<String, dynamic>> getFrom(
    String url, Map<String, String> headers) async {
  http.Response response = await http.get(url, headers: headers);
  int code = response.statusCode;
  String body = response.body;
  if (code != 200) {
    print('rest.dart: getFrom: $url: Non 200 response: $code: body: $body');
    return {};
  }
  // print('rest.dart: getFrom: $url: successful.');
  return json.decode(body);
}