Created
October 12, 2020 22:39
-
-
Save ptruiz/df95588bfa637ef67b007f8776e7d7a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void loginWithGitHub(String code) async { | |
//Step 4 | |
final response = await http.post( | |
"https://github.com/login/oauth/access_token", | |
headers: { | |
"Content-Type": "application/json", | |
"Accept": "application/json" | |
}, | |
body: "{\"client_id\":\"" + CLIENT_ID | |
+ "\",\"client_secret\":\"" + CLIENT_SECRET | |
+ "\",\"code\":\"" + code | |
+ "\"}", | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the body interpolation the dart string can be single quote string, so you wouldn't have to escape the quotes inside the string everywhere => it'd make the code more readable. (Unless you are using some automatic styling plugin which strictly enforcing the double quotes.)
I'd also use string interpolation for the variables: