getBlock method

Future<Map> getBlock({
  1. String block = 'best',
  2. bool expanded = false,
})

Returns block as a Map. block enter block id or number, expanded returned block data should be expanded

Implementation

Future<Map> getBlock({String block = 'best', bool expanded = false}) async {
  var headers = {
    'accept': 'application/json',
  };

  String e;
  if (expanded == true) {
    e = 'true';
  } else {
    e = 'false';
  }
  var u = Uri.parse('$url/blocks/$block?expanded=$e');
  var res = await http.get(u, headers: headers);
  Map map = json.decode(res.body);
  return map;
}