refresh static method
Implementation
static void refresh(String id, String refresh, String type, Function callback) {
post("/refresh/$type", "{\"id\": \"$id\", \"refresh\": \"$refresh\"}", (Http.Response response) {
// get token response
TokenResponse tokenResponse = TokenResponse.fromJson(response.body);
authorise(tokenResponse.access);
// write to file
// get documents dir
getApplicationDocumentsDirectory().then((dir) {
// write to file
File("${dir.path}/token.json").writeAsString(response.body);
});
callback();
});
}