Last active
June 27, 2020 05:56
-
-
Save TetsuFe/d3fe877a61923774649026e33c3f2018 to your computer and use it in GitHub Desktop.
Got an error: Uncaught Error: Unsupported operation: Platform._version
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
import 'dart:convert'; | |
import 'dart:io'; | |
void main() async { | |
final parsedUri = | |
Uri.parse('https://run.mocky.io/v3/ff312e74-ac17-49ee-9ce3-8638d7329917'); | |
// DartPad error will be occured! | |
final myAccountRequest = await HttpClient().getUrl(parsedUri); | |
final myAccountResponse = await myAccountRequest.close(); | |
final myAccountJsonString = await utf8.decodeStream(myAccountResponse); | |
final myAccount = jsonDecode(myAccountJsonString); | |
// display foobar | |
print(myAccount['username']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment