Closed dylan-dinh closed 5 years ago
A few things, this is used in a restful style, so UserInfo, is your own model. It matches what the output from the api request should be. It will deal with the de-serialization from Json.
A great example: https://github.com/Clancey/simple_auth/blob/master/simple_auth/lib/src/providers/google.dart#L120-L167 Use this data model and you could change that code to be
var userInfo = await api.send<GoogleUser>("https://www.googleapis.com/oauth2/v1/userinfo?alt=json");
The request is what you want to send. api.Send is where the request is sent to the web server. As for using it without async, thats not possible. Using await is using async.
Hello,
what is(request) combined.
Because if I get it, you have the user's information in
var userInfo = await api.send<UserInfo>(request);
More precisely what is UserInfo ? And what is api.sendvar request
. And why do you use await without async ?Thanks for the clarifications.