getActor method

Future<Actor> getActor(
  1. String actorId
)

Implementation

Future<Actor> getActor(String actorId) async {
  var actorUri = Uri.parse(actorId);

  if (actorUri.authority != Config.domainName) {
    actorUri = actorUri.asProxyUri();
  }

  http.Response response = await http.get(
    actorUri,
    headers: <String, String>{
      "Accept": "application/json",
    },
  );

  String utf8String = utf8.decode(response.bodyBytes);

  Actor actor = Actor.fromJson(jsonDecode(utf8String));

  return actor;
}